Creating a Window using <windows.h>

Nov 10, 2008 at 12:03am
I have 2 questions:
1) I'm trying to create a window from source code, but I tried to make a simple function like:
#include <iostream>
using namespace std;
int main(){
cout << "Hello World";
return 0;}
I installed Directx9 and I'm using Microsoft Visual C++ 2008 Express
but when I try creating a window using WinMain():
#include <windows.h>
int WINAPI WinMain( /* Not sure what to put here */)


but every time I do it, it gives me an error meaning I'm not using the "main()" function.

2) I'm not sure how to create the parameters using "int WINAPI WinMain()"
Thanks in advance

Nov 10, 2008 at 12:34am
Well, first of all, make sure you are trying to build a Win32 project, not a console one. Next, the correct WinMain is:

1
2
3
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
   //blah blah
}


Also, I would suggest googling for WinAPI tutorials.
Nov 10, 2008 at 12:40am
Yeah, I made an empty Win32 Project,
I know how to make C++ programs up to using classes and structs
but I'm trying to learn how to make GUI interface with directx and C++ but i know the first step is making a window ... which i havent been able to do yet lol


I'll look up the tutorials, thank you.

also, when i ran that it still gave me the error of not using the "main()" function.
Nov 10, 2008 at 12:53am
Dmed,
here you can find a skeleton for a WinAPI application
http://progs.biz/winapi/winapi/lessons/001.aspx

Of cause, to find out how it works and what to do further you must "google for WinAPI tutorials"
Topic archived. No new replies allowed.