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. Subclassing (using MFC) a wndow under explorer process

Subclassing (using MFC) a wndow under explorer process

Scheduled Pinned Locked Moved C / C++ / MFC
c++comdata-structuresdebugginghelp
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.
  • N Offline
    N Offline
    Nishad S
    wrote on last edited by
    #1

    Hi, Isn't it possible to subclass a window in the explorer process, using CWnd::SubclassWindow() ? My intention is to skin the systray clock. What I did: 1. Created a MFC dll. 2. Injected it to the explorer process using "CreateRemoteThread - LoadLibrary" technique. 3. Took the window handle of systray clock in the dll's InitInstance. 4. Replaced the window proc using SetWindowLong. These were successful, and in the replaced proc, I could do the custom draw by processing WM_PAINT. The problem: I derived a class from CWnd, say CMyClock. And subclassed the systray clock window with CMyClock object (member) instead of proc replacement. Now the explorer crashes. I tried to debug the explorer process. I found that subclassing is fine, and InitInstance completed successfully. After a very little time it crashed and the call stack was as follows...

    	ntdll.dll!7c901230() 	
    >	msvcr71d.dll!_CrtDbgBreak()  Line 93	C
     	msvcr71d.dll!_CrtDbgReport(int nRptType=2, const char * szFile=0x01b44c68, int nLine=384, const char * szModule=0x00000000, const char * szFormat=0x00000000, ...)  Line 427	C
     	mfc71d.dll!AfxAssertFailedLine(const char * lpszFileName=0x01b44c68, int nLine=384)  Line 28 + 0x14	C++
     	mfc71d.dll!AfxWndProc(HWND__ * hWnd=0x000f01c8, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0)  Line 384 + 0x15	C++
     	MyClockDll.dll!AfxWndProcDllStatic(HWND__ * hWnd=0x000f01c8, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0)  Line 53 + 0x15	C++
     	user32.dll!7e418734() 	
     	user32.dll!7e418816() 	
     	user32.dll!7e41b4c0() 	
     	user32.dll!7e41b50c() 	
     	ntdll.dll!7c90eae3() 	
     	user32.dll!7e4194d2() 	
     	user32.dll!7e41b530() 	
     	user32.dll!7e42d950() 	
     	user32.dll!7e418a10() 	
     	user32.dll!7e42dbbf() 	
     	user32.dll!7e42593f() 	
     	user32.dll!7e43a91e() 	
    

    What could be wrong? Any suggestions or ideas? Thanks in advance.

    - NS - [ODBaseBtn]

    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