Jump to content

gui button problem


Recommended Posts

Alright, Im working on a new program that will have many functions, one of them being displaying the serial, of a drive that you choose, by inputting the drive name, ex a:\, or C:\. The problem I am having is, you can enter the name of the drive, but when u hit the Get Serial button, nothing happends. Heres my code:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

$mainwindow = GUICreate("PC Tools v1", 300, 500)
$driveserialinput = GUICtrlCreateInput("C:\", 15, 25, 25, 20) 
$serialnumber = GUICtrlCreateButton("Get Drive Serial", 45, 22, 90)
GUISetState(@SW_SHOW)

GUISetState()

While 1
$msg = GUIGetMsg()
    If $msg = $serialnumber Then
        $driverserialinput = String(GUICtrlRead($driveserialinput))
          $var = DriveGetSerial("$driveserialinput")
            MsgBox(4096, "Serial Number: ", $var)
      EndIf
WEnd

Thanks,

Lakai

Link to comment
Share on other sites

You're using GUIOnEventMode but you didn't set up the events, so your message loop doesn't do anything. Either set up the callback events with GUISetOnEvent/GUICtrlSetOnEvent or don't use event mode.

Link to comment
Share on other sites

ALright thanks, that is what the problem was, I accidently used part of another script for this one, now the problem is, when i push the button in, it returns the number 1 instead of the serial number, that is the result of all the drives, the number 1 instead of the serial

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...