Microsoft DirectX 8.1 (Visual Basic)

Using GUIDs

Microsoft® DirectX® uses globally unique identifiers (GUIDs) extensively for purposes such as identifying objects. GUIDs are actually 128-bit structures, but they are commonly represented by their equivalent string, such as {AC330441-9B71-11D2-9AAB-0020781461AC}.

DirectX8 has a number of predefined GUIDs that are used to identify entities such as particular properties. If a method requires you to pass in a predefined GUID, it is handled as a String data type, and the string form of the GUID is expected. The most convenient approach is to use a string alias, if one exists. For example, the DirectInput8.CreateDevice method enables you to create a device for the standard keyboard by passing in GUID_SysKeyboard rather than the actual GUID string. You can also use the actual string, for example by copying and pasting it from a C++ header file.

To create a GUID

  1. In the \Samples\Multimedia\VBSamples\DXMisc\Bin folder of the DirectX SDK, run Vbguidgen.exe.
  2. Paste the GUID into your Microsoft Visual Basic® application, and place quotation marks around it.

You can also generate GUIDs at run time by calling the DirectX8.CreateNewGuid method.