Moniter Resolution

hi im a beginner and im trying to make a simple app to display the current resolution of the moniter by using the GetSystemMetrics function but I keep getting two errors concerned with my winuser.h when i try to compile::

main.cpp
c:\program files\microsoft platform sdk\include\winuser.h(42) : error C2146: syntax error : missing ';' before identifier 'HDWP'
c:\program files\microsoft platform sdk\include\winuser.h(42) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

the actual code looks like:

#include <iostream>
#include <winuser.h>
#include <windows.h>

using namespace std;

int nWidth = GetSystemMetrics(SM_CXSCREEN);
int nHeight = GetSystemMetrics(SM_CXSCREEN);

int main();
{

cout << "Your screen width is: " << nWidth << endl;
cout << "Your screen height is: " << nHeight << endl;

return 0;
}
[1010 byte] By [80Degrees] at [2007-11-19 18:29:36]
# 1 Re: Moniter Resolution
The order of #includes is wrong. It must be like this:

#include <windows.h>
#include <winuser.h>

Also there is a ; after main, which should be removed:

int main();
cilu at 2007-11-9 0:55:44 >
# 2 Re: Moniter Resolution
The order of #includes is wrong. It must be like this:

#include <windows.h>
#include <winuser.h>

Actually, there is no need to include 'winuser.h' directly since it gets included through 'windows.h' anyway...thus...

#include <windows.h>

would be enough... ;)
Andreas Masur at 2007-11-9 0:56:50 >
# 3 Re: Moniter Resolution
Thanks guys! Got it!
80Degrees at 2007-11-9 0:57:48 >