RE: Source code for gtk-demo



There is actually a difference in the entry points. but it is true that
windows its self does not care which entry point is used in a gui or non
gui app.

WinMain and main are treated differently when compiled with visual
studios. its not just a windows console flag that is different.

which has a different entry point that does different things.

the console entrypoint its not int main(int argc,char* argv[])
its actually code that is linked against by the windows compiler.

same with the WinMain but each one has a different set of code that is
dependant on the type of exe you plan on compiling.

for one this stuff is not needed for a program to run but, it does do
some stuff that alot of people use.

for example if you plan on compiling a console app in visual studios the
entry point that is there converts the parameters passed to the exe to
the standard c format. which is still a little different from the way
unix and linux pass parameters.

in linux it uses \ for files with spaces in there name. where in windows
it puts "" around the string with spaces in it.

if you plan on compiling a gui app with visual studios the entry point
is linked to something else then the console exe. this entry point grabs
links like the instance handle for your program.


after the entry points are ran through it then passes what it needs. for
the console app its passes


argc contains the number of parameters passed to the executable
including the executable its self.
argc contains the 2D array that contains the strings of the parameters
passed to the exe.
envp is also a 2D array but i have not looked at what is stored in it.

and the WinMain gets the intances of the program and a couple other
things.

so technically there is a differnce in how the compiler handles making
these programs but windows its self could care less.

since i didnt want to have to edit the console/gui trigger every time i
compiled a program i decided to make my own code that convers the input
to the exe and pass it to the main my self

http://www.devilsclaws.net/downloads/code/gtk+/w32_main.cpp

if you just include this cpp file to your project and leave the other
code alone like for example from the demo codes it will compile and work
as you want.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]