Handling Tab control with handle to Tab control

Handling Tab control with handle to Tab control

Post by YnVyaGF » Fri, 09 Apr 2004 19:56:03


Hi,

I am trying to access a desktop application from my WinForm application. I am accessing the UI controls of the desktop application from my application, for this, I am getting the instance of that application Process, through that, getting the main application handle. Using that application handle I can navigate to any of the controls in that application, since all other controls are child control, only thing that I need to know is the relative path from the main application (ie, its either
GW_CHILD or GW_HWNDNEXT, this we can get using the Spy++ tool of Visual Studio). Now the problem I got struck in
is that I would like to navigate within the Tab control.
I would like to select tab page from a tab (of SysTabControl32 type), get its form/window/dialog control
to focus, play around with its controls, select some other tab page, so the same

Now, when I SendMessageA( handleToTabControl,TCM_SETCURSEL, TAB_PAGE_INDEX, null), its just
setting/showing the corresponding tab (button at the top) as if selected (by bring to front, relative to other
pages) , but the tab/window controls corresponding to the selected tab page are not being shown.

Am I sending wrong message or not doing enough stuff.
Can any body please help me out and give some clue

Thanks in advance

Burhan
 
 
 

Handling Tab control with handle to Tab control

Post by Christian » Fri, 09 Apr 2004 20:07:54

burhan a crit:


You must also send WM_NOTIFY with TCN_SELCHANGE notification.

 
 
 

Handling Tab control with handle to Tab control

Post by YnVyaGF » Thu, 15 Apr 2004 19:11:02

can you give me some sample code for the same, ie., to send TCN_SELCHANGE with WM_NOTIFY message. I am using C# and to not have a clue to do it
thanks in advance
burhan



burhan a crit

> Now, when I SendMessageA( handleToTabControl,TCM_SETCURSEL, TAB_PAGE_INDEX, null), its just
> setting/showing the corresponding tab (button at the top) as if selected (by bring to front, relative to other
> pages) , but the tab/window controls corresponding to the selected tab page are not being shown.

You must also send WM_NOTIFY with TCN_SELCHANGE notification
 
 
 

Handling Tab control with handle to Tab control

Post by castori » Sat, 17 Apr 2004 02:20:19


In fact, I think the easiest way is with mouse_event() or SendInput()
(with TCN_SELCHANGE, you have to inject code in the other process address space...)
 
 
 

Handling Tab control with handle to Tab control

Post by YnVyaGF » Sat, 17 Apr 2004 17:51:04


> can you give me some sample code for the same, ie., to send TCN_SELCHANGE with WM_NOTIFY message. I am using C# and to not have a clue to do it
> thanks in advance

In fact, I think the easiest way is with mouse_event() or SendInput(
(with TCN_SELCHANGE, you have to inject code in the other process address space...

can you be more specific, since mouse event like WM_LBUTTONDOWN takes point as param,which we cannot know from a handle to window, and the tab control will raise approprieate events depending on the mouse position. And also SendInput, what do you mean by it.
burhan.
 
 
 

Handling Tab control with handle to Tab control

Post by Christian » Sun, 18 Apr 2004 02:09:35

burhan a crit:


For mouse_event() you need x & y and must force the window on foreground
(MOUSEEVENTF_MOVE then MOUSEEVENTF_LEFTDOWN then MOUSEEVENTF_LEFTUP)
But to get x & y (TabCtrl_GetItemRect() and so on) you also have to
inject code into the other process (VirtualAllocEx() or hook)
Then, not great either.
Maybe someone else has a better solution...