C# GetProcAddress WS2_32.dll connect

09/16/2011 20:49 vitalka#1
Hello Guys,
I have a problem, if i create my projekt with that:

uint WS2Connect = GetProcAddress(GetModuleHandle("WS2_32.dll"), "connect");

The address is 0x00000000, but if i start debugmodus in the C# Compiler im getting the right address.


With this:

uint GTC = GetProcAddress(GetModuleHandle("kernel32.dll"), "GetTickCount");

I get in both situations the right one.

Where is the problem?
09/17/2011 00:00 bootdisk#2
Could you give more details? if GetProcAddress fails (0/NULL) you can check the error detail with GetLastError.
Most likely ws2_32.dll is not loaded.
09/17/2011 10:11 vitalka#3
i already found a solution with the API command "LoadLibrary"
09/17/2011 10:13 Schickl#4
You need to load the Library before you use GetProcAddress. obviously (Just sayin')