English
Forum

USB detection automatically

 

Gabor
Krizsma
Hi,

I have the following trouble:
I need a function, what automatically recognize, if I one USB Stick reinstecke, and as returnparameter gives me The drive (h:, or F: etc) the USB back.
Erstes part have I already, now Please I but Help... How can I The drive Info rausziehen?

Hilfeseiten for trouble (hopefully)
[...] 
so far i see, The & UlParam should include my info, but the can I not treat

my kurzprogramm (XProfan 11 fullversion)
CompileMarkSeparation
means question: What drive letter has the plugged USB?

I hope that here is the right Forum.... oh, and German is not my native tongue, so I Please circa understanding...
 
Ein Ausländer, der mit Xprofan programmiert !
Entschuldigung für meine Fehlern...
05/21/10  
 



Hey Gabor, Welcome!

Perhaps helps you: [...]  - look time drüber.
 
05/21/10  
 




Gabor
Krizsma
Hey, thanks for response !
unfortunately The GetLogicalDrives and GetDriveType functions help I do not

trouble is, if I z.B. already The dritte USB Stick reinstecke, where should the program know,
which was latest?

therefore have I attempts, these Broadcast of windows To reading, but I have so weinge Experience with XProfan (3 Monaten so far.), and can I The Systemvariable &UlParam not read.

but from this modifiziertes Program sees man, the not Empty is !
CompileMarkSeparation
i'm already utterly wonder, what kind of Info enthaltet these Variable
my supposition of msdn.com:


The system broadcasts the DBT_DEVICEARRIVAL device event when a device or piece of media has been inserted and becomes available.

To broadcast this device event, the system uses the WM_DEVICECHANGE message with wParam set to DBT_DEVICEARRIVAL (this is $8000 into View source) and lParam set as described following:
A pointer to a structure identifying the device inserted. The structure consists of an event-independent header, followed by event-dependent members that describe the device. To use this structure, treat the structure as a DEV_BROADCAST_HDR structure, then checked its dbch_devicetype member to determine the device type.


have your / have you got Perhaps ideas, how can I The Info of &UlParam read?
(I knows not whether the one Struct or one area is#... no idea unfortunately )

Gabor
 
Ein Ausländer, der mit Xprofan programmiert !
Entschuldigung für meine Fehlern...
05/21/10  
 



Hello Gabor,

mean You something like?
CompileMarkSeparation
CLS
userMessages 16//wm_close
subClass %hWnd,1

While 1

    WaitInput
    case %uMessage=16 : break

Wend

End

subClassProc

    if subClassMessage(%hWnd,537) and (&sWParam=$8000)// WM_DEVICECHANGE and DBT_DEVICEARRIVAL

        print "Size:",long(&sLparam,0)
        print "Type:",long(&sLparam,4)
        case long(&sLparam,4)=2 : print "Laufwerksbuchstabe:",unitMask2DriveLetter(long(&sLparam,12))//DBT_DEVTYP_VOLUME

    endif

endproc

proc unitMask2DriveLetter

    parameters unitMask&
    declare s$

    whileLoop 26

        if (unitMask& & 1)=1

            s$=chr$(&loop+64)
            break

        endif

        unitMask&=unitMask& >> 1

    wend

    return s$

endproc


User Messages are here instead of SubClassing less suitable, because a memory the message read becomes, but what is definitely time for message and user messages but ((if too) "zum Glück") shifts/ gestackt einflattern and supplied Speicheradressen not any more consist must if one from this then attempts "verspätet" auszulesen.

with obigem (based on subclassing-) code can I successful my Handy-drive discern. (having no other unit to hand )

hope it helps. ^^

>> I know not whether the one Struct or one area is#

can only both be a field and it is always - "Struktur" describe ("nur") The order the Information in memory.
 
05/21/10  
 




Gabor
Krizsma
Hi,

the was very, I sought have !
Vielen-many Thanks for speedy response

i get it the Message-system integral rather !
 
Ein Ausländer, der mit Xprofan programmiert !
Entschuldigung für meine Fehlern...
05/25/10  
 



gladly happen.

If the theme for you "erledigt" is, then Please on Done/ inaktiv settle (so it from whom Indexen herausfällt) - top of this, "Thema: Aktiv" clicking and on the following site [X] active abwählen.

further about: [...] 
 
05/25/10  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.160 Views

Untitledvor 0 min.
Normann Strübli01/30/23
Walter05/15/21
E.T.02/25/18
Pauli07/24/13
More...

Themeninformationen

this Topic has 2 subscriber:

iF (3x)
Gabor Krizsma (3x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie