Tech Support > Microsoft Windows > Development Resources > change wndproc at the runtime?
change wndproc at the runtime?
Posted by Jukka Kuosmanen on August 3rd, 2004


Hi, can I change the wndproc at the runtime? I tried to do that but I
only got an error 'Access is denied'.

I started a notepad with CreateProcess and I managed to find the hwnd.
Then I used SetWindowLong to change the wndproc, but it returned an
error.

After a little research I found this from Microsoft :
microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/windowclassreference/windowclassfunctions/setwindowlongptr.asp

GWL_WNDPROC
Sets a new address for the window procedure.

Windows NT/2000/XP: You cannot change this attribute if the window
does not belong to the same process as the calling thread.

Now I am a litte bit confused, I thought that it could be done. Is
there any way to do this?

Thanks in advance,

JK

Posted by Sten Westerback on August 4th, 2004



"Jukka Kuosmanen" <muovipolvi@hotmail.com> wrote in message
news:58fb381d.0408031526.639c050@posting.google.co m...
interface/windowing/windowclasses/windowclassreference/windowclassfunctions/
setwindowlongptr.asp
Only by putting your code in a global DLL you can affect classes in
all processes (that loads it).
What are you really trying to do? At least i see no point in modifying
a notepad process' window classes -- if you need that then make
your own window with an (Rich)EDIT control on it and continue from there...

- Sten




Similar Posts