Solved

How to action "keybd_event in ExecWB"

Posted on 2000-04-04
6
298 Views
Last Modified: 2013-11-20
I want to know the Reason
that keybd_event("Tab") doesn't
working in ExecWB.

Where is this code Wrong?

 void CMyHtmlView::OnNavigateComplete2(LPCTSTR strURL)
{
// TODO: Add your specialized code here and/or call the base class

ExecWB(OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER, NULL, NULL);

HWND aWnd = (HWND)GetActiveWindow();

::SetActiveWindow(aWnd);

::keybd_event(VK_TAB,MapVirtualKey(VK_TAB,0),0,0);

::keybd_event(VK_TAB,MapVirtualKey(VK_TAB,0),KEYEVENTF_KEYUP,0);
      
CHtmlView::OnNavigateComplete2(strURL);
}
0
Comment
Question by:bluewin
  • 3
  • 3
6 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 40 total points
ID: 2685245
The ExecWB does not return until it is done. That means the dialog box is no longer there when keybd_event is executed. There seems no way to achieve what you want.
0
 

Author Comment

by:bluewin
ID: 2685471
Then can I access and handle
the dialog box
that ExecWB created.

Isn't there any solution?

0
 
LVL 23

Expert Comment

by:chensu
ID: 2685487
You may create another thread right befoer ExecWB. In that thread, try to use FindWindow to locate the dialog box. But this method is not stable and very ugly.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:bluewin
ID: 2685534
Could you donate me
the outline or skeleton of

Creating Thread,
Finding the window of CFileDialog...

Thank you very much.

0
 
LVL 23

Expert Comment

by:chensu
ID: 2685630
Use AfxBeginThread to create a worker thread. See the documentation on AfxBeginThread and the article Multithreading: Creating Worker Threads in Visual C++ Programmer’s Guide.
0
 

Author Comment

by:bluewin
ID: 2685643
Thank you from the bottom of my heart for your kindness.
Good Luck!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 171
method notes when mouse over in eclipse 5 83
Problem to event 3 79
Excel file not created as expected 7 51
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now