detecting other a window

S

shawrie

Hi

i am currently having problems automating our fax software. Basically
when faxing a html document the print dialog window comes up.
Microsoft has told me this cant be supressed as it is a secruity
function. Is there anyway from with in VB i can check what windows/
apps are running ( so i can detect the print dialog is open) and then
issue a message to the window to make it think the print button has
been clicked?

Thanks shawrie
 
R

rowe_newsgroups

Hi

i am currently having problems automating our fax software. Basically
when faxing a html document the print dialog window comes up.
Microsoft has told me this cant be supressed as it is a secruity
function. Is there anyway from with in VB i can check what windows/
apps are running ( so i can detect the print dialog is open) and then
issue a message to the window to make it think the print button has
been clicked?

Thanks shawrie

You'll need to use the Window's API to do this. Look up the FindWindow
and SendMessage API functions.

www.pinvoke.net is a great resource for getting the call structures.

Thanks,

Seth Rowe [MVP]
 
K

kimiraikkonen

You'll need to use the Window's API to do this. Look up the FindWindow
and SendMessage API functions.

www.pinvoke.netis a great resource for getting the call structures.

Thanks,

Seth Rowe [MVP]

Hi,
Meanwhile if i declare FindWindow API, first i got the error:
"DllImport" is not declared which can be corrected by
<Runtime.InteropServices.DllImport.

But this time i get CharSet is not declared. I pasted the declaration
from pinvoke.net:
http://www.pinvoke.net/default.aspx/user32/FindWindow.html

What's is the correct VB 2005 compatible declaration?

Thanks
 
R

rowe_newsgroups

Hi,
Meanwhile if i declare FindWindow API, first i got the error:
"DllImport" is not declared which can be corrected by
<Runtime.InteropServices.DllImport.

But this time i get CharSet is not declared. I pasted the declaration
from pinvoke.net:http://www.pinvoke.net/default.aspx/user32/FindWindow.html

What's is the correct VB 2005 compatible declaration?

Thanks

You should just be able to put:

/////////
Imports System.Runtime.Interop
/////////

at the top of the code file and have everything work.

Thanks,

Seth Rowe [MVP]
 
K

kimiraikkonen

err... I mean

/////////
Imports System.Runtime.InteropServices
/////////

Thanks,

Seth Rowe

Thanks, this must have been added to pinvoke.net article. And in this
article in "sample code" section's "else" block, it's contained that
"FindWindowEx" whic results as "not declared" due to relevance of
this article only with FindWindow. Author should correct this.

Another point that people may get help in this sample:
App's title caption is defined as:
Dim lpszParentWindow As String = "Untitled - Notepad" which won't work
in non-English operating systems. After assigning native OS language
string for Notepad it works as well.

Regards
 
R

rowe_newsgroups

Thanks, this must have been added to pinvoke.net article. And in this
article in "sample code" section's "else" block, it's contained that
"FindWindowEx" whic results as "not declared" due to relevance of
this article only with FindWindow. Author should correct this.

Actually, I believe the site is a Wiki so you could go in and correct
it if you want.
Another point that people may get help in this sample:
App's title caption is defined as:
Dim lpszParentWindow As String = "Untitled - Notepad" which won't work
in non-English operating systems. After assigning native OS language
string for Notepad it works as well.

That's one of the downfall's of FindWindow and FindWindowEx. You must
enter in the search string which will obviously vary based on language
settings.

Thanks,

Seth Rowe [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top