- Sep 8, 2004
- 1,495
- 0
- 0
OK i am trying to write an application to interface with my USB port on an FPGA device. The USB chip is a Cypress FX2 and they have a .Net Library but all the examples are in C#. It doesn't help as i am mostly all my programming is in oldschool C/C++. But i have gotten used to make Windows application via the C++.Net Windows Forms. But i don't understand how most of it is setup i just know how to use it : / .
Now i have this code from the Cypress Help file that is suppose to just initialize the USB library.
Now i know my C++.net win app has these major sections
includes : the namespaces
namespace "current project"
{
public ref class Form1: public System::Windows::Forms::Form
{
public:Form1(){calls the void InitializeComponent(void) function}
protected:~Form1(){... }
private: All the Form objects class defines i am guessing
void InitializeComponent(void) function ... all the form object properties
private: event functions for the form objects
}
}
So anyone know how to organize the above code into the correct section so it will work correctly? I have tried some ways the the best i could do is 3 errors which did not like these lines:
evHandler = gcnew App_PnP_Callback(PnP_Event_Handler);
usbDevices = gcnew USBDeviceList(CyConst.DEVICES_CYUSB, evHandler);
these are the 3 errors
error C3867: 'My3DLaserScanner::Form11:
nP_Event_Handler': function call missing argument list; use '&My3DLaserScanner::Form11:
nP_Event_Handler' to create a pointer to member
error C3350: 'CyUSB::App_PnP_Callback' : a delegate constructor expects 2 argument(s)
error C3867: 'My3DLaserScanner::Form11::evHandler': function call missing argument list; use '&My3DLaserScanner::Form11::evHandler' to create a pointer to member
any help would be great.
Thanks,
Chris
Now i have this code from the Cypress Help file that is suppose to just initialize the USB library.
using CyUSB;
public class Form1 : System.Windows.Forms.Form
{
USBDeviceList usbDevices;
public Form1()
{
InitializeComponent();
App_PnP_Callback evHandler = new App_PnP_Callback(PnP_Event_Handler);
usbDevices = new USBDeviceList(CyConst.DEVICES_CYUSB, evHandler);
// Get the first device having VendorID == 0x04B4 and ProductID == 0x8613
CyUSBDevice myDev = usbDevices[0x04B4, 0x8613] as CyUSBDevice;
}
public void PnP_Event_Handler(IntPtr pnpEvent, IntPtr hRemovedDevice)
{
if (pnpEvent.Equals(CyConst.DBT_DEVICEREMOVECOMPLETE))
{
usbDevices.Remove(hRemovedDevice);
// Other removal event handling
}
if (pnpEvent.Equals(CyConst.DBT_DEVICEARRIVAL))
{
usbDevices.Add();
// Other arrival event handling
}
}
}
Now i know my C++.net win app has these major sections
includes : the namespaces
namespace "current project"
{
public ref class Form1: public System::Windows::Forms::Form
{
public:Form1(){calls the void InitializeComponent(void) function}
protected:~Form1(){... }
private: All the Form objects class defines i am guessing
void InitializeComponent(void) function ... all the form object properties
private: event functions for the form objects
}
}
So anyone know how to organize the above code into the correct section so it will work correctly? I have tried some ways the the best i could do is 3 errors which did not like these lines:
evHandler = gcnew App_PnP_Callback(PnP_Event_Handler);
usbDevices = gcnew USBDeviceList(CyConst.DEVICES_CYUSB, evHandler);
these are the 3 errors
error C3867: 'My3DLaserScanner::Form11:
error C3350: 'CyUSB::App_PnP_Callback' : a delegate constructor expects 2 argument(s)
error C3867: 'My3DLaserScanner::Form11::evHandler': function call missing argument list; use '&My3DLaserScanner::Form11::evHandler' to create a pointer to member
any help would be great.
Thanks,
Chris