Author Topic: unable to open file nrusbdriver.obj  (Read 1769 times)

lafayetto

  • Newbie
  • *
  • Posts: 3
    • View Profile
unable to open file nrusbdriver.obj
« on: April 27, 2009, 02:54:26 pm »

//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <comctrls.hpp>
#include "usb_projet.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "nrclasses"
#pragma link "nrcommbox"
#pragma link "nrusb"
#pragma link "nrusbdriver"
#pragma link "nrcommbox"
#pragma link "nrclasses"
#pragma link "nrusb"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}

void __fastcall TForm1::AddInfo(AnsiString sCapt, AnsiString sVal)
{
        TListItem *Itm;
        if(sVal.Trim() == "") return;
        Itm = lvProperties->Items->Add();
        Itm->Caption = sCapt;
        Itm->SubItems->Add(sVal);
}

//---------------------------------------------------------------------------
void __fastcall TForm1::nrDeviceBox1OnChange(TObject *Sender)
{
        int i;
        TnrUsbDevice *Dev;
        Dev = nrUSB1->UsbDevice;

        lvProperties->Items->BeginUpdate();
//        lvProperties->Clear();

        if(Dev != NULL)
        {
                AddInfo("Description",Dev->Description);
                AddInfo("Max Power",IntToStr(Dev->MaxPower)+" mA");
                AddInfo("Max Packet Size",IntToStr(Dev->MaxPacketSize));
                AddInfo("Vendor ID",IntToHex(Dev->VendorID,4)+"h");
                AddInfo("Product I",IntToHex(Dev->ProductID,4)+"h");
//AddInfo("Is Wake Up",BoolToStr(Dev->IsWakeUp,True));
                AddInfo("Is Wake Up",  Dev->IsWakeUp ? "True" : "False");
                AddInfo("Is Self Power",Dev->IsSelfPower ? "True" : "False");
                AddInfo("Is Bus Power",Dev->IsBusPower ? "True" : "False");
                AddInfo("USB Version",IntToStr(Dev->VerHi) + "." + IntToStr(Dev->VerLo));
                AddInfo("Speed (Low,Full,High)",strUSBSpeeds[Dev->Speed]+" ");
                AddInfo("Pipe Count",IntToStr(Dev->PipeCount));
                AddInfo("Service",Dev->Service);
                AddInfo("Disk's",Dev->DriverLetters);
                for(int i = 0; i < Dev->Descriptors->Count; i++)
                        AddInfo("String Descriptor ["+IntToStr(i+1) + "]", Dev->Descriptors->Strings);
        }

        lvProperties->Items->EndUpdate();
}
//---------------------------------------------------------------------------
int __fastcall TForm1::WMDeviceChange(TMessage &Msg)
{
  int i = nrUSB1->DeviceIndex;
  nrUSB1->WMDeviceChange(Msg);
  nrUSB1->DeviceIndex = i;
  nrDeviceBox1OnChange(this);
  return 0;
}

//---------------------------------------------------------------------------
void __fastcall TForm1::Button1OnClick(TObject *Sender)
{
  if(nrUSB1->UsbDevice == NULL)
  {
    ShowMessage("Please select device.");
    return;
  }

  if(AnsiCompareText(nrUSB1->UsbDevice->Service,"WinUSB") == 0)
  {
    ShowMessage("WinUSB driver is already installed.");
    return;
  }

  if(Application->MessageBox("Do you want continue?","Warning",MB_YESNO) != IDYES)
    return;

  Screen->Cursor = crHourGlass;
  try
  {
//  nrUsbDriver1->Install();
  }
  __finally
  {
    Screen->Cursor = crDefault;
  }

}
//---------------------------------------------------------------------------
//Concerning the following functions
//int__fastcall TForm1::WMDeviceChange(TMessage &Msg),
//void __fastcall TForm1::nrDeviceBox1OnChange(TObject *Sender),
//void __fastcall TForm1::AddInfo(AnsiString sCapt, AnsiString sVal),
//these are functions which are not specified within the project_usb.h
//For instance, they are not part of the Tform1 class.
//On the second point,nrusbdriver.hpp doesn't exist in any include
//folder at all...and of course, as you say, install() method can't
//be recognized...and the french compiler result following is:
//"appel à une fonction non définie".
////
////
////
//So thank you very much for advices whose arm is to replace BoolToStr()
//function
//
//at the compilation, another result is 'unable to open file
//'NRUSBDRIVER.OBJ' '  probably to the not accounted nrusbdriver.obj
// but I am not sure.Is it?
//
//
//#ifndef usb_projetH
//#define usb_projetH
//---------------------------------------------------------------------------
//#include <Classes.hpp>
//#include <Controls.hpp>
//#include <StdCtrls.hpp>
//#include <Forms.hpp>
//#include "nrcommbox.hpp"
//#include <Buttons.hpp>
//#include <ComCtrls.hpp>
//#include "nrclasses.hpp"
//#include "nrusb.hpp"
//---------------------------------------------------------------------------
//class TForm1 : public TForm
//{
//__published:   // Composants gérés par l'EDI
//        TnrDeviceBox *nrDeviceBox1;
//        TListView *lvProperties;
//        TBitBtn *button1;
//        TLabel *Label1;
//        TnrUSB *nrUSB1;
//        void __fastcall Button1OnClick(TObject *Sender);
//        void __fastcall nrDeviceBox1OnChange(TObject *Sender);
//following functions not part of the TForm1 class at the linking.
//        int __fastcall WMDeviceChange(TMessage &Msg);
//        void __fastcall AddInfo(AnsiString sCapt, AnsiString sVal);

//private:   // Déclarations utilisateur
//public:      // Déclarations utilisateur
//        __fastcall TForm1(TComponent* Owner);
//};
//---------------------------------------------------------------------------
//extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
//#endif

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: unable to open file nrusbdriver.obj
« Reply #1 on: April 27, 2009, 06:01:33 pm »
The nrusbdriver module is included into PRO edition of nrComm Lib only.
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.