Creating Your Own Resources


It should be obvious from the way sounds are handled that you can put any kind of data into resources. In concept, the steps for creating your own resource types are simple. Let’s go through them with the new, previously undocumented TimeTravel resource type, which enables users with appropriate TimeTravel expansion cards and device drivers to experience anything, anyplace, anytime.
  1. Define a binary format for your resource. You’ll probably want to create an editor that translates user-friendly commands into a tightly compressed binary format. The TimeTravel Editor allows you to select the time, place, and conditions of your appearance in easy-to-use dialog boxes. It then compiles these into a TTV file.

  2. Put the data into a resource file. The TimeTravel Editor can automatically insert TTV files in an RC file. The line might look like this:

  3. 1492 TimeTravel “c:\\ttv\\columbus.ttv”

  4. Compile the resource script into a RES file, and add the RES file to your Visual Basic project.

  5. Write procedures that will process the data. You can write them in
    Visual Basic provided the data is simple enough. Because LoadResData returns an array of bytes, you just need to write code that processes the bytes, converting them to a UDT or another data type if necessary. The Time­Travel resource, however, requires some low-level, high-speed communication between software and device driver. Therefore, the Time­­­Travel Development Kit (TDK) comes with an OLE server (TTAPI­.DLL). Simply register the type library (TTAPI.TLB) in the References dialog box, and you’re ready to load the Destination property and call the TravelThruTime method. Here’s an example:
Dim someday As New CWhenever
someday.Destination = LoadResData(1492, “TimeTravel”)
someday.TravelThruTime

While it’s easy to use TimeTravel resources once you get your hands on them, I didn’t have room to put the software on the companion CD. Furthermore, the hardware required to use time travel data is difficult to find and prohibitively expensive on this planet. For now, you’ll have to play with wave and metafile resources.