The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on December 03, 2006, 03:58:31 PM

Title: can your help me
Post by: ragdog on December 03, 2006, 03:58:31 PM
hello peoples :bg

can your help me ?

I would like clicking a tab fom my program to a another program

    invoke FindWindowEx,ebx,NULL,CTEXT ("SysTabControl32"),0
    mov hSysTabControl32,eax
    invoke SendMessage,hSysTabControl32,TCM_SETCURSEL,1,TRUE

greets ragdog
Title: Re: can your help me
Post by: sluggy on December 04, 2006, 08:07:41 AM
What are you trying to do? Which program are you trying to control?
Title: Re: can your help me
Post by: ragdog on December 04, 2006, 05:39:54 PM
hi

as example this prog!


ragdog

[attachment deleted by admin]
Title: Re: can your help me
Post by: PBrennick on December 04, 2006, 06:04:36 PM
ragdog,
It is hard to know what you are trying to do. Do you want to be able to run a program by clicking a button or something similar.

Paul
Title: Re: can your help me
Post by: ragdog on December 04, 2006, 07:55:59 PM
i want click a tap button from my prog to a another prog
Title: Re: can your help me
Post by: evlncrn8 on December 04, 2006, 09:38:10 PM
think you're missing an all important SetFocus call :)
Title: Re: can your help me
Post by: sluggy on December 04, 2006, 09:49:44 PM
Quote from: ragdog on December 04, 2006, 07:55:59 PM
i want click a tap button from my prog to a another prog
But you are not telling us what the problem is, all you have done is paste three lines of code in your first post. Try posting more code.
Title: Re: can your help me
Post by: ragdog on December 04, 2006, 09:56:07 PM
.data
szwindow           db 'TabControl',0
szSysTabControl32  db 'SysTabControl32',0

.data?
hSysTabControl32   dd ?

.code
start:
invoke FindWindow,0,offset szwindow
invoke FindWindowEx,eax,0,offset szSysTabControl32,0
mov hSysTabControl32,eax
invoke SendMessage,hSysTabControl32,TCM_SETCURSEL,1,TRUE
invoke ExitProcess,0

end start
Title: Re: can your help me
Post by: evlncrn8 on December 05, 2006, 08:40:15 AM
Quote from: ragdog on December 04, 2006, 09:56:07 PM
.data
szwindow           db 'TabControl',0
szSysTabControl32  db 'SysTabControl32',0

.data?
hSysTabControl32   dd ?

.code
start:
invoke FindWindow,0,offset szwindow
invoke FindWindowEx,eax,0,offset szSysTabControl32,0
mov hSysTabControl32,eax
iinvoke SetFocus, eax
push eax
iinvoke SendMessage,hSysTabControl32,TCM_SETCURSEL,1,TRUE
pop eax
invoke SetFocus,eax
invoke ExitProcess,0

end start

also are you checking your code is actually finding the right window?
Title: Re: can your help me
Post by: PBrennick on December 05, 2006, 10:49:50 AM
ragdog,

As evlncrn8 says, you need to process the result of the search. After you call FindWindow add...

    cmp  eax, 0
    je   failed

and write an error handler (messagebox, etc.). Also, you are searching by title only. Since many applications will vary what is displayed there, it is problematic. How about ...

    invoke FindWindow, offset szSysTabControl32, offset szwindow


or


    invoke FindWindow, offset szSysTabControl32, 0


Paul
Title: Re: can your help me
Post by: Tedd on December 05, 2006, 12:38:04 PM
invoke mouse_event, ......
:toothy