#include "stdafx.h" #include <windows.h> int _tmain(int argc, _TCHAR* argv[]) { ExitWindowsEx(EWX_FORCE, SHTDN_REASON_FLAG_PLANNED); return 0; } |
I get the following errors:
>error LNK2019: unresolved external symbol __imp__ExitWindowsEx@8 referenced in function _main
>fatal error LNK1120: 1 unresolved externals
With Thanks,
Gal Beniamini

Problem Using ExitWindowsEx
Montana16
See http://msdn.microsoft.com/library/default.asp url=/library/en-us/sysinfo/base/exitwindowsex.asp for more details.
Thanks,
Ayman Shoukry
VC++ Team
Torsten Pietrek
With Thanks,
Gal Beniamini.
YT
I only have one problem left, when I type: #using <user32.dll> it says it cannot use #using on user32.dll... I have no idea what to do, but I did try to find my answer in MSDN and Google.
With Thanks,
Gal Beniamini.
Xin Zhang
Hi Gal,
It is really recommended if you search first at msdn.microsoft.com or msdn2.microsoft.com where you can easily find the answers with even more details and sometimes better than the ones posted on these forums.
Any ways,
See the following links for enabling /CLR:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vccore/html/_core_set_compiler_options.asp
For the effects of enabling /CLR see the following:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vccore/html/vcrefEECOMCompilation.asp
I usually do it from the command line by right clicking on the solution-->properties->build configuration->C/C++-->command line options.
Then add /CLR.
Hope this helps!
Thanks,
Ayman Shoukry
VC++ Team
jstacy
Don't link using the #using but link using the linker command line. You can do that by adding the user32.lib to the linker command
See http://msdn.microsoft.com/library/default.asp url=/library/en-us/vccore/html/_core_Set_Linker_Options.asp for adding the library to the linker command line.
Thanks,
Ayman Shoukry
VC++ Team