I've developed several programs for the Pocket PC in eMbedded Visual C
(API calls only, no MFC). All of these programs made use of a
third-party DLL called SecureTrial (www.zedev.com) to create 30-day
trial versions of the programs. The DLL was loaded dynamically at
run-time using LoadLibrary and GetProcAddress, as shown in the code
below. For the SecureTrial library, all I have are .DLL files
compiled for the MIPS, ARM, and SH3 processors (no source or
anything).
typedef DWORD (CALLBACK *ULPRET)(TRIALINFO);
DWORD stCheckTrial(TRIALINFO ti) {
HINSTANCE hinstLib;
ULPRET lpfnDLLProc;
// get pointer to function stCheckTrial in strial.dll
// then call the function and return its return value
// ti is a struct containing integer and UNICODE string data
// I removed the error checking code (verifying that hinstLib and
// lpfnDLLProc aren't NULL)
// just to simplify things for this example
hinstLib = LoadLibrary(TEXT("strial.dll"));
lpfnDLLProc = (ULPRET)GetProcAddress(hinstLib,
TEXT("stCheckTrial"));
retval = (*lpfnDLLProc)(ti);
FreeLibrary(hinstLib);
return retval;
}
I'm now considering switching over to Visual C++ .NET or Visual Basic
..NET, and I'm trying to gauge how difficult it will be to make this
new code call the old DLLs. I don't have any familiarity with those
environments, so I'm hoping someone can provide some insight. If it
can be done, what I'd really love to see are code snippets like the
one above but written in VC++.NET or VB.NET that will call the same
DLL. I'm just concerned about sinking a lot of time into learning one
or both of these environments, only to find that I won't be able to
use this existing library.
Will the fact that the DLLs were already compiled for specific
processors using eVC be a problem? What about building up the
TRIALINFO structure ti in Visual Basic .NET? I know this would be a
problem in eMbedded Visual Basic 3.0, since it's not possible to build
the struct in that language. I believe that there is an alternate
version of the function stCheckTrial that takes in multiple
parameters, instead of a single struct containing all of those
parameters, which would prevent the need to build the struct.
Thank you very much in advance!
By the way, I also posted this question on Expert Exchange. Feel free
to snag some points there:
http://www.experts-exchange.com/Prog..._20693106.html