detecting USB drive initialization

G

Guest

My system is set up to boot up and run my application. To do this I use the
command shell and I edited the shell path to be:

"%SystemRoot%\System32\cmd.exe /K %SystemDrive%\run.bat"

and my batch file, in turn, starts my app.

Everything (finally) seems to be running well except for this:

I use a USB flash drive to store setup information. When my application
starts, it reads the setup info from the USB. On some systems it fails to
find the USB drive ( I use an 'access' call to see if the file exists). On
shutdown, the current setup is saved - that always seems to work. So it seems
that I'm trying to read the USB before the OS has enumerated it. So, is
there a way to tell when the OS has finished looking for drives? I tried a
ten second delay before running my app, but that doesn't seem to help in all
cases. Looping until the drive is recognized won't work because the USB
drive may not be present.

This goes back to the general problem of knowing when it's ok to start an
app. From input from this group and from MS tech support this method (adding
app to command shell path) should work, and it almost does. I notice also
that the application starts while the welcome screen is still showing. This
seems odd, but until now hasn't seemed to be a problem.

Thanks,

SteveS
 
G

Guest

Ah, that makes sense. Of course I have no control over which USB device will
be used in which unit, so I'll have to wait for the installation process.
I'll give your solution a try.

I'm using Borland Cbuilder - if I want to add the
CMP_WaitNoPendingInstallEvents function I need the header file (at least); is
it only available in the SDK? And is there an extra library I'll need? I see
the DLL is in the SYSTEM32 dir.

- SteveS
 
K

KM

SteveS,
I'm using Borland Cbuilder - if I want to add the
CMP_WaitNoPendingInstallEvents function I need the header file (at least); is
it only available in the SDK?
DDK.

And is there an extra library I'll need? I see
the DLL is in the SYSTEM32 dir.

You can use dynamic loading. Just make a LoadLibary call to "cfgmgr32.dll" and GetProcAddress("CMP_WaitNoPendingInstallEvents").

KM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top