Results 1 to 11 of 11

Thread: Need Help: from Visual C + + in QT

  1. #1
    Join Date
    Apr 2012
    Posts
    17
    Qt products
    Qt4
    Platforms
    Windows

    Question Need Help: from Visual C + + in QT

    There is a program written in Visual C + +, which binds to the USB-device and controls it. I need help in translating it on the QT. I recently switched to QT and scratching their heads for a week, but did not go well.


    UsbHidDemoCode.zip

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Need Help: from Visual C + + in QT

    And what exactly do you expect us to do?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2012
    Posts
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Need Help: from Visual C + + in QT

    I look forward to your help, if not difficult, who can respond.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Need Help: from Visual C + + in QT

    But what kind of help do you want? You don't want us to rewrite your MFC application in Qt for you, do you?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2012
    Posts
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Need Help: from Visual C + + in QT

    Completely rewrite the application in QT, I am not asking you, because this one just for the deal will not happen. Although the code to comment on where and what classes are nuances in translation at the QT.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Need Help: from Visual C + + in QT

    I have no idea what you mean or what you want, sorry. If you ask specific questions, I'm sure someone here will answer them but until you do that, we have no way of helping you.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Mar 2012
    Location
    Tver, Russia
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    1
    Thanked 3 Times in 1 Post

    Default Re: Need Help: from Visual C + + in QT

    lucky_sever, you should start rewriting your app yourself, and in case of any difficulties you may ask for help in this thread. I'm not familar neither with MFC, nor USB devices, but if I could help you, I will

  8. #8
    Join Date
    Apr 2012
    Posts
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Need Help: from Visual C + + in QT

    How to implement this piece of code on QT?

    Qt Code:
    1. #include <cstdlib>
    2. #include <iostream>
    3. #include <windows.h>
    4. #include "AtUsbHid.h"
    5.  
    6. using namespace std;
    7.  
    8. int main(int argc, char *argv[])
    9. {
    10. HINSTANCE hLib = NULL;
    11. hLib =LoadLibrary(AT_USB_HID_DLL);
    12. if(hLib == NULL){
    13. cout << "boing\n";
    14. }
    15. loadFuncPointers(hLib);
    16.  
    17. system("PAUSE");
    18. return EXIT_SUCCESS;
    19. }
    To copy to clipboard, switch view to plain text mode 

    This is what I got. The first part is executed, and the second (if (loadFuncPointers (lib) == NULL) {) shows the message "Not found USB HID address"

    Qt Code:
    1. HINSTANCE hLib = NULL;
    2. QLibrary lib(AT_USB_HID_DLL);
    3. lib.load();
    4. if (!lib.isLoaded())
    5. {
    6. QMessageBox::warning(this, tr("Error"),
    7. tr("Not found AtUsbHid.dll"),
    8. }
    9. //***********************************************************
    10. if (loadFuncPointers(lib)==NULL) {
    11. QMessageBox::warning(this, tr("Error"),
    12. tr("Not found USB HID adress"),
    13. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by lucky_sever; 8th April 2012 at 22:17.

  9. #9
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,345
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: Need Help: from Visual C + + in QT

    Do you want us to implement it with or without your bugs? For example, in line 15 of your code, what happens if "hLib" is NULL? I bet you get more than "boing" when you call .

    First, start by look at the Qt documentation and the Qt examples. That will show you how to write a basic "Hello World" program in Qt so you will know how QApplication and some of the other app-level classes are used. Next, to load an external DLL, look at QLibrary. To implement your call to system( "PAUSE" ), look at the QProcess::execute() method.

    But don't expect anyone here to give you a working program. If you make a start and get stuck somewhere, we will help you. But we don't do homework assignments, and we don't help people who expect us to do everything for them before they try to do anything themselves. The Qt distribution has many example programs for all kinds of problems, and the Qt documentation has a large set of tutorials to help beginners get started. Learn to use them.


    Added after 5 minutes:


    Edit - our messages are crossing.

    Since we have no idea what "loadFuncPointers()" is supposed to do, how can we tell you what is wrong? If you have not changed that function from your original Windows code, then it seems pretty obvious what might be wrong: QLibrary is not an HINSTANCE so if this function is expecting an HINSTANCE argument, no wonder it fails.
    Last edited by d_stranz; 8th April 2012 at 22:39.

  10. #10
    Join Date
    Apr 2012
    Posts
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Need Help: from Visual C + + in QT

    The evil you have any!

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Need Help: from Visual C + + in QT

    Why do you want to rewrite this particular piece of code? If you are using WinAPI calls that work, why rewrite them?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Visual Studio Plugin (1.1.6) crashes Visual Studio (2010)
    By mboeni in forum Installation and Deployment
    Replies: 0
    Last Post: 11th October 2010, 17:46
  2. Qt Visual Studio Add-in for Visual Studio 2010??
    By jiapei100 in forum Installation and Deployment
    Replies: 3
    Last Post: 5th July 2010, 14:14
  3. Using visual studio add in
    By Leolander in forum Newbie
    Replies: 1
    Last Post: 17th February 2010, 08:46
  4. QT Add-in for Visual Studio
    By justso1 in forum Newbie
    Replies: 13
    Last Post: 15th June 2009, 15:09
  5. QT4.1.0 with Visual C++ 6.0
    By Kapil in forum Installation and Deployment
    Replies: 1
    Last Post: 10th February 2006, 19:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.