delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/06/02/02:13:46

From: gnu-win32 AT eec DOT de (Vincent - Dirk Ertner)
Subject: Any idea?
2 Jun 1998 02:13:46 -0700 :
Message-ID: <00014319021586.cygnus.gnu-win32@artnetonline.com>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019