popup windows killer

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm working with twain and would like to work around a probem i have where
some twain drivers that pop up windows to display errors. this is somewhat
problematic as my twain app is running as a service without a user to click
OK.
I think what I'm looking for is a system wide hook to check for a known
window titles, then when a window is opening and then send a message to that
window. Seems like this will involve some heavy interop that that doesn't
bother me nearly as much as these pop up error messages. Anybody have an
idea of what messages I'm looking to process?

Or if you have a better/alternate solution I'd love to hear it.

thanks tons,
gabe
 
I'm working with twain and would like to work around a probem i have
where some twain drivers that pop up windows to display errors. this
is somewhat problematic as my twain app is running as a service
without a user to click OK.
I think what I'm looking for is a system wide hook to check for a
known window titles, then when a window is opening and then send a
message to that window. Seems like this will involve some heavy
interop that that doesn't bother me nearly as much as these pop up
error messages. Anybody have an idea of what messages I'm looking to
process?

Or if you have a better/alternate solution I'd love to hear it.

thanks tons,
gabe

I've done quite a bit of this type of development. You should use API
calls for this. Unless someone has a better solution, you would poll the
window list and see if your window is open, then enumerate the child
windows on the dialog and send a BM_CLICK message to it using the api
POSTMESSAGE or SENDMESSAGE. DO a search for GetWordWindow on Google for
an example of how to get a window handle from it's name or a substring.

There are a lot of ways to do this. I would be interested to know if
there is a sink or callback that can be used instead of polling the
window list... Any guru's out there?
 
gabe said:
I'm working with twain and would like to work around a probem i have where
some twain drivers that pop up windows to display errors. this is somewhat
problematic as my twain app is running as a service without a user to click
OK.
I think what I'm looking for is a system wide hook to check for a known
window titles, then when a window is opening and then send a message to that
window. Seems like this will involve some heavy interop that that doesn't
bother me nearly as much as these pop up error messages. Anybody have an
idea of what messages I'm looking to process?

Or if you have a better/alternate solution I'd love to hear it.

thanks tons,
gabe

Not used this via VB.NET as yet, but you could use a tool called BoxEater. Whilst the webpage and
doco talk about Gupta's SQLWindows, yes some of us poor buggers still use it from time to time, the
source is included in the zip and is straight C++.

We use this extensively and have found it to be one of those things we just couldn't live without.

Anyway, check it out. I think it might be exactly what your looking for.

http://cschubert.net/html/boxeater.html
 
Thanks for the reply, and yeah, that’s the conclusion I came to as well. I
finished it last night. There are 3 twain functions (win32 calls to
twain_32.dll) that *sometimes* produce a vendor specific dialog box - like if
the device isn't plugged in. (It’s sad that you can't reliably control twain
devices with _just_ the twain API but that’s another rant).
I'm using EnumWindows/EnumWindowsCallback with GetWindowText and
GetClassName to generate a snapshot before my twain call, then I poll until
the twain call completes (about a quarter of a sec). When/if I find a new
dialog I use FindWindow/SendMessage to close the dialog.
The downside is that is doesn't seem to be the case that all dialogs are
created equal. Some of the vendors (*cough*EPSON*cough*) have yes/no dialogs
that default to opening their diagnostic package while others just use an ok.
Meaning that BM_CLICK isn't going to work for everyone and I'm going to have
to check by window title what command to send... what a drag.
This seems to be working well, but I'll second that call for anyone who
knows of a sink or callback that can be used instead of polling.
While you're here, maybe you can save me another post. The lpWindowName
parameter in FindWindow gives me the ability to search for what would be the
Caption if these were .Net messageboxes. How would I get what would be the
Messagebox.Text? Is it possible if we assume that the lpClassName is #32770?
If anyone can think of a better way to kill the dialog than to use spy++
to document each and every dialog that I want to suppress I'd love to hear
it. WM_ClOSE doesn't close them all, and depending on the dialog BM_CLICK
does the opposite of what I want.

Thank you again,
gabe
 
box eater looks and sound like the trick... but the included source doesn't
seem to compile with either vs6 or vs2005 and to be honest my c++ kungfu is
weak. this may provide the solution, but it'll take some time.

thank-you
gabe
 
Back
Top