Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

not working.......

Status
Not open for further replies.

tunahead

Programmer
Feb 22, 2003
9
AT
after I did what you said:


HWND (CreateMainWindow(HINSTANCE hInstance))
{
WNDCLASSEX wndClass; //WNDCLASSEX Struktur

//Struktur initialisieren
wndClass.cbSize=sizeof(WNDCLASSEX); //Größe angeben
wndClass.style =CS_DBLCLKS | CS_OWNDC|//Standart
CS_HREDRAW | CS_VREDRAW;//Stile

//Callbackfunktion angeben (noch nicht durchgenommen)
wndClass.lpfnWndProc=MessageHandler;

wndClass.cbClsExtra=0; //Zusätzliche Angaben
wndClass.cbWndExtra=0; //Werden nicht benötigt
wndClass.hInstance=hInstance; //Anwendungsinstanz

//Weisser Pinsel zum füllen des fensterhintergrunds
wndClass.hbrBackground=
(HBRUSH)GetStockObject(WHITE_BRUSH);

//Standart-Mauscursor verwenden
wndClass.hCursor=LoadCursor(NULL, IDC_ARROW);

//Das Fenster soll kein Menü haben
wndClass.lpszMenuName=NULL;

//Der Name der Fensterklasse wird noch beim Aufruf vonCreateWindowEx benötigt
wndClass.lpszClassName="WindowClass";

//Icons für das Fenster festlegen:
wndClass.hIcon=LoadIcon(NULL, IDI_WINLOGO);
wndClass.hIconSm=LoadIcon(NULL, IDI_WINLOGO);

//Fensterklasse registrieren, damit sie von
//CreateWindowEx verwendet werden kann
RegisterClassEx(&wndClass);

//Der Rückgabewert von CreateWindowEx is auch der Rückgabewert von der
//Funktion:
return (CreateWindowEx(
NULL, //Ohne erweiterte Stile
"WindowClass", //Klassenname
"Ein einfaches Fenter", //Fenstertitel
WS_OVERLAPPEDWINDOW, //Fenstereingenschaften
WS_VISIBLE,
0, 0, //Anfangsposition
400, 300, //Größe
NULL, //Handle des Elterfensters
NULL, //Handle des Menüs
hInstance, //Anwendungsinstanz
NULL, //Nicht benötigt
);)


}



error C2065: 'CreateMainWindow' : undeclared identifier error C2065: 'HINSTANCE' : undeclared identifier
error C2146: syntax error : missing ')' before identifier 'hInstance'
error C2059: syntax error : ')'
error C2143: syntax error : missing ';' before '{'
error C2447: missing function header (old-style formal list?)
Error executing cl.exe.

 


Hi,

the function had Parentheses around it.
Also make sure you have windows.h included .

#include <windows.h>

HWND CreateMainWindow(HINSTANCE hInstance)
{
...
 
I agree - check that windows.h is included.
I think some of these problems could have originated
BEFORE the code that you have posted.
Is it possible that the CreateMainWindow function has not been declared.
It is also possible that this function name is incorrectly
spelt.

Other advice for TunaHead -
Why do you start a new thread each time you post something about this problem???.
Try to keep one thread going so we can see where we are.
 
Why are you still having problems with this, Tunahead?
Take a look at the entire example code I wrote in an earlier thread. Just copy and paste the code labelled 'main.cpp' into a file and save as 'main.cpp', then copy and paste the code labelled 'main.h' and save as 'main.h' (in the same directory). Open the 'main.cpp' in your compiler, and compile it as a windows application.
In all fairness, you shouldn't make new threads for the same problem when the problem has already been solved. If you don't know much about C++ or C I suggest getting a good tutorial book that outlines the language.
Look back over my code, try to understand it. If you can't then try Visual Basic. If you wan't me to explain, post a message (preferably in this thread). You could try using the MFC as this simplifies everything a bit, but you would need to get a book or search the web on how to use this.
From a purist programmer - Adonai
PS - this isn't mean't to be offensive, only constructive :)
C the light...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top