Explicit Linking problem
-
Hi ppl well my problem is with explicit linking here.Actually there is this function called "SetLayeredWindowAttributes" that i want to link explicitly following is the code: typedef BOOL (CALLBACK*LPFNSETLAYEREDWINDOWATTRIBUTES)(COLORREF,BYTE,DWORD); ... BOOL CMainFrame ::TranparentWindow() { HINSTANCE hDLL; // Handle to DLL LPFNSETLAYEREDWINDOWATTRIBUTES lpfnSetLayeredWindowAttributes; // Function pointer COLORREF color = RGB(100,100,100); BYTE alpha; DWORD what; hDLL = LoadLibrary(_T("USER32.DLL")); if (hDLL != NULL) { lpfnSetLayeredWindowAttributes = (LPFNSETLAYEREDWINDOWATTRIBUTES)GetProcAddress(hDLL,"SetLayeredWindowAttributes"); if (!lpfnSetLayeredWindowAttributes) { // handle the error FreeLibrary(hDLL); return FALSE; } else { // call the function BOOL status; status = lpfnSetLayeredWindowAttributes(color,alpha,what); } } } I am calling this function on the OnCreate message handler there are no linker problems as well when the program is executed it gives me an error regarding ESP tellimg me something about conflicting calling conventions anyone having any idea wats the problem here please do tell me Thanks in advance Ahmed ajmal
-
Hi ppl well my problem is with explicit linking here.Actually there is this function called "SetLayeredWindowAttributes" that i want to link explicitly following is the code: typedef BOOL (CALLBACK*LPFNSETLAYEREDWINDOWATTRIBUTES)(COLORREF,BYTE,DWORD); ... BOOL CMainFrame ::TranparentWindow() { HINSTANCE hDLL; // Handle to DLL LPFNSETLAYEREDWINDOWATTRIBUTES lpfnSetLayeredWindowAttributes; // Function pointer COLORREF color = RGB(100,100,100); BYTE alpha; DWORD what; hDLL = LoadLibrary(_T("USER32.DLL")); if (hDLL != NULL) { lpfnSetLayeredWindowAttributes = (LPFNSETLAYEREDWINDOWATTRIBUTES)GetProcAddress(hDLL,"SetLayeredWindowAttributes"); if (!lpfnSetLayeredWindowAttributes) { // handle the error FreeLibrary(hDLL); return FALSE; } else { // call the function BOOL status; status = lpfnSetLayeredWindowAttributes(color,alpha,what); } } } I am calling this function on the OnCreate message handler there are no linker problems as well when the program is executed it gives me an error regarding ESP tellimg me something about conflicting calling conventions anyone having any idea wats the problem here please do tell me Thanks in advance Ahmed ajmal
You're missing an argument from the prototype for
SetLayeredWindowAttributes
:BOOL SetLayeredWindowAttributes(
HWND hwnd,
COLORREF crKey,
BYTE bAlpha,
DWORD dwFlags
);
Software Zen:
delete this;