|
-
November 20th, 2004, 06:50 PM
#1
VC++ .NET and winapi
I have a problem with managed c++. I try to use a ExitWindowsEx, winaipi function to turn off my computer, but a compiler doesn't find this function. Maybe somebody had the same problem ?
-
November 20th, 2004, 07:08 PM
#2
Re: VC++ .NET and winapi
Do you have the platform SDK installed? You can find it on microsoft.com.
Also note:
http://msdn.microsoft.com/library/de...ws_headers.asp
And finally:
You can use LoadLibrary(...)/GetProcAddress(...) if you need to.
-
November 21st, 2004, 06:56 AM
#3
Re: VC++ .NET and winapi
But which library I have to add, I truly don't know. Oh I instaled a SKD but compiler still has a C3861 error.
-
November 21st, 2004, 08:01 AM
#4
Re: VC++ .NET and winapi
Go to tools->options [project and solutions] VC++ Directories and make sure the <SDK install dir>\include is at the top (under includes) and the <SDK install dir>\lib is at the top (under libs)
ExitWindowsEx is in winuser.h.
http://msdn.microsoft.com/library/de...twindowsex.asp
So:
#include <windows.h>
You also need to link with user32.lib, so add it to your linker settings or add a pragma:
#pragma comment(lib,"user32")
Code:
WINUSERAPI
BOOL
WINAPI
ExitWindowsEx(
IN UINT uFlags,
IN DWORD dwReserved);
-
November 21st, 2004, 08:42 AM
#5
Re: VC++ .NET and winapi
Thank you , now it's working. I propably never guess way to repair it.
-
November 21st, 2004, 09:50 AM
#6
Re: VC++ .NET and winapi
I hava another problem, ehwn I try to add bacground picture to a button when I add picture in properties VC++ added line
this->pictureBox1->BackgroundImage = (__try_cast<System: rawing::Image * >(resources->GetObject(S"pictureBox1.BackgroundImage")));
and compiler say :
d:\Visual Studio Projects\Programy\Wylacz Mnie\Form1.h(103): error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager'
-
November 22nd, 2004, 03:28 AM
#7
Re: VC++ .NET and winapi
 Originally Posted by Assassin
I hava another problem, ehwn I try to add bacground picture to a button when I add picture in properties VC++ added line
this->pictureBox1->BackgroundImage = (__try_cast<System:  rawing::Image * >(resources->GetObject(S"pictureBox1.BackgroundImage")));
and compiler say :
d:\Visual Studio Projects\Programy\Wylacz Mnie\Form1.h(103): error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager'
Well because you are including <windows.h> you are picking up the macro defines for GetObject
Which translates to GetObjectA or GetObjectW.
use a push_macro/pop_macro in your form1.h
#pragma push_macro("GetObject")
#undef GetObject
[body of code]
...
...
#pragma pop_macro("GetObject")
-
November 22nd, 2004, 01:15 PM
#8
Re: VC++ .NET and winapi
thanky you now it's working.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|