Re: [Dev-C++] program with no window or console
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2004-08-20 22:33:44
|
How about making it a Windows application, i.e. using WinMain() instead of
main() as entry point. Then you won't get a console window.
By the way, in case the copy fails, your program display both message
boxes, i.e. the OK box too.
Also, there is no need to have a system("PAUSE") at the end of the
program. The message box is enough.
/Per W
On Fri, 20 Aug 2004, Guillermo Gutierrez wrote:
> How would I get a program to run without displaying a console or a window?
> I just want it to do its thing and then pop up a message box with a message at the end.
>
> My program does what I want it to do, but I don't want a console or window to appear.
>
> Here is my code:
> _____________________________________________
> #include <iostream>
> #include <stdlib.h>
> #include <windows.h>
> #include <winbase.h>
>
> using namespace std;
>
> int main(int argc, char *argv[])
> {
> char* cFileToCopy = "Q:\\QA\\2004-08 RC1\\lp4.exe";
> char* cDestination = "C:\\Documents and Settings\\ggutierrez\\Desktop\\lp4.exe";
>
> cout<<"gonna copy:\n";
> cout<<"this ->" << cFileToCopy<<endl;
> cout<<"to this->" << cDestination<<endl;
> system("PAUSE");
>
> if (CopyFile(cFileToCopy, cDestination, false) == 0)
> {
> MessageBox(NULL, "File Copy Failed", "Error", MB_OK);
> }
> MessageBox(NULL, "Files Copied Successfully.", "Copy Complete", MB_OK);
>
> system("PAUSE");
> return 0;
> }
>
> any suggestions?
>
> Guillermo Gutierrez
> Market Scan Information Systems
> Software Q.A. Supervisor
> (818) 575-2000 x2427
> ggu...@ma...
>
>
|