... Cuz the killed my app!
I really need help on this and the API is dead so please someone point me in the right direction.
http://www.vbforums.com/showthread.php?threadid=129405
Printable View
... Cuz the killed my app!
I really need help on this and the API is dead so please someone point me in the right direction.
http://www.vbforums.com/showthread.php?threadid=129405
VC++ is a second language to me so there may be a better way, but here is how I do it.
'VB Code
VB Code:
'Module Option Explicit Public Declare Function SayHello Lib "test.dll" (ByVal lpString As String, ByVal MyInt As Long, ByVal lpFunc As Long) As Long Private Declare Function lstrcpy Lib "kernel32" (ByVal lpString1 As String, lpString2 As Any) As Long Public Function cbFoo(Obj As Long, count As Long) As Long Dim sInBuffer As String sInBuffer = Space$(1024) Call lstrcpy(sInBuffer, Obj) Debug.Print sInBuffer End Function 'Form Option Explicit Private Sub Form_Load() Dim lpString As String, MyInt As Long, lRet As Long lpString = Space$(1024) lRet = SayHello(lpString, MyInt, AddressOf cbFoo) End Sub
VC++ Code
GregCode:'CPP File
#include <windows.h>
#include <stdio.h>
typedef void (__stdcall *fnCallBack)(LPTSTR lpszOutPut, long lpn);
fnCallBack ReturnCB;
__declspec( dllexport ) int WINAPI SayHello (LPSTR StringIn, long lpn, long f) {
ReturnCB = (fnCallBack)f;
strcpy(StringIn, "Why do you yahoooo!!");
(lpn) ++;
ReturnCB(StringIn, lpn);
return 1;
}
'DEF File
LIBRARY Test
DESCRIPTION 'Test.dll'
EXPORTS
; DLLXPORT_BEGIN:
SayHello
Thank you so much greg, that saved my day. I already tried this method and it did not work... I have searched and searched and no answer...
I wanted to stay as far away from ATL/COM/MFC but it seems that they are necesary in order for me to finish this on time. Please let me know if you find anything else. It will help alot.
-MoMad
Ha!!! I found the sollution!!
To ANYONE HAVING PROBLEMS WITH THIS SUBJECT:
HERE IS THE SOLLUTION!!
CLICK>>>>
http://www.codeproject.com/dll/superdll.asp
>>>CLICK
MoMad