Windows popup message boxes

J

jcavo

Hi,

I develop applications with .NET #C for our XPe devices. When I plug a USB
memory stick or printer into the USB connectors on a device, I will get a
popup message box on top of my application as it happens on the PCs. Is
there a way that I can capture the moment and have control over what to do
instead of the default popup message box?

Thanks a lot in advance.

Xiaozu
 
K

KM

Xiaozu,

What you are asking about is very hard to implement in general case. You basically want to reverse engineer some other app(s)
(system components) on fly to change the app logic. It may be much easier to work around particular popups.

I couldn't understand what popup you are referring to. Only popup that shows up when you plug in a USB mass storage device (memory
stick, e.g.) is AutoPlay window - feature of Explorer shell. Also, you may get a serious of notifications in system notification
area notifying you about the driver/application events that are going on in the system when you plugged in the device.
Probably the best way to handle such events is to have your own shell instead of Explorer shell. Otherwise you can specify a custom
Autoplay handler for USB devices or etc.

If you meant by popup a message box and you just want to suppress the popup, you can use the "Message Box Default Reply" component
of FP2007. Or, a little bit different, you can use this registry keys to get rid of the system popups:
http://msdn.microsoft.com/embedded/community/community/tips/xp/popups/default.aspx.


If the above doesn't asnwer your quesiton, could you post the info about what exactly popup you are seeing? A screenshot of the
window would probably help.
 
S

Sean Liming \(eMVP\)

Message Box Default Reply is the FP2007 component you want to use to
suppress teh system pop-ups.

For 3rd party applications messages, you could write a service that scans
the desktop looking for the title of the message box and just close it / log
it.

Regards,

Sean Liming
www.sjjmicro.com / www.seanliming.com
XP Embedded Book Author - XP Embedded Advanced, XP Embedded Supplemental
Toolkit
 
J

jcavo

Thank you for the reply and I'm looking into the areas you suggested.

To clearify myself, the popup I was referring to is something like the
AutoPlay window for a USB memory stick. We have several USB connectors on
the instruments that we're developing. In gerenal I'd would to to suppress
any popup whenever a user plug something into a USB connector, whether it's
supported or not by our instruments.

I was looking at a Win32 API called RegisterDeviceNotification(). From what
I read this function will direct the system attention to my handler when a
new device is plugged in. Does that mean my handler will take the place of
these window popups and prevent them from showing up? If this is the case,
I can have my handler future exame the new device and put out my own
appropriate messages.

Since we're on the topic, is there a way to prevent any popups for
UnhandledException from showing up? Will the MSDN article you referenced do
that by using the registry keys?

Thank you very much,

Xiaozu
 
K

KM

Xiaozu,

Here is some general and technical info on the Autoplay feature of XP:
http://msdn.microsoft.com/library/d...asics_extending/autoplay/autoplay2k_using.asp
http://msdn2.microsoft.com/en-us/library/aa969686.aspx

As I mentioned earlier, you can implement your own Autoplay handler. It is rather a COM object you have to register in the system.
Here is a sample project that can get you started: http://www.codeproject.com/cs/system/AutoplayDemo.asp
Or, better, here: http://msdn.microsoft.com/msdnmag/issues/01/11/autoplay/default.aspx

You can also remove other autoplay handlers for USB device and/or make your own as default with no system prompt appearing. Here is
documented all about AutoPlay registry entries:
http://msdn.microsoft.com/library/d...cs_extending/autoplay/autoplay2k_cookbook.asp
Thank you for the reply and I'm looking into the areas you suggested.

To clearify myself, the popup I was referring to is something like the AutoPlay window for a USB memory stick. We have several
USB connectors on the instruments that we're developing. In gerenal I'd would to to suppress any popup whenever a user plug
something into a USB connector, whether it's supported or not by our instruments.

I was looking at a Win32 API called RegisterDeviceNotification(). From what I read this function will direct the system attention
to my handler when a new device is plugged in. Does that mean my handler will take the place of these window popups and prevent
them from showing up? If this is the case, I can have my handler future exame the new device and put out my own appropriate
messages.

Since we're on the topic, is there a way to prevent any popups for UnhandledException from showing up? Will the MSDN article you
referenced do that by using the registry keys?

http://msdn.microsoft.com/embedded/community/community/tips/xp/popups/default.aspx
Hopefully you don't include Error Reporting or Dr.Watson component in to your config.
 

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