Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending messages to a specific window

Status
Not open for further replies.

PhilipVDP

Programmer
Feb 28, 2000
2
BE
Here is a problem I have been struggling with.<br>
<br>
Following 2 programs run simultaneously on a system.<br>
<br>
VB program 1 opens the Commondialog.showprinter window (and awaits user input).<br>
<br>
VB program 2 constantly searches to see if it finds the Commondialog.showprinter window open on the system by using the EnumWindows API call (this already works fine and I can find the windowhandle of the Commondialog.showprinter window).<br>
<br>
I would like program 2 to automatically send a message to the Commondialog.showprinter window from program 1, to select a specific printer driver (from the printer drivers listbox) and then send another message to click the ‘Ok’ button (in order to close the Commondialog window and print something).<br>
So in short I want to replace the user input to the Commondialog.showprinter window by automatically sending messages from program 2.<br>
<br>
Can this be done? Can anybody please give me some help on this….<br>
<p>Philip Van de Poel<br><a href=mailto:pvdp@village.uunet.be>pvdp@village.uunet.be</a><br><a href= > </a><br>
 
Did you try the &quot;Send Keys&quot; command? <p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
You may also want to try the FindWindow command. I use this to het the handle of an open modelling application. The problem is that it requires the name in the application title bar. You may also want to get the process ID from program one when the window is opened and pass it to program 2.<br>
<br>
hWnd = FindWindow (vbNullString,&quot;SolidWorks 99&quot;) <br>
If hWnd &lt;&gt; 0 (then you got it!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top