Announcement

Collapse
No announcement yet.

How to detect flash drive

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to detect flash drive

    Hi,

    I want to detect a USB flash drive once the user connect it.
    It should look like this:
    code:
    ; Disable next button while USB flash drive not identified
    GetDlgItem $0 $HWNDPARENT 1 ; next=1, cancel=2, back=3
    EnableWindow $0 0
    loop:
    ${If}
    # usb is detected
    ${Else}
    Goto loop
    ${EndIf}
    ; Enable next button
    GetDlgItem $0 $HWNDPARENT 1
    EnableWindow $0 1

    I hope you have some ideas,
    Thanks!

  • #2
    See this recent thread: http://forums.winamp.com/showthread.php?t=341152

    Comment


    • #3
      Thanks! It works

      Comment


      • #4
        Now first of all my custom function search the flash drive and then I can see text/label/image and so on...
        But i want it the other way round...

        How can I do this?

        code:
        Function customFunction
        nsDialogs::Create 1018
        ; Text, label, image
        ...
        ; Disable next button while USB flash drive not identified
        GetDlgItem $0 $HWNDPARENT 1 ; next=1, cancel=2, back=3
        EnableWindow $0 0
        ; Search flash drive
        ...
        ; Enable next button
        GetDlgItem $0 $HWNDPARENT 1
        EnableWindow $0 1
        nsDialogs::Show
        ${NSD_FreeImage} $Image
        FunctionEnd

        Thanks

        Comment


        • #5
          Hmm, perhaps I should attach some images.

          While searching the flash drive I can't see the images/labels (see attachments).
          But I want that you can see the page with all components first, and after that the installer should search the flash drive.

          I hope you understand what I mean, please help
          Attached Files

          Comment


          • #6
            Once you do nsDialogs::Show, the installer will wait until the Next button is pressed (or any other button which has a callback function defined). The installer cannot wait for two things at the same time (Next button and flash drive). So you'll need to do the flashdrive search in the page's leave function. The page would then say "please insert the flash drive and click Next to continue". If in the leave function no drive is found, call abort and the installer will stay on the 'please insert' page.

            Comment


            • #7
              Thanks MSG! That's a good idea, but I've one problem:

              So you'll need to do the flashdrive search in the page's leave function
              I've a custom page, so I can't use "!define MUI_PAGE_CUSTOMFUNCTION_LEAVE"
              Can I copy the flashdrive search after
              nsDialogs::Show
              ${NSD_FreeImage} $Image
              and make so my own customFunction leave?

              code:
              Function customFunction
              nsDialogs::Create 1018
              ; Text, label, image
              ...
              nsDialogs::Show
              ${NSD_FreeImage} $Image

              ; search flash drive
              ...
              MessageBox MB_YESNO "Leave Function TEST! Go to next page?" IDYES +2
              Abort

              FunctionEnd

              I can see the MessageBox, but when I click on "No", I'm on the next page anyway...

              Comment


              • #8
                Page custom customFunction customLeaveFunction

                Comment


                • #9
                  Thanks again MSG!!!

                  My problem is solved

                  Comment

                  Working...
                  X
                  😀
                  🥰
                  🤢
                  😎
                  😡
                  👍
                  👎