Author Topic: Troubleshooting with debugging Roman's program  (Read 1448 times)

lafayetto

  • Newbie
  • *
  • Posts: 3
    • View Profile
Troubleshooting with debugging Roman's program
« on: April 22, 2009, 05:12:32 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 Self Power",BoolToStr(Dev->IsSelfPower,True));
//                AddInfo("Is Bus Power",BoolToStr(Dev->IsBusPower,True));
                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;
  nrDeviceBox1Change(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;
  }

}
//---------------------------------------------------------------------------
Errors following at compilation:

symbole 'lvProperties' non défini
symbole 'nrUSB1' non défini
Appel à une fonction  non définie 'nrDevicebox1Change'
'This' ne peut être utilisé que dans une fonction membre
'i' est affecté à une valeur qui n'est jamais utilisée.

Please help me...

I have copied the Builder C++ 6.0 source into a new Builder C++ 5.0 project
as I have been explained but it doesn't work at all.

Thanks for all advices which will be done.





Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Troubleshooting with debugging Roman's program
« Reply #1 on: April 22, 2009, 06:13:57 pm »
Hello

It seems like you have done something wrong with BPR file or did not install nrComm Lib correctly.
Please send full sources (in ZIP archive) of project over email.

Roman Novgorodov
DeepSoftware.Com
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.