The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: hfheatherfox07 on July 24, 2011, 02:19:28 AM

Title: Find your own edit box handle?
Post by: hfheatherfox07 on July 24, 2011, 02:19:28 AM
Hi Is there a way to get your own edit box handle?
what I am trying to do is use vortex's Autotyper example to make an example were I auto type in my own edit box , not note pad's

So how do I get my own windows edit box handle?
Title: Re: Find your own edit box handle?
Post by: Gunner on July 24, 2011, 02:41:54 AM
Whaddya mean?  When CreateWindow/Ex returns, it returns the edit controls handle you just created... save that.  Or if you are using dialogs, then in your WM_INITDIALOG  invoke GetDlgItem, YOURDLGHANDLE, CONTROLID# and that will return the handle in eax, save it
Title: Re: Find your own edit box handle?
Post by: hfheatherfox07 on July 24, 2011, 02:46:26 AM
I am trying to make an auto typing example in my own exe how do I get my own edit box handle for that .... Here is an example were I took vortex's original autotyper for note pad and made it work with any window
I want to autotype in my owns app edit box were I use dialogs
Title: Re: Find your own edit box handle?
Post by: hfheatherfox07 on July 24, 2011, 02:49:02 AM
Quote from: Gunner on July 24, 2011, 02:41:54 AM
Whaddya mean?  When CreateWindow/Ex returns, it returns the edit controls handle you just created... save that.  Or if you are using dialogs, then in your WM_INITDIALOG  invoke GetDlgItem, YOURDLGHANDLE, CONTROLID# and that will return the handle in eax, save it

I get "CONTROLID#" I don't get " YOURDLGHANDLE"

suppose I got

.cost
EDIT1     equ 222

would this be :

invoke GetDlgItem,EDIT1 ,222  ?
Title: Re: Find your own edit box handle?
Post by: Gunner on July 24, 2011, 02:55:47 AM
YOURDLGHANDLE is the handle from your window proc... whatever you have it called:
DialogProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM

so it would be invoke GetDlgItem, hWnd, EDIT1

It is the handle of the dlg that your control is on
Title: Re: Find your own edit box handle?
Post by: hfheatherfox07 on July 24, 2011, 08:17:20 PM
NOP.... For some reason this method does not work well for me ...

As I mentioned before I took Vortex's Autotyping example and I am trying to make a self typing window, the only way that I was able to get some results was to put it in a proc.

I tried two versions :
1. with a button to invoke the proc ( which works better)
2. a version were the proc gets invoked at WM_INITDIALOG

Version 2 which I want to work , doesn't....  the GUI starts , it types... than it shows on the screen ???

Is there away to capture the edit handle then release it when done , like invalidate handle
Title: Re: Find your own edit box handle?
Post by: Gunner on July 24, 2011, 08:26:04 PM
INVOKE GetDlgItem,hWnd,102
mov   hEdit,eax
INVOKE Autotyperproc,eax
Title: Re: Find your own edit box handle?
Post by: Gunner on July 24, 2011, 08:32:06 PM
missed something
invoke ShowWindow, hWnd, SW_SHOW
invoke UpdateWindow, hWnd
  INVOKE SetWindowText, hWnd, addr szTitle
  INVOKE SendMessage, hWnd, WM_SETICON,ICON_SMALL, hIcon
  INVOKE GetDlgItem,hWnd,102
   mov   hEdit,eax
  INVOKE Autotyperproc,eax

adding showwindow and updatewindow could be done better by creating a seperate thread for AutoTypeProc