There are some programs in C++
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include "AtUsbHid.h"
using namespace std;
int main(int argc, char *argv[])
{
HINSTANCE hLib = NULL;
hLib =LoadLibrary(AT_USB_HID_DLL);
if(hLib == NULL){
cout << "boing\n";
}
loadFuncPointers(hLib);
DYNCALL(findHidDevice)(Vid, Pid);
DYNCALL(hidRegisterDeviceNotification)((m_hWnd));
system("PAUSE");
return EXIT_SUCCESS;
}
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include "AtUsbHid.h"
using namespace std;
int main(int argc, char *argv[])
{
HINSTANCE hLib = NULL;
hLib =LoadLibrary(AT_USB_HID_DLL);
if(hLib == NULL){
cout << "boing\n";
}
loadFuncPointers(hLib);
DYNCALL(findHidDevice)(Vid, Pid);
DYNCALL(hidRegisterDeviceNotification)((m_hWnd));
system("PAUSE");
return EXIT_SUCCESS;
}
To copy to clipboard, switch view to plain text mode
This realization is already on the QT. What am I doing wrong?
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLibrary>
#include <QMessageBox>
#include <cstdlib>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <stddef.h>
#include <windowsx.h>
// Include Atmel Hid Usb
#include "AtUsbHid.h"
#define DEFAULT_VID 0x03EB
#define DEFAULT_PID 0x2013
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
Vid = DEFAULT_VID;
Pid = DEFAULT_PID;
}
void MainWindow::on_ConnectUsb_clicked()
{
hLib.load();
if (!hLib.load())
{
tr("Not found AtUsbHid.dll"),
return;
}
//***********************************************************
typedef void (*func)();
func PF_findHidDevice = (func) hLib.resolve("findHidDevice)(Vid, Pid)");
if (!PF_findHidDevice)
{
qDebug ("!!!!!!!!findHidDevice");
return;
}
typedef void (*func)();
func PF_hidRegisterDeviceNotification = (func) hLib.resolve("hidRegisterDeviceNotification");
if (!PF_hidRegisterDeviceNotification)
{
qDebug ("!!!!!!!!hidRegisterDeviceNotification");
return;
}
//***********************************************************
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLibrary>
#include <QMessageBox>
#include <cstdlib>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <stddef.h>
#include <windowsx.h>
// Include Atmel Hid Usb
#include "AtUsbHid.h"
#define DEFAULT_VID 0x03EB
#define DEFAULT_PID 0x2013
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
Vid = DEFAULT_VID;
Pid = DEFAULT_PID;
}
void MainWindow::on_ConnectUsb_clicked()
{
QLibrary hLib(AT_USB_HID_DLL);
hLib.load();
if (!hLib.load())
{
QMessageBox::warning(this, tr("Error"),
tr("Not found AtUsbHid.dll"),
QMessageBox::Ok);
return;
}
//***********************************************************
typedef void (*func)();
func PF_findHidDevice = (func) hLib.resolve("findHidDevice)(Vid, Pid)");
if (!PF_findHidDevice)
{
qDebug ("!!!!!!!!findHidDevice");
return;
}
typedef void (*func)();
func PF_hidRegisterDeviceNotification = (func) hLib.resolve("hidRegisterDeviceNotification");
if (!PF_hidRegisterDeviceNotification)
{
qDebug ("!!!!!!!!hidRegisterDeviceNotification");
return;
}
//***********************************************************
}
To copy to clipboard, switch view to plain text mode
Bookmarks