Discussion:
problems getting inpout32.dll working with qt3forwindows
Roger Rehr
2007-09-02 22:12:23 UTC
Permalink
Hi, Bob,

Thanks for the response! I took a holiday today from this problem to
go up to Hilltop so I haven't done anything more since my first 2 posts
;)

I will answer below, in-line with your questions.
Are you using the commercial licensed copy of Qt3 or are you attempting
to build using Qt3 under MinGW?
I built QT3 under MinGW, it worked fine until my attempt to use the dll.
If it is the latter, I really do suggest you use Qt4 but forget that
for the moment. Tell us why you are not using Qt4?
Well, the reason I used QT3 instead of QT4 basically is because "I am a
lazy dufus" ;)

I built my WSE controller in Linux using QT3 a year or so ago, and I
also built a little widget to control my SDR-1000 in Linux using QT3.
So I learned QT3 and know how to use it, and already had the WSE
controller app all done in QT3, so if I hadn't run into this dll
problem, it would have been an easy job; just substitute the inpout32
statements for the Linux print statements and things are done. The
lazy part is because I didn't want to have to rewrite the program, and
the dufus part is because when I looked at QT4 and tried to start
redoing the WSE controller in QT4 the transition from QT3 to QT4 was
NOT intuitive and I was not making headway. Therefore, me dufus ;)
Are you able to run MSYS and mingw under Windows XP 64?
Well, I am not sure about MSYS. But I was able to compile QT3 under
XP64 with no problem, and to compile my WSE control application with
the exception of the DLL reference. The executable WSE controller runs
fine and all functions work except for actual printer control, since I
can't get the DLL working.

I have MSYS installed with no errors, but don't know what it does and
thus don't know if it is working.
WCHAR is a 16 bit unicode character and char is an 8 bit quantity. You
are in a bit of a bother I would say.
Yes. As Leif pointed out, Although my code used LoadLibrary, the
compiler referenced LoadLibraryW. And I was not able to cast my way
out of the WCHAR* vs char* quandry, although I tried both static and
dynamic casts.

One thing I've wondered is if MinGW actually allows one to call dll's
from within C== code. Maybe that is only permitted with Microsoft C++
products?

Anyway, this weekend I learned way more about wchar_t vs char and
Unicode vs ANSI than I ever wanted to know ;)

I am going to try Chris's suggestion when I get back home. I have been
at Hilltop all day mouseproofing my FT1000MP Mk V and reassembling the
station with an eye towards minimizing the rework necessary when my
Flex-5000 arrives ;)

I have tried to install QT3 for MSVC2005 but the install has MAJOR
problems with finding the includes and libraries that I haven't been
able to solve yet.

As the scarecrow sang, "IF I ONLY HAD A BRAIN" I'd likely have had this
working long ago using QT4 as you suggested :)

Thanks again Bob, and have a great Labor Day Holiday, and

73,

Roger
W3SZ
Thanks,
Bob
Hello, All,
After getting a good 3 hours sleep the obvious hit me [and worked
the reason for the changed behavior was that I had left a modified
windef.h file from Linrad in the PATH. After removing it I am back
form.ui.h:30: error: cannot convert 'const char*' to 'constWCHAR*'
for argument '1' to 'HINSTANCE__* LoadLibraryW<const WCHAR*>'
Again, sorry for the bandwidth, but any help is appreciated!
73,
W3SZ
Roger Rehr
http://www.nitehawk.com/w3sz
Hello, All,
This is somewhat off topic, but not really as I am trying to make an
external program to control my SM5BSZ WSE boxes in windows XP64. They
are nicely controlled via Linrad running under Windows XP64, but I am
having trouble compiling and linking the windows version of QT3 to get
my separate controller running.
QT3-designer compiles and runs, and my wsecontrol application compiles
HINSTANCE h_inpout;
h_inpout = LoadLibrary("C:\inpout32\Win32\npout32.dll");
to my progam without adding an #include <windows.h> I of course get an
error message on 'make' that LoadLibrary is undeclared.
When I added an #include <windows.h> I got for several hours today when
running 'make' or 'mingw32-make' an error that
char* could not be converted to WCHAR* in HINSTANCE. I am not able to
take care of this by using an intermediate variable, nor by attempting
a static_cast or dynamic_cast.
Roger Rehr
W3SZ
http://www.nitehawk.com/w3sz
#############################################################
This message is sent to you because you are subscribed to
To switch to the DIGEST mode, E-mail to
--
AMSAT Director and VP Engineering. Member: ARRL, AMSAT-DL,
TAPR, Packrats, NJQRP, QRP ARCI, QCWA, FRC. ARRL SDR WG Chair
"If you're going to be crazy, you have to get paid for it or
else you're going to be locked up." Hunter S. Thompson
#############################################################
This message is sent to you because you are subscribed to
Roger Rehr
W3SZ
http://www.nitehawk.com/w3sz


#############################################################
This message is sent to you because you are subscribed to
the mailing list <linrad-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>.
To unsubscribe, E-mail to: <linrad-off-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>
To switch to the DIGEST mode, E-mail to <linrad-***@antennspecialisten.se>
To switch to the INDEX mode, E-mail to <linrad-***@antennspecialisten.se>
Send administrative queries to <linrad-request-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>
Roger Rehr
2007-09-03 05:13:25 UTC
Permalink
Hi, Bob, Leif, Chris and all,

It turns out that Chris's suggestion of changing the syntax of the
LoadLibrary statement by putting an L in front of the "C:\..." did the
trick and with that the program compiles with no errors.

I am now at the stage of getting a runtime fatal error when I insert
the function call to oup32fp, but everything up to that step works
fine, so I am getting closer ;)

Thanks Chris for the tip!! I am quite certain I would NOT have
discovered that anytime soon. I had gone right by code using that
syntax. ;)

I haven't found a page that explains the "L" syntax, but I have now
found many examples of it, and not just with LoadLibrary, but more
generally when an external windows dll or process is being passed text
of some form from within a C++ program. Here are some other examples
for the interested:

x.bstrVal = ::SysAllocString(L"C:\\Doc1.doc");

HRESULT hr = CLSIDFromProgID(L"Word.Application", &clsid);

AutoWrap(DISPATCH_PROPERTYPUT, NULL, pPropSubject, L"Value", 1, x);

wprintf(L"Failed calling ITask::SetWorkingDirectory: ");

lpcwszTaskName = L"Test Task";

So I BELIEVE but am not sure that the L before a string converts it
from character to wide-character format. Since my original problem was
that I had 'char' type when I needed 'wchar_t' type, it would make
sense that this would correct the problem. But I didn't find this
stated anywhere, so take this as a guess from a C++ non-programmer.

Have a great day, and

73,

W3SZ
Roger Rehr
http://www.nitehawk.com/w3sz



Roger Rehr
W3SZ
http://www.nitehawk.com/w3sz


#############################################################
This message is sent to you because you are subscribed to
the mailing list <linrad-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>.
To unsubscribe, E-mail to: <linrad-off-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>
To switch to the DIGEST mode, E-mail to <linrad-***@antennspecialisten.se>
To switch to the INDEX mode, E-mail to <linrad-***@antennspecialisten.se>
Send administrative queries to <linrad-request-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>
Alberto di Bene
2007-09-03 21:25:09 UTC
Permalink
Post by Roger Rehr
I haven't found a page that explains the "L" syntax, but I have now
found many examples of it, and not just with LoadLibrary, but more
generally when an external windows dll or process is being passed text
of some form from within a C++ program.
Hi Roger,

if you go to this page :
http://msdn2.microsoft.com/en-us/library/7dzey6h6(VS.80).aspx

you can find this explanation for L"xxx"

--------------
L (converts following character or string to its Unicode counterpart)
--------------

73 Alberto I2PHD



#############################################################
This message is sent to you because you are subscribed to
the mailing list <linrad-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>.
To unsubscribe, E-mail to: <linrad-off-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>
To switch to the DIGEST mode, E-mail to <linrad-digest-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>
To switch to the INDEX mode, E-mail to <linrad-index-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>
Send administrative queries to <linrad-request-gxPnyqAYbxlppp2RfTnSCVfCHZ+Y+***@public.gmane.org>
Loading...