Results 1 to 20 of 21

Thread: Cannot load user32.dll from extern C file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Cannot load user32.dll from extern C file

    Ok, I just saw I get some warnings:
    Qt Code:
    1. E:/QT Projects/rawInput-build-desktop/../rawInput/raw_mouse.c:154: warning: passing argument 1 of 'LoadLibraryW' from incompatible pointer type
    2. c:\qt\2010.05\mingw\bin\../lib/gcc/mingw32/4.4.0/../../../../include/winbase.h:1727: expected 'LPCWSTR' but argument is of type 'char *'
    To copy to clipboard, switch view to plain text mode 

    PS: Im trying to use GetLastError, but Im getting some problems fromQtCreator, so it will take a while.

  2. #2
    Join Date
    Sep 2010
    Posts
    145
    Thanks
    1
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot load user32.dll from extern C file

    That's probably why. You have unicode defined, but the source (raw_mouse.cpp) is using ANSI. I'm guessing that LoadLibrary has been failing all along with "no such file or directory". To continue as you are, you need to set your project up to use single-byte characters or you can patch raw_mouse.cpp to use the _TEXT() macro around the string literals. (e.g. _TEXT("user32.dll")).

    Edit: After looking at it again, I can see that "char" is used too extensively to bother making it unicode compliant. Unless you have a compelling reason otherwise, you would be better served to just use ANSI encoding.
    Last edited by Timoteo; 22nd October 2010 at 20:05.

  3. #3
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Cannot load user32.dll from extern C file

    How do I set the rest of my application to ANSI?

    Edit:
    GetLastError() outputs '5716627'.

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cannot load user32.dll from extern C file

    5716627 doesn't sound like a valid error code, how do you get that?

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

    Default Re: Cannot load user32.dll from extern C file

    Sorry to cut into the discussion but wouldn't it be simpler to rewrite this init_raw_mouse function to do the following instead of the "LoadLibrary" part?

    Qt Code:
    1. _RRID = RegisterRawInputDevices;
    2. if (!_RRID) return 2;
    3. _GRIDL = GetRawInputDeviceList;
    4. if (!_GRIDL) return 3;
    5. _GRIDIA = GetRawInputDeviceInfoA;
    6. if (!_GRIDIA) return 33;
    7. _GRID = GetRawInputData;
    8. if (!_GRID) return 4;
    To copy to clipboard, switch view to plain text mode 

    The rest of the code could stay the same.
    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.


  6. The following user says thank you to wysota for this useful post:

    been_1990 (22nd October 2010)

  7. #6
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Cannot load user32.dll from extern C file

    Yeah... Wise Wysota made it Work... Thanks! That solves the problem . Thanks to Timoteo and Squidge for helping.

Similar Threads

  1. Can Qwebview load xml/xsl file?
    By richardander in forum Qt Programming
    Replies: 3
    Last Post: 26th August 2015, 22:36
  2. Save/Load variables to FIle
    By Jordan in forum Qt Programming
    Replies: 2
    Last Post: 26th May 2010, 11:35
  3. How to load a .h or .cpp file in designer?
    By srohit24 in forum Qt Programming
    Replies: 2
    Last Post: 18th February 2009, 13:33
  4. extern class
    By zorro68 in forum Qt Programming
    Replies: 2
    Last Post: 5th October 2007, 21:08
  5. Load ActiveX from file
    By Passer_dj in forum Qt Programming
    Replies: 1
    Last Post: 13th August 2007, 23:24

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.