windows and c++
I am a complete idiot in programming. I was using cprogramming.com, but was wondering if someone could tell me how you learn how to do things for windows apps (eg. internet explorer, ZoneAlarm), as when I do the tutorials on cprogramming.com, everything is always in a dos window.
>>> I am a complete idiot in programming
It is because the tutorials you are using are trying to address this point. They are programming tutorials, not Win32 API tutorials. If you cannot program, believe me, you can't program the Win32 API. You will need to be able to reasonably fluent with your language before you try otherwise, you will just get confused and be back here asking why "X" doesn't work, when you are simply doing it wrong.
Walk before you run, learn the alphabet before you start on poetry, the language, before the applications.
This is just about the simplest Windows program you can write.
LRESULT CALLBACK WindowFunc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst,
LPSTR Args, int WinMode)
WinClass.cbSize = sizeof(WNDCLASSEX);
WinClass.hInstance = hThisInst;
WinClass.lpszClassName = "Window";
WinClass.lpfnWndProc = WindowFunc;
WinClass.style = 0;
WinClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
WinClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
WinClass.hCursor = LoadCursor(NULL, IDC_ARROW);
WinClass.lpszMenuName = NULL;
WinClass.cbClsExtra = 0;
WinClass.cbWndExtra = 0;
WinClass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
if(!RegisterClassEx(&WinClass)) return 0;
hWnd = CreateWindow("Window",
LRESULT CALLBACK WindowFunc(HWND hWnd,UINT Message,WPARAM wParam,LPARAM lParam)
hDC = BeginPaint(hWnd,
Hmm, you could completely cut out the window procedure, change WNDCLASSEX to WNDCLASS and initialize it to  (except with curly braces instead of square ones) and cut out half the filling-in, use WS_VISIBLE instead of ShowWindow(), and cut out UpdateWindow(). That comes to less than 1/2 the code :D Actually, you could cut out the entire thing and just stick a MessageBox(), then return!
>>I am a complete idiot in programming.
Then I agree with adrianxw, you probably shouldn't try Windows programming, unless, you're just being excessively modest :)
INT WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, INT)
MessageBox(NULL, "I am teh 1337!!!", "Message!", MB_OK);
Thanks for implementing my suggestion in code Magos :)
The reason my tutorial code is the way it is is because it tries to explain the reason behind things as well as the simple mechanics. The programs are written with beginners in mind who aim to go on to produce more then just the very basic "Hello World" program.
The full tutorial develops this program over several pages, I just clipped and posted the end result.
It then goes on to demonstrate why it is rubbish, and suggests the next tutorial - (back buffering)!