mfc >> Problem "GetProcAddress" in Win98.

by sungijn » Wed, 26 Nov 2003 09:25:58 GMT

i tested each os that below code in Win98,Win2000.
but different value this variable "procFunc".
i guess wrong value in Win98.
what is wrong? i just get address BitBlt in gdi32.dll.
how can i get right value. gave me your advise.

///////////////////////////////////////
// code start
HMODULE hMod;
FARPROC procFunc;

// Right get value.
hMod=GetModuleHandle("GDI32.DLL");
// wrong get value.
procFunc = GetProcAddress(hMod,"BitBlt");

////////////////////////////////////////




mfc >> Problem "GetProcAddress" in Win98.

by CheckAbdoul » Wed, 26 Nov 2003 22:24:02 GMT


BitBlt() is available in all of the windows OS's. ( like Win95, NT4.0,
W2K , XP etc ). Why do you even want to call it using GetProcAddress() ? You
should be able to call it directly.

--
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------








Similar Threads

1. Program won't run on win98 after successfully compiling on win98 machine

2. Program still won't run on win98 after successfully compiling on win98 machine

3. GetProcaddress returns null but GetLastError indicate no problem

4. yet another GetProcAddress() problem

Trying to get the address of a test method and I'm getting NULL.  I have
created a map file and everything looks correct:
<snip>
Exports
  ordinal    name
        1    ?GetNumber@@YAHXZ (int __cdecl GetNumber(void))
</snip>

In the host DLL, I'm importing with this code:
<snip>
typedef int (CALLBACK* LPFNDLLFUNC1)(void);
 HINSTANCE  hDLL;           // Handle to DLL
 LPFNDLLFUNC1 lpfnDllFunc1; // Function pointer

 hDLL =
LoadLibrary("Z:\\M3\\Code\\MAX_Plugins\\InFluFluIO\\Debug\\InFluFluIO.dll");
 if (hDLL != NULL){
  lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,
   "GetNumber");
  if (!lpfnDllFunc1){
   // handle the error
   ::MessageBox(0, "Failed loading InFluFluIO dll", "some tools may not work
correctly", MB_OK|MB_ICONWARNING);

   FreeLibrary(hDLL);
   return -1;
  }
  else{
   // call the function
   result = lpfnDllFunc1();
   FreeLibrary(hDLL);
  }
 }
</snip>

Even though the map file shows me the name, I have tried adding the "_"
before the name.  I get NULL everytime.  Anyone have any ideas?

Any help appreciated,
Steve Klett


5. GetProcAddress giving problems in Explicit linking

6. Problem with C# program on Win98

7. Problems with Crystal Reports in Win98 - CSharp/C#

8. Visual Studio 2005 Distribute Dll Problems LoadLibrary Error Win98

I have created a BHO in Visual Studio 2005. It works great on my dev machine, 
but when trying to test on clean images of the OS's, I am running into 
issues. I dont want to have to distribute the redist.exe with my dll. I have 
managed to get it to register successfully on XP by copying 
Microsoft.VC80.ATL and Microsoft.VC80.CRT folders with my dll. On 98 and 
2000, I cannot seem to get my DLL to register using regsvr32. I have tried 
copying the folders mentioned above, as well as even installed the vc++ 2005 
redist - still doesnt work! Any advice on why or how I can get this to work. 
Thank you!