Is it possible to add a button or a control to another program and respond to messages from that control? I have an idea for a newsreader that I use and it doesn't get updated anymore and would like to add a button to that program to implement a feature.
'adding' and new controll is possible when having the handel to parent window (hParent): here an snippet adding an Button to notepad:
mov esi,rv(FindWindowEx,rv(FindWindow,"Notepad",0),0,"Edit",0)
.if !esi
fn MessageBox,0,"cant find notepad","error",0
.else
fn CreateWindowEx,0,"button","xyz",WS_CHILD or WS_VISIBLE,0,0,100,100,esi,0,rv(GetModuleHandle,0),0
invoke GetWindowLong,esi,GWL_STYLE
or eax,WS_CLIPCHILDREN
invoke SetWindowLong,esi,GWL_STYLE,eax
.endif
The problem is receiving message from this control - a way is to set a message hook to its parent using SetWindowsHookEx().
Ah, thank you.
I just tried the code snippet and it hangs notepad lol, maybe just how I implemented it :lol should it be in a thread or something? Have implemented before just renewing the grey matter
The problem will be that techniques to access other running binaries are being closed off for security reasons and while many of these have worked in the past with earlier OS versions, thread isolation, seperate memory space and security issues make them unreliable in the longer term.
Quote from: oex on March 23, 2010, 11:23:29 PMI just tried the code snippet and it hangs notepad
for vista and xp it works ...
I tried with console app on XP, it's not really important for me, no need for fix for me but I dont know why it doesnt and thought there may be idiot reason :lol
EDIT: Realised idiot reason :lol.... multiple notepad windows open, it drew it on the last one :green