This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Any idea?


Hi!

Could anyone gimme a short statement, how to code the DLL access under C++
(g++)?

I saw different suggestions but was not able to pick the correct one; here
some
examples besides my try of code:

        DWORD (APIENTRY *lpfnCapReg) (DWORD, DWORD, DWORD, DWORD, LPDWORD);

        typedef UINT (CALLBACK* LPFNCAPREG) (DWORD, DWORD, DWORD, DWORD,
LPDWORD);

Any concrete help is highly appreciated!

Thanx in advance,

Vince


PS: As you already may have guessed: I'm no C++ professional ... but at least
I'm no programming newbie ;-))

---------------------------------------------------

My source code looks - at the moment - like this ... problems start at the
second comment ...

// CAPI.CC

#include <iostream.h>
#include <string.h>
#include <windows.h>

using namespace std;

main()
{
  cout << "Program CAPI.CC\n"

  DWORD dwCapiRet, dwAppID;

// HINSTANCE?
  HMODULE hDll=LoadLibrary("capi2032.dll");
  if (hDll == 0)
        cout << "DLL not found!\n"
  else
        cout << "DLL found.\n"

  // Problems ahead!
  DWORD(*lpfnCapReg)(DWORD, DWORD, DWORD, DWORD, LPDWORD) = (DWORD, DWORD,
DWORD, DWORD, LPDWORD)(GetProcAddress(hDll,"CAPI_REGISTER");
  if (lpfnCapReg == NULL)
        cout << "Address not found.\n"

  dwCapiRet = lpfnCapReg(2048, 1, 2, 128, &dwAppID);
        cout << "Result is " << dwCapiRet;
  
  FreeLibrary(hDll);
}

>>> The answer is *definitely* 42 <<<
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]