MessageBox and the Foreground Window?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Carl Fenley

    #1

    MessageBox and the Foreground Window?

    I am trying to capture the Windows QueryCancelAuto Play 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


  • Carl Fenley

    #2
    Re: MessageBox and the Foreground Window?

    "Carl Fenley" <clfenley-X-@-X-wcpci.com> wrote in message
    news:%23GCMzBIm FHA.1372@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    >I am trying to capture the Windows QueryCancelAuto Play 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[/color]

    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


    Comment

    • Dennis

      #3
      Re: MessageBox and the Foreground Window?

      Do you have a code fragment that you could share that shows how to disable
      AutoRun?
      --
      Dennis in Houston


      "Carl Fenley" wrote:
      [color=blue]
      > "Carl Fenley" <clfenley-X-@-X-wcpci.com> wrote in message
      > news:%23GCMzBIm FHA.1372@TK2MSF TNGP10.phx.gbl. ..[color=green]
      > >I am trying to capture the Windows QueryCancelAuto Play 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[/color]
      >
      > 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
      >
      >
      >[/color]

      Comment

      • Carl Fenley

        #4
        Re: MessageBox and the Foreground Window?

        "Dennis" <Dennis@discuss ions.microsoft. com> wrote in message
        news:C87646DB-6936-4D1F-9011-7DBC306DF89E@mi crosoft.com...[color=blue]
        > Do you have a code fragment that you could share that shows how to disable
        > AutoRun?
        > --[/color]

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

        Articles about web development, engineering leadership, and some random personal ramblings


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

        Regards,

        Carl


        Comment

        Working...