timeSetEvent trouble

smalljug

New member
Joined
Oct 31, 2006
Messages
3
Programming Experience
Beginner
I used an API function written in C++ with a CallBack like timeSetEvent in this
Public Declare Function timeSetEvent Lib "winmm.dll" (ByVal uDelay As Long, ByVal uResolution As Long, ByVal lpFunction As Long, ByVal dwUser As Long, ByVal uFlags As Long) As Long

But in VB .Net, I do not know how to use this type of function. Show me please!
thanks in advance

 
Callback function

In fact I use a self-program API written in VC++ (not timeSetEvent, like timeSetEvent only) , then use VB.Net for interface. In VB I call this function with some parameters include a function pointer from VB. Although I use AddressOf operator but it doesn't work!
 
You need to declare a delegate with the same signature as the method you want to use as the callback. You then declare that argument as your delegate type. You can then explicitly create an instance of your delegate to pass to the argument, using AddressOf to specify the callback function to the delegate constructor.
 
The C++ code is what it is. Windows API functions almost always use 32-bit numbers. In VB6 the Integer type is 16-bit and the Long type is 32-bit, so API declarations in VB6 almost always use Longs. In VB.NET the Integer type is 32-bit and the Long type is 64-bit, so API declarations in VB.NET almost always use Integers. If your C++ code requires 32-bit numbers then your VB.NET declarations must use Integers.
 
Back
Top