Determine if "New Hardware Wizard" is running

dakota97

Centurion
Joined
Nov 14, 2003
Messages
116
Location
Pennsylvania
Hi all,

I'm having a problem determining if the "New Hardware Found Wizard" is currently running or not. Without going into the long details, my app installs the drivers for a hardware key during the initial run. After the drivers are installed, the app opens and functions normally.

For whatever reason, the newer drivers appear to require anywhere from 5 seconds to nearly two minutes (machine speed not related) to run the “New Hardware Wizard” and find the USB hardware key. In previous versions, this never took more than seconds.

The current install shows a dialog “no key found, try again?”. Instead of having the end user keep hitting yes, or selecting no when in seconds/minutes the key will be recognized, I want the ability to determine if the New Hardware Wizard is running and then if so I can appropriately assume that the key is still being found and not put up the retry prompt.

The only way I have found thus far and is not ideal is to query the processes running on the system and if RunDll32.exe is running then I can “assume” that the “New Hardware Wizard” is running as RunDll32.exe typically is not running by default and most often would be running for a short period of time like in this instance. For reference, RunDll32.exe is used to call entry points in DLL files.

If you call the following from a CMD prompt or Start/Run will start the general “New Hardware Wizard”


Code:
RunDll32.exe shell32.dll,Control_RunDLL hdwwiz.cpl
This would also be very useful since it is “better” for the end user to not connect the hardware key until prompted to do so (after the driver is installed) and if it can be determined the end user could be prompted “hey you have the key plugged in, unplug it until we say so!”

If anyone has another idea (or a better way) of doing this, please let me know.

Thanks in advance,

Chris
 
well easiest way is to use FindWindow Api

eg...
Code:
	Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		If FindWindow(vbNullString, "Add Hardware Wizard") > 0 Then
			'/// the Add Hardware Wizard IS running
		Else
			'/// it's NOT running
		End If
	End Sub
 
Back
Top