News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

adding a control to another program

Started by Gunner, March 23, 2010, 09:19:05 PM

Previous topic - Next topic

Gunner

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.
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

qWord

'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().
FPU in a trice: SmplMath
It's that simple!

Gunner

~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

oex

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
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

qWord

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 ...
FPU in a trice: SmplMath
It's that simple!

oex

#6
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
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv