Results 1 to 2 of 2

Thread: Force the OS to search for new hardware.

  1. #1
    Join Date
    Nov 2002
    Location
    Akron
    Posts
    325

    Question Force the OS to search for new hardware.

    Here is my scenario. I install drivers for a USB device and our software product. The installation installs smoothly and a reboot to replace files is not required. However, the OS has not detected the USB hardware unless you do a reboot. How do you force the OS to search for new hardware?

    The target operating systems are Windows 98, Windows ME, Windows NT, Windows 2000, and Windows XP.

  2. #2
    Join Date
    Nov 2002
    Location
    Akron
    Posts
    325
    I found the answer. Here it is for those who may run into the same problem.

    Code:
    external prototype BOOL NewDev.UpdateDriverForPlugAndPlayDevicesA(HWND,         // HWND  hwndParent,
                                                                     BYVAL STRING, // LPCTSTR  HardwareId,
                                                                     BYVAL STRING, // LPCTSTR  FullInfPath,
                                                                     LONG,         // DWORD  InstallFlags,
                                                                     POINTER       // PBOOL  bRebootRequired OPTIONAL
                                                                    );
    strDLL  = WINSYSDIR ^ "NewDev.dll";
    strTemp = WINDIR ^ "INF\\MyUSBDevice.inf"; 
        
    nResult  = UseDLL(strDLL);
    if (nResult = 0) then
        nHwnd = GetWindowHandle (HWND_INSTALL);
        bResult = UpdateDriverForPlugAndPlayDevicesA(nHwnd, 
                                          "USB\\VID_04FA&PID_2490",
                                          strTemp,
                                          1,
                                          NULL);
        UnUseDLL(strDLL);
    endif;
    Please keep in mind that this works only because I modified the inf file not to copy any files into place. My merge module did that for me. I hope this helps others. Also, the function call is a Win32 call. It is documented in the MSDN library.
    Last edited by TheTraveler; 05-19-2008 at 10:39 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •