Hi
I was looking for help on how to pass a window handle from VB to a C++ dll and use it in an API call.
Example of passing a long and Multiplying by 2 :-
(VB code)
Private Declare Function TimesTwo Lib "MyTestDll.dll" (ByVal FirstParam As Long) As Long
Private Sub Form_Load()
Debug.Print TimesTwo(2)
End Sub
(DLL code)
define MYTESTDLLEXIM extern "C" __declspec(dllexport)
include "main.h"
MYTESTDLLEXIM long _stdcall TimesTwo( long FirstParam)
{
return ( FirstParam * 2);
}
Example end
This shows that passing a few variables to a dll to deal with some complicated/time consuming maths is actually quite easy. The above example returns 4.
Now back to my original question as I side tracked a little there to try to clarify my question. Look at this incomplete/incorrect example and see if you can understand what I want to achieve.
(VB code)
Private Declare Function FlashForm Lib "MyTestDll.dll" (ByVal hwnd As Long)
Private Sub Form_Load()
Flashform(Me.hwnd)
End Sub
(DLL code)
define MYTESTDLLEXIM extern "C" __declspec(dllexport)
include "main.h"
include <window.h>
MYTESTDLLEXIM long stdcall FlashForm( long hwndPassed)
{
// This is the bit I'm stuck on
FlashWindow(handle of form1 goes here, 1) // 1 = Invert
return (0);
}
Example end
I want to pass form1 window handle and use the FlashWindow API in the dll to flash the form.
Thats it.. Can I say, before I get flamed, that I just want to get to grips with C++ instruction set first so I can augment my VB with dlls and I dont want to get swamped with learning Visual C++ totally at this point. I have asked in various IRC channels and basically was told to @#$#@ and learn C++. You dont need to be a mechanic to drive a car do you ?? and I only do this for fun
Ok.. hope this isnt too lame a question
Thanks
Enter your message below
Sign in or Join us (it's free).