Sign in to follow this  
Followers 0
solid2005

Combo Box

3 posts in this topic

Hi, I got problem about combobox.

1.How can i declared in combobox Removable drive that inserted?

e.g In my gui I check Adrian.txt and now the combox detect the removable that i insert when i click OK the file will transfer in rewmovable drive that available in combo box with progress.

may this problem is professional am i right?

Share this post


Link to post
Share on other sites



Hi, I got problem about combobox.

1.How can i declared in combobox Removable drive that inserted?

e.g In my gui I check Adrian.txt and now the combox detect the removable that i insert when i click OK the file will transfer in rewmovable drive that available in combo box with progress.

may this problem is professional am i right?

You need DriveGetDrive() and FileCopy().

When the words fail... music speaks

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

CODE

#NoTrayIcon

#include <GuiConstantsEx.au3>

#include <WindowsConstants.au3>

#include <Constants.au3>

#include <ButtonConstants.au3>

#include <StaticConstants.au3>

#include <GuiListView.au3>

#include <GuiComboBox.au3>

#include <GuiMenu.au3>

Global Const $WM_DEVICECHANGE = 0x0219

Global Const $DBT_DEVICEARRIVAL = 0x8000 ; Dystem detected a new device

Global Const $DBT_DEVICEREMOVECOMPLETE = 0x8004 ; Device is gone

Global Const $DBT_DEVTYP_VOLUME = 0x00000002 ; Logical volume

#Region GUI

$hGUI = GUICreate("USBMon", 340, 280)

GUICtrlSetColor(-1, 0x0046D5)

$DriveLabel = GUICtrlCreateLabel("", 15, 30, 310, 16, $SS_CENTER)

GUICtrlSetState(-1, $GUI_FOCUS)

$DriveCombo = GUICtrlCreateCombo("", 95, 50, 150, 20, BitOR($CBS_DROPDOWN, $CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_VSCROLL))

$Checkbox_P1 = GUICtrlCreateCheckbox("this box when i check i will choose in CreateCombo of my removable", 94, 88, 200, 17)

GUICtrlCreateButton("OK", 10, 247, 75, 23) ;<----if i press ok my check button will copy to i have been choose

$ExitButton = GUICtrlCreateButton("Exit", 255, 247, 75, 23)

Dim $aDrives = _DriveGet()

GUISetState()

#EndRegion GUI

;

While 1

$msg = GUIGetMsg()

Switch $msg

Case $GUI_EVENT_CLOSE, $ExitButton

Exit

Case $GUI_EVENT_MINIMIZE

WinSetState($hGUI, "", @SW_HIDE)

Case $DriveCombo

$DriveRead = GUICtrlRead($DriveCombo)

EndSwitch

WEnd

Func _DriveGet()

Local $aDrive = DriveGetDrive("REMOVABLE")

If @error Then Return False

Local $iCount = 0, $aRetDrive[1], $i

For $i = 1 To $aDrive[0]

If ($aDrive[$i] = "a:") Or (DriveStatus($aDrive[$i]) <> "READY") Then ContinueLoop

$aRetDrive[0] += 1

ReDim $aRetDrive[$aRetDrive[0] + 1]

$aRetDrive[$aRetDrive[0]] = StringUpper($aDrive[$i])

_GUICtrlComboBox_AddString($DriveCombo, StringUpper($aDrive[$i]))

$iCount += 1

Next

GUICtrlSetData($DriveLabel, $iCount & " removable device(s) found")

Return $aRetDrive

EndFunc ;==>_DriveGet

Func _DriveAdd($sDrive)

If DriveGetType($sDrive) <> "Removable" Then Return False

Local $iNumber, $iPrevData

$iNumber = StringRegExpReplace(GUICtrlRead($DriveLabel), "(\D)", "")

GUICtrlSetData($DriveLabel, $iNumber + 1 & " removable device(s) found")

_GUICtrlComboBox_AddString($DriveCombo, StringUpper($sDrive))

EndFunc ;==>_DriveAdd

Func _Exit()

Exit

EndFunc ;==>_Exit

Resources "http://www.autoitscript.com/forum/index.php?showtopic=79460&hl=USBmon"

I change my mind :) Some people are change

can some one give example?

Edited by solid2005

Share this post


Link to post
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
Sign in to follow this  
Followers 0