Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Explicit Linking problem

Explicit Linking problem

Scheduled Pinned Locked Moved C / C++ / MFC
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cyberizen
    wrote on last edited by
    #1

    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

    G 1 Reply Last reply
    0
    • C Cyberizen

      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

      G Offline
      G Offline
      Gary R Wheeler
      wrote on last edited by
      #2

      You're missing an argument from the prototype for SetLayeredWindowAttributes:

      BOOL SetLayeredWindowAttributes(
      HWND hwnd,
      COLORREF crKey,
      BYTE bAlpha,
      DWORD dwFlags
      );


      Software Zen: delete this;

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups