469,625 Members | 1,741 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

MessageBox and the Foreground Window?

I am trying to capture the Windows QueryCancelAutoPlay message that is sent
to the "foreground window" when an AutoRun enabled CD is inserted into a
drive.

Enabling and Disabling AutoRun
http://tinyurl.com/2m26

If my MainForm uses MessageBox.Show to prompt the end-user to insert a CD,
I'd like to know whether MainForm or my MessageBox is the "foreground
window". Any ideas?

Regards,

Carl
Nov 21 '05 #1
3 3279
"Carl Fenley" <clfenley-X-@-X-wcpci.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am trying to capture the Windows QueryCancelAutoPlay message that is sent
to the "foreground window" when an AutoRun enabled CD is inserted into a
drive.

Enabling and Disabling AutoRun
http://tinyurl.com/2m26

If my MainForm uses MessageBox.Show to prompt the end-user to insert a CD,
I'd like to know whether MainForm or my MessageBox is the "foreground
window". Any ideas?

Regards,

Carl


I think I just found out the answer is that the MessageBox is the
"foreground window" rather than the Form that instantiated it. If anyone
disagrees with that, please respond in this thread.

Regards,

Carl
Nov 21 '05 #2
Do you have a code fragment that you could share that shows how to disable
AutoRun?
--
Dennis in Houston
"Carl Fenley" wrote:
"Carl Fenley" <clfenley-X-@-X-wcpci.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am trying to capture the Windows QueryCancelAutoPlay message that is sent
to the "foreground window" when an AutoRun enabled CD is inserted into a
drive.

Enabling and Disabling AutoRun
http://tinyurl.com/2m26

If my MainForm uses MessageBox.Show to prompt the end-user to insert a CD,
I'd like to know whether MainForm or my MessageBox is the "foreground
window". Any ideas?

Regards,

Carl


I think I just found out the answer is that the MessageBox is the
"foreground window" rather than the Form that instantiated it. If anyone
disagrees with that, please respond in this thread.

Regards,

Carl

Nov 21 '05 #3
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:C8**********************************@microsof t.com...
Do you have a code fragment that you could share that shows how to disable
AutoRun?
--


I derived my solution from Duncan Mackenzie's sample, which can be found
about half way down the following page:

http://www.duncanmackenzie.net/Samples/default.aspx

Download the ZIP file and run it. Instead of disabling Autorun, you will
see that it "intercepts" the QueryCancelAutoPlay message and handles it. Be
aware that Duncan has added some necessary code to the "Windows Form
Designer generated code" region.

Regards,

Carl
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by one2001boy | last post: by
4 posts views Thread by fdmaxey | last post: by
10 posts views Thread by Ed Bitzer | last post: by
1 post views Thread by Terry Olsen | last post: by
4 posts views Thread by Carsten Schmitt | last post: by
17 posts views Thread by M O J O | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.