August 28, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Visual Basic 6 Win32 API Tutorial

  • November 19, 2002
  • By James Limm
  • Send Email »
  • More Articles »

Let's try to sum up all of the issues we've addressed so far in this chapter concerning API calls:

  • Save your work often
  • Always pass strings ByVal
  • Be very careful when using the Any keyword
  • Pass in the first element when using arrays as buffers
  • Make sure your UDTs map to what the DLL is expecting
  • Never tell a DLL that you've allocated more space than you really have
  • Don't embed null characters in strings if an API call needs it
  • Save your work often
  • And…save your work often

You're bound to run into other subtle "features" when you use the Win32 API. In a way, the Win32 APIs remind me of the English language; it does have structure, but there are a lot of exceptions to the rules. But as long as you try to find out as much as you can about what's going on underneath the scenes, you should be able to solve any problem.

And yes, I did mention the save edict three times. NEVER run your code without saving it first, and I mean NEVER. You're throwing the safety net away when you tear into the Win32 APIs, so save your work before you try to run your code. A crash may shut down VB or even Windows itself, but if your code was saved, you can always go back and figure out what went wrong after the OS reboots


Tags: API, Visual Basic 6



Page 10 of 13



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel