I went through theForger's tutorial for Win32 API and learned alot :]
The thing that confuses me is why does the dos window always appear behind the window created? Can I make it go away, or at least make it seem like it has?
I went through theForger's tutorial for Win32 API and learned alot :]
The thing that confuses me is why does the dos window always appear behind the window created? Can I make it go away, or at least make it seem like it has?
I'm guessing this is because you're using regular main instead of WinMain. By doing this your program becomes a console application instead of a window based application. To fix this just use WinMain instead of main (you can find documentation for WinMain on MSDN.) Depending on your compiler you may also have to set some additional option to get things working right.
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
it's already in there... just for quick reference here's the code straight from the tutorial: SimpleWindow
I appreciate the help though :]
You shouldn't have a DOS/console window.
Which compiler are you using and what project have you created?
I'm using bloodshed's Dev-C++, and project I created?
I didn't originally create a project for it, but now that I did it works fine, don't know why though :x
thanks :]
Check your compiler/linker settings - there'll be some extra/omitted switch that you need to remove/set or object to link with. These are different for different compilers. The extra console is handy for outputting debugging information so I wouldn't be in such a great hurry to get rid of it unless your application is ready for 'release'.
For example, if you compile your example code with MinGW (which devcpp uses) with -mwindows linker option then you'll get no console (it ensures all necessary winapi libs are properly linked). If you compile the same code without that linker switch and instead explicity link with the required windows libs (usually kernel32, advapi32 and gdi32) then you'll get both a console and a winapi gui window.
Borland compilers are different again; I think there's a gui object (c0w32.obj?) that must be linked to sidestep the extra console issue - but don't quote me on that.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
im not sure with devcpp but with vc++6 and lcc-win32, if you choose your project type to not be win32 application then it has the console, but if you choose win32 application then it should work fine and there shouldnt be a console window
as i said im not to sure with devcpp and what it uses to create a win32 application.
good luck
Good Help Source all round
Good help for win programmers
you will probably find something in here
this thing also helps
if you have never tried any of the above then maybe you should, they help alot
The linker option for MS Visual C is '/subsystem:console' or '/subsystem:windows' .
It can be set in Project - Settings - Link - Project Options.