Click to See Complete Forum and Search --> : how to send keyboard inputs...


rohini
October 5th, 1999, 05:41 AM
Hi,
when a propertysheet is active, I want to call another exe , by pressing function key F2. I called propertysheet using DoModal().
Advice please.
Rohini.

namit swaroop
October 5th, 1999, 02:26 PM
1. Try to map wm_char message
afx_msg void OnChar( UINT nChar, UINT nRepCnt, UINT nFlags )
2. During its handling check for F2 .

3. If it is F2 then use -
int _execl( const char *cmdname, const char *arg0, ... const char *argn, NULL );

method to execute other process .
4. But u have to close ur property sheet during execl because model dialog box are working with user thread and have to finish the call .. Else create ur property sheet modeless.

Anand S
October 6th, 1999, 01:51 AM
Hi,
You can also catch the key down message by overloading the virtual function

CWnd::PreTranslateMessage(MSG* pMsg);



in your class.

In that function , you can check for F2 key down
by using the following condition

if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F2)
{
// call your external application
}




Anand