| | |
Write silent program
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 18
Reputation:
Solved Threads: 1
I wish to write a program that works in the background, i.e. without showing any windows. Someone prescribed i try this:
<code>
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
while(1)
{
Sleep(1000);
}
return 0;
}
<code>
but its not working. it still shows the CMD window. I am using Dev-C++. Could anyone advice me?
<code>
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
while(1)
{
Sleep(1000);
}
return 0;
}
<code>
but its not working. it still shows the CMD window. I am using Dev-C++. Could anyone advice me?
0
#2 Oct 13th, 2009
One, you have to specify to the linker that it's a windowed application.
Then you get the window handle, and with ShowWindow(), in the second parameter use SW_HIDE.
edit:
You'll probably also want to look into lowering the task priority.
Then you get the window handle, and with ShowWindow(), in the second parameter use SW_HIDE.
edit:
You'll probably also want to look into lowering the task priority.
Last edited by MosaicFuneral; Oct 13th, 2009 at 9:19 pm.
"Jedenfalls bin ich überzeugt, daß der Alte nicht würfelt."
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
![]() |
Similar Threads
- Need help to write jdbc program (JSP)
- HELP!! trying to write a quiz program part 1 (C++)
- Write from CPP program to serial port (C++)
- How can i write program that writes into a file from an array of string and reverse (C++)
- Trying to write to a file so that another program can read from it at the same time (C++)
- Write a calculator program using a do-while loop (C++)
- C expert help me! Write a TSR program that changes the background color ... (C)
- can we write linlist program in java (Java)
- Can you please help me write this word count program in another way (Python)
- Trying to write a program for an assignment... (Java)
Other Threads in the C Forum
- Previous Thread: code to convert binary to decimal
- Next Thread: how to scan arrow keys from keyboard in c?
| Thread Tools | Search this Thread |
#include * adobe ansi array asterisks binarysearch centimeter changingto char character cm convert copyimagefile cprogramme creafecopyofanytypeoffileinc database dynamic execv feet fgets file floatingpointvalidation fork function getlogicaldrivestrin givemetehcodez global grade gtkwinlinux hacking histogram ide inches include incrementoperators infiniteloop input interest intmain() iso kernel keyboard kilometer license linked linkedlist linux list locate looping lowest match matrix meter microsoft number oddnumber opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer posix power probleminc process program programming radix recursion recv recvblocked research reversing segmentationfault sequential single socket socketprograming socketprogramming standard strchr string suggestions systemcall test threads turboc unix urboc user variable voidmain() wab whythiscodecausesegmentationfault windowsapi





