Click here to Skip to main content
15,886,578 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Disable Events of HTMLElement Pin
vikrant kpr3-Mar-09 10:53
vikrant kpr3-Mar-09 10:53 
GeneralRe: Disable Events of HTMLElement Pin
vikrant kpr3-Mar-09 11:07
vikrant kpr3-Mar-09 11:07 
GeneralRe: Disable Events of HTMLElement Pin
Perisic, Aleksandar3-Mar-09 11:11
Perisic, Aleksandar3-Mar-09 11:11 
QuestionDriving a 3rd-party app from my app. Pin
davidjaybrown3-Mar-09 5:46
davidjaybrown3-Mar-09 5:46 
AnswerRe: Driving a 3rd-party app from my app. Pin
Stuart Dootson3-Mar-09 6:19
professionalStuart Dootson3-Mar-09 6:19 
GeneralRe: Driving a 3rd-party app from my app. Pin
davidjaybrown3-Mar-09 7:45
davidjaybrown3-Mar-09 7:45 
GeneralRe: Driving a 3rd-party app from my app. Pin
Stuart Dootson3-Mar-09 8:05
professionalStuart Dootson3-Mar-09 8:05 
AnswerRe: Driving a 3rd-party app from my app. Pin
vikrant kpr3-Mar-09 6:30
vikrant kpr3-Mar-09 6:30 
Hey Buddy

Yes you are at correct place, but i may not be of much help.

SendInput is a risky thing as you have faced already

If you get HWND of the target window, then you can treat them with your own classes
Let's say you get an edit box

CEdit* vl_pEdit = (CEdit*)CWnd::FromHandle(targethWnd);
if(vl_pEdit && IsWindow(vl_pEdit->m_hWnd))
{
//you have got CEdit
//Call GetWindowText or SetWindow Text
}

Same would be applicable to CheckBoxes

Use CButton::GetCheck() for getting state

Also

to Click on a Dialog Box, given below is an encrypt from experts exchange which requires subsription and hence pasting below
http://www.experts-exchange.com/Programming/Languages/Q_20572990.html[^]
So you can do many things without SendInput & that too in a reliable way.

However it seems you have developed functionality using SendInput and hence this information may be of little use to you, still posting here, whatever i can.
-----------------------Starts-----------------

The proper WM_COMMAND for a button click is:

PostMessage(hWndParent, WM_COMMAND, MAKEWPARAM(nID, BN_CLICKED), hWndButton);

but the lazy version is:

PostMessage(hWndParent, WM_COMMAND, nID, 0);

... assuming the parent doesn't check hWndButton. gotenks got that one.

Assuming we're dealing with a dialog box using standard button IDs, you should use IDOK for nID. Other standard values for nID include IDCANCEL, IDABORT, IDIGNORE, IDYES, IDNO, IDCLOSE. Although, if the ID is custom, it could be any value.

> ::PostMessage(hWnd,WM_LBUTTONDOWN,WM_COMMAND,MAKELONG(x,y));
> //" ::PostMessage(hWnd,WM_LBUTTONDOWN,MK_LBUTTON,MAKELONG(x,y)); "
> also tried.
> ::PostMessage(hWnd,WM_LBUTTONUP,NULL,MAKELONG(x,y));
> ::PostMessage(hWndParent,WM_LBUTTONDOWN,WM_COMMAND,MAKELPARAM(x,y));
> ::PostMessage(hWndParent,WM_LBUTTONUP,WM_COMMAND,MAKELPARAM(x,y));

This'll simulate a button click:

SetForegroundWindow(hWndParent);
PostMessage(hWndButton, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(1,0));
PostMessage(hWndButton, WM_LBUTTONUP, 0, MAKELPARAM(1,0));

SetForegroundWindow() brings up and activates the window before it handles the mouse click.

Although, if that fails, the button might be off the screen. If that happens, you should call this beforehand:

SetWindowPos(hWndParent, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);

This'll move the window to the upper-left-hand corner of the screen.

If you're trying to close one certain dialog, then you should have no trouble doing so. But if you're trying to click any given button, chances are that you're gonna run into trouble sooner or later.

Until then, good luck!

Regards
-----------------------Ends-----------------
GeneralRe: Driving a 3rd-party app from my app. Pin
davidjaybrown3-Mar-09 8:10
davidjaybrown3-Mar-09 8:10 
GeneralRe: Driving a 3rd-party app from my app. Pin
vikrant kpr3-Mar-09 8:24
vikrant kpr3-Mar-09 8:24 
QuestionHow can I get the VISIBLE part of the client area in a window? Pin
Joseph Marzbani3-Mar-09 4:52
Joseph Marzbani3-Mar-09 4:52 
AnswerRe: How can I get the VISIBLE part of the client area in a window? Pin
Code-o-mat3-Mar-09 5:13
Code-o-mat3-Mar-09 5:13 
GeneralRe: How can I get the VISIBLE part of the client area in a window? Pin
Joseph Marzbani3-Mar-09 8:21
Joseph Marzbani3-Mar-09 8:21 
AnswerRe: How can I get the VISIBLE part of the client area in a window? Pin
Stuart Dootson3-Mar-09 6:14
professionalStuart Dootson3-Mar-09 6:14 
GeneralRe: How can I get the VISIBLE part of the client area in a window? Pin
Joseph Marzbani3-Mar-09 8:25
Joseph Marzbani3-Mar-09 8:25 
GeneralRe: How can I get the VISIBLE part of the client area in a window? Pin
Stuart Dootson3-Mar-09 8:39
professionalStuart Dootson3-Mar-09 8:39 
GeneralRe: How can I get the VISIBLE part of the client area in a window? Pin
Iain Clarke, Warrior Programmer3-Mar-09 22:43
Iain Clarke, Warrior Programmer3-Mar-09 22:43 
GeneralRe: How can I get the VISIBLE part of the client area in a window? Pin
Stuart Dootson3-Mar-09 22:48
professionalStuart Dootson3-Mar-09 22:48 
Questionproblems about Template using Pin
jeansea3-Mar-09 4:02
jeansea3-Mar-09 4:02 
AnswerRe: problems about Template using Pin
Cedric Moonen3-Mar-09 4:08
Cedric Moonen3-Mar-09 4:08 
GeneralRe: problems about Template using Pin
jeansea3-Mar-09 4:15
jeansea3-Mar-09 4:15 
GeneralRe: problems about Template using Pin
Cedric Moonen3-Mar-09 4:21
Cedric Moonen3-Mar-09 4:21 
GeneralRe: problems about Template using Pin
jeansea3-Mar-09 5:02
jeansea3-Mar-09 5:02 
GeneralRe: problems about Template using Pin
Stuart Dootson3-Mar-09 4:24
professionalStuart Dootson3-Mar-09 4:24 
GeneralRe: problems about Template using Pin
jeansea3-Mar-09 5:08
jeansea3-Mar-09 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.