The window of a project needs to shut off but I didnt know how to do. any help ?
Regards~
The window of a project needs to shut off but I didnt know how to do. any help ?
Regards~
Never end on learning~
what do u mean by needs to be closed??????????
Programming is a high logical enjoyable art for both programer and user !!
Uhhhmm.. you mean return 0;?
Do you mean you want to have a console program that dosent create a console window?
If so then write it as a window app :
just put your console code in a WinMain function.Code:#include <windows.h> #include <stdio.h> int WinMain( HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode ) { FILE *fp; if( ( fp = fopen( "temp.txt", "wt" ) ) != NULL ) fprintf( fp, "NO CONSOLE!!!" ); return 0; }
All spelling mistakes, syntatical errors and stupid comments are intentional.
woh~ I coulnt understand it this time. is there any simply way ?Originally posted by C_Coder
Do you mean you want to have a console program that dosent create a console window?
If so then write it as a window app :
just put your console code in a WinMain function.Code:#include <windows.h> #include <stdio.h> int WinMain( HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode ) { FILE *fp; if( ( fp = fopen( "temp.txt", "wt" ) ) != NULL ) fprintf( fp, "NO CONSOLE!!!" ); return 0; }
Never end on learning~
That code doesn't compile on MSVC6. Haven't programmed windows much in C++, but didn't work as a source file or win32 application.
Truth is a malleable commodity - Dick Cheney
I believe that's 'cos it's missing WINAPIOriginally posted by salvelinus
That code doesn't compile on MSVC6. Haven't programmed windows much in C++, but didn't work as a source file or win32 application.
Code:int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode) ....
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
>> I believe that's 'cos it's missing WINAPI
DOH, how did I leave that out!!!!
>> woh~ I coulnt understand it this time. is there any simply way
That is simple, your just putting your console code in a windows app. All you need do is have a WinMain() instead of a main(), not forgetting the WINAPI of course
Last edited by C_Coder; 07-10-2002 at 11:41 AM.
All spelling mistakes, syntatical errors and stupid comments are intentional.
Still didn't work. Compiled but didn't link
I cut and pasted the code above, adding the winapi. Running MSVC 6 Enterprise.PHP Code:
inking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Cpp2.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Cpp2.exe - 2 error(s), 0 warning(s)
Truth is a malleable commodity - Dick Cheney
It didn't compile because there are some precompiler linking settings that need to be set up. If you are using VC++, just create a new project as Win32 project and not a Win32 console project.
Guys, Winapi should be mentioned anyway ? I know nothing about it. I'm used to programming under console, that's all.
Never end on learning~
Hmm, I'll look into that. Thought I did that, but will try again.Originally posted by Hershlag
It didn't compile because there are some precompiler linking settings that need to be set up. If you are using VC++, just create a new project as Win32 project and not a Win32 console project.
Truth is a malleable commodity - Dick Cheney
>> Guys, Winapi should be mentioned anyway ? I know nothing about it.
Geez its not hard, WINAPI WinMain() is just a windows version of main() for the console.
>> Still didn't work. Compiled but didn't link
>> unresolved external symbol _main
You must have created a console project as it is look for main()
All spelling mistakes, syntatical errors and stupid comments are intentional.