Game Development Reference
In-Depth Information
The following flags enumeration is used when specifying the Type or State prop-
erty of a menu item. Enabled is a state property, which is fairly self-evident. The
String type is used to say that the menu item is displayed as text, and the Separator
type is used to create a separator line menu item.
internal enum MenuFlags : uint
{
Separator = 0x00000800,
Enabled = 0x00000000,
String = 0x00000000
}
The following method creates a new menu and returns a handle to it if successful.
[DllImport(“user32”)]
internal static extern uint CreatePopupMenu();
The following method adds a menu item to an existing menu created with
CreatePopupMenu() .
[DllImport(“user32”)]
internal static extern int InsertMenuItem(uint menu,
uint position,
uint flags,
ref MenuItemInfo menuItemInfo);
The following method is used to extract information from a group of files, refer-
enced by a drop handle from IDataObject.GetData() . The file parameter is a zero-
based index into the array of files, and the buffer will be set to the full path to the
file. The max parameter is set to the maximum string length; set it to zero for no
maximum.
[DllImport(“shell32”)]
internal static extern uint DragQueryFile(uint dropHandle,
uint file,
StringBuilder buffer,
int max);
}
You can also use this method to retrieve the number of files referenced by a drop
handle. Set the file parameter to 0xffffffff , the buffer to null, and max to zero.
The result will be the number of files in the query.
Search Nedrilad ::




Custom Search