From: <elm...@te...> - 2006-05-29 01:37:32
|
Hi everyone I would like to use the windows api functions with my Qt project. I know that I must include the windows.h file but when I try to write some api functions the compiler said that the NULL value is diferent that NULL MinGw or something like that. On the other hand, I found a dll library (http://www.codeproject.com/win32/AntonioWinLock.asp). This dll lock windows desktop (Ctrl+Alt+Del and others), and it work well with vc++ and vb, I need to call this dll into my Qt project. I wrote into my .pro file the next opctions: LIBS+:=pathtothedll'\winlock.lib . And into frmloging.h #include "winlockdll.h", then I can do that Class FrmLogin : public QDialog { public : .... int CtrlAltDel_Enable_Disable(BOOL bEnableDisable); ..... } void FrmLogin::myFunction(){ CtrlAltDel_Enable_Disable(false); } but when I try to Call this function I have an error. (Undefined the definition from CtrlAltDel_Enable_Disable). What must I do. |
From: Michael G. <mg...@te...> - 2006-05-29 05:43:12
|
Hi ! > Hi everyone I would like to use the windows api functions with my Qt proj= ect. That is no problem -- I know it works. > I know that I must include the windows.h file You might also have to include other files from w32api, depending on the windows api functions you use... > but when I try to=20 > write some api functions the compiler said that the NULL value is > diferent that NULL MinGw or something like that. =20 That probably means there is an error in your code or something like that. Sigh. Please provide the *EXACT* errormsg. Providing a selfcontained example together with the exact commands used, versions of the tools you used, environment you are running under etc. etc. are helpful as well. > On the other hand, I found a dll library > (http://www.codeproject.com/win32/AntonioWinLock.asp). I can't download the source. > This dll lock windows desktop (Ctrl+Alt+Del and others), > and it work well with vc++ and vb, I need to call this dll into my > Qt project. I wrote into my .pro file the next opctions: =20 >=20 > LIBS+:=3Dpathtothedll'\winlock.lib . >=20 > And into frmloging.h #include "winlockdll.h", then I can do that >=20 > Class FrmLogin : public QDialog > { > public : > .... > int CtrlAltDel_Enable_Disable(BOOL bEnableDisable); Here you declare a memberfunction CtrlAltDel_Enable_Disable which I deduce from the rest of your writing you don't want. You most likely should just delete that line. > ..... >=20 > } >=20 > void FrmLogin::myFunction(){ > CtrlAltDel_Enable_Disable(false); >=20 > } > but when I try to Call this function I have an error. > (Undefined the definition from CtrlAltDel_Enable_Disable).=20 >=20 >=20 > What must I do. Get a book on C++ !!! You must either provide a memberfunction CtrlAltDel_Enable_Disable: int FrmLogin::CtrlAltDel_Enable_Disable(BOOL b){ CtrlAltDel_Enable_Disable(false); <add your code here> } or (and that's what I assume you wish to do) delete it's declaration from the above classfile. You definitely should read in the mingwiki http://www.mingw.org/MinGWiki/ the paragraphs on creating a DLL. These do describe in detail all that is required to get your example working. Also you might want to check out the FAQ section. HTH, Michael =2D-=20 Vote against SPAM - see http://www.politik-digital.de/spam/ Michael Gerdau email: mg...@te... GPG-keys available on request or at public keyserver |
From: <elm...@te...> - 2006-05-29 23:44:09
|
In this example I try to hide the task bar, but I have an error with the NULL value this is the error: In file included from frmlogin.cpp:2: frmlogin.ui.h: In member function `int FrmLogin::StartButton_Show_Hide(BOOL)': frmlogin.ui.h:28: error: cannot convert `const char*' to `const WCHAR*' for argu ment `1' to `HWND__* FindWindowW(const WCHAR*, const WCHAR*)' In file included from frmlogin.cpp:2: frmlogin.ui.h:36:2: warning: no newline at end of file mingw32-make[1]: *** [debug\frmlogin.o] Error 1 mingw32-make[1]: Leaving directory `C:/CNet/Cliente' mingw32-make: *** [debug] Error 2 This compiling with Qt4 Command prompt,but when I Compiled with mingw like this, g++ -o mainmingw.exe -c mainmingw.cpp I don't have any problem. What's wrong?....... |
From: Michael G. <mg...@te...> - 2006-05-30 04:00:17
|
> In this example I try to hide the task bar, but I have an error > with the NULL value this is the error:=20 ??? An error with the NULL value ? According to the errormsg you pasted you have a type mismatch in a functioncall in file frmlogin.ui.h, line 28. > In file included from frmlogin.cpp:2: > frmlogin.ui.h: In member function `int FrmLogin::StartButton_Show_Hide(BO= OL)': > frmlogin.ui.h:28: error: cannot convert `const char*' to `const WCHAR*' f= or argu > ment `1' to `HWND__* FindWindowW(const WCHAR*, const WCHAR*)' This errormsg says you are providing a const single byte character pointer (const char*) where the function expects a const 2-byte character pointer (const WCHAR*). It happens with the first argument in the call to =46indWindowW, all on line 28 in file frmlogin.ui.h I don't know what you expect the compiler to do short of fixing the bug in your code. How detailed should the errormsg be ? Note that for writing the above I didn't even look into your code ! > In file included from frmlogin.cpp:2: > frmlogin.ui.h:36:2: warning: no newline at end of file This is not an error but a warning which the compiler issues because apparently the last in frmlogin.ui.h is not properly terminated by a newline character. > This compiling with Qt4 Command prompt,but when I Compiled with mingw lik= e this, >=20 > g++ -o mainmingw.exe -c mainmingw.cpp >=20 > I don't have any problem. >=20 > What's wrong?....... See above. HTH, Michael =2D-=20 Vote against SPAM - see http://www.politik-digital.de/spam/ Michael Gerdau email: mg...@te... GPG-keys available on request or at public keyserver |
From: Michael G. <mg...@te...> - 2006-05-30 05:36:01
|
In addition to my previous post: > According to the errormsg you pasted you have a type mismatch in a > functioncall in file frmlogin.ui.h, line 28. >=20 > > In file included from frmlogin.cpp:2: > > frmlogin.ui.h: In member function `int FrmLogin::StartButton_Show_Hide(= BOOL)': > > frmlogin.ui.h:28: error: cannot convert `const char*' to `const WCHAR*'= for argu > > ment `1' to `HWND__* FindWindowW(const WCHAR*, const WCHAR*)' >=20 > This errormsg says you are providing a const single byte character > pointer (const char*) where the function expects a const 2-byte character > pointer (const WCHAR*). It happens with the first argument in the call to > FindWindowW, all on line 28 in file frmlogin.ui.h >=20 > I don't know what you expect the compiler to do short of fixing > the bug in your code. How detailed should the errormsg be ? >=20 > Note that for writing the above I didn't even look into your code ! Meanwhile I looked into your sourcecode. Line 28 in frmlogin.ui.h says hWnd =3D GetDlgItem(FindWindow(TASKBAR, NULL), ID_STARTBUTTON); The first parameter to FindWindow (which the compiler complains about) is the constant TASKBAR which is defined in line 6 of the same file as #define TASKBAR "Shell_TrayWnd" // Taskbar class name =46rom the errormsg I deduce you are compiling a unicode enabled app. However TASKBAR seems to have been defined as a singlebyte char constant. and that triggers the error. In your mail you write you get the above error when compiling from the Qt4 commandprompt. What is the Qt4 command prompt ? HTH, Michael =2D-=20 Vote against SPAM - see http://www.politik-digital.de/spam/ Michael Gerdau email: mg...@te... GPG-keys available on request or at public keyserver |