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. Please help with creating a Hidden Window inside a Win32 DLL, thank you.

Please help with creating a Hidden Window inside a Win32 DLL, thank you.

Scheduled Pinned Locked Moved C / C++ / MFC
jsonhelptutorial
1 Posts 1 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.
  • J Offline
    J Offline
    JavaTony
    wrote on last edited by
    #1

    Hi there, Please help me, I have been so frustrated. I am working on a Win32 DLL. Inside the dll, I am trying to create a popup window which is hidden and covers the entire desktop so I can process mouse message across the screen and do rubber banding. I am doing this because of the restriction of SetCapture(HWND hwnd) API. What I can do now is that as soon as the client loads the DLL, a hidden window will be created and mouse messages will be processed in GrabProc Callback function. Instead of creating the hidden window when the dll is first loaded, I am hoping to create a hidden window when the mouse is down and destroy it when the mouse it up. I am a newbie on Windows Programming. Would someone please give me some pointers and show me how to accomplish what I need. Thank you very much for your help. BOOL APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { if (dwReason == DLL_PROCESS_ATTACH) { CreateHiddenWindow(); } } BOOL CreateHiddenWindow() { static TCHAR szAppName[] = TEXT ("Test") ; HWND hwnd ; MSG msg ; WNDCLASS wndclass ; wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = GrabProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = g_hInstance ; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW); wndclass.hbrBackground = NULL; wndclass.lpszMenuName = NULL; wndclass.lpszClassName = szAppName ; if (!RegisterClass (&wndclass)) { MessageBox (NULL, TEXT ("This program requires Windows NT!"), szAppName, MB_ICONERROR) ; return 0 ; } hwnd = CreateWindowEx(WS_EX_TRANSPARENT, szAppName, NULL, WS_POPUP, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), NULL, NULL, g_hInstance, NULL); ShowWindow(hwnd, SW_SHOW); UpdateWindow (hwnd) ; while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } return msg.wParam ; } LRESULT CALLBACK GrabProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { // Handle mouse down, move, up messages for entire screen // rubber banding sw

    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