Microsoft DirectX 8.0 (Visual Basic) |
Objects stored as resources or at some other location in memory are loaded in much the same way as file objects. See Loading an Object from a File.
The following methods each take a module name and resource identifier as parameters and return an instance of the appropriate class:
The following resource types are recognized by the loader:
String Identifier | Method |
---|---|
DMBAND | LoadBandFromResource |
DMCHORD | LoadChordmapFromResource |
DMCOLL | LoadCollectionFromResource |
DMSEG | LoadSegmentFromResource |
DMSTYLE | LoadStyleFromResource |
Objects referenced by other objects must be loaded first. For example, if you load a segment that contains a reference to a style, the style must be loaded first in order for the segment to play correctly.
The following code example, where loader is a DirectMusicLoader8 object and perf is a DirectMusicPerformance8 object, loads and plays a MIDI file stored as a DMSEG resource in the executable:
Dim seg As DirectMusicSegment8 Set seg = loader.LoadSegmentFromResource("listen.exe", "CANYON.MID") Call seg.Download(perf) Call perf.PlaySegmentEx(SEG, 0, 0)