Is it possible for me to use the k8062.dll for borland c++ builder, that came with the SDK, to use with Microsoft Visual C++ Express .net? If so, can someone please show me a sample program code? Thanks in advance.
I think you have to use Dynamic DLL Loading.
See: codeproject.com/dll/dynamicdllloading.asp
and
codeproject.com/managedcpp/mcppdynamdll.asp
I haven’t tested this yet but here it goes, off the top of my head:
#include <windows.h>
#include <tchar.h>
class K8062
{
typedef void (__stdcall *PFNSTARTDEVICE)();
typedef void (__stdcall *PFNSETDATA)(DWORD dwChannel, DWORD dwData);
typedef void (__stdcall *PFNSETCHANNEL)(DWORD dwCount);
typedef void (__stdcall *PFNSTOPDEVICE)();
public:
K8062();
~K8062();
PFNSTARTDEVICE StartDevice;
PFNSETDATA SetData;
PFNSETCHANNEL SetChannelCount;
PFNSTOPDEVICE StopDevice;
private:
HMODULE hLib;
};
K8062::K8062() {
hLib = LoadLibrary(_T("K8062d.dll"));
StartDevice = (PFNSTARTDEVICE)GetProcAddress(hLib, "StartDevice");
SetData = (PFNSETDATA)GetProcAddress(hLib, "SetData");
SetChannelCount = (PFNSETCHANNEL)GetProcAddress(hLib, "SetChannelCount");
StopDevice = (PFNSTOPDEVICE)GetProcAddress(hLib, "StopDevice");
}
K8062::~K8062() {
FreeLibrary(hLib);
}
int main() {
K8062 myDevice;
myDevice.StartDevice();
return 0;
}
Vel,
Thank you, I will try this later tonite. Again, thank you for the quick respose. You guys rocks!!!!
-rahwho