hidden window
-
Hello I have a problem on how to hide an application running in hidden mode. I found a code to hide the window. This code will hide all windows including the dos window. The code is :-
#include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { while(1) { Sleep(1000); } return 0; } main() { /* This is where all of the codes including function calls and API calls is placed here. Example the InitWSA()for initializing windows socket and other API calls */ }
Im not sure what does this code do but since i already test the code, it really hides the dos window. A brief about my system, i created client server based application using a win32 console application where the client will communicate and send messages to the server. The network part has already be done and the client currently can send messages to the server meanwhile the server has no problem to display the sent messages from the client. So this means that the client-server part has no problem. One of the requirement of my application is that the client application must be hidden from the user. So, I used the code above to hide the dos window from being seen by the user. At first, the code above didnt work (the dos window can still be seen). There was no error but after i had done some research, i realize that it couldn't work because the linker setting of the project under system tab is by default set to Console (/SUBSYSTEM:CONSOLE). So i changed this setting to Windows (/SUBSYSTEM:WINDOWS). Then after i change these settings, the code above works (the dos window is hidden). How did i know that the code works is because i checked the Windows Task Manager and i saw that under processes tab, there is my *.exe is executing. The problem is that the network part didnt work since the server didnt receive any messages from the client. Then i differentiate the application running under Windows (/SUBSYSTEM:WINDOWS) with the one running under Console (/SUBSYSTEM:CONSOLE). I realize that when the application is running under /subsystem:windows and it is hidden, the windows task manager will display only at the processes running. For instance: my project name is hidden.exe. So, hidden.exe will be displayed only at the Processes running tab. There is no display under the Application running tab. But when i change to /subsystem:console and the dos window c -
Hello I have a problem on how to hide an application running in hidden mode. I found a code to hide the window. This code will hide all windows including the dos window. The code is :-
#include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { while(1) { Sleep(1000); } return 0; } main() { /* This is where all of the codes including function calls and API calls is placed here. Example the InitWSA()for initializing windows socket and other API calls */ }
Im not sure what does this code do but since i already test the code, it really hides the dos window. A brief about my system, i created client server based application using a win32 console application where the client will communicate and send messages to the server. The network part has already be done and the client currently can send messages to the server meanwhile the server has no problem to display the sent messages from the client. So this means that the client-server part has no problem. One of the requirement of my application is that the client application must be hidden from the user. So, I used the code above to hide the dos window from being seen by the user. At first, the code above didnt work (the dos window can still be seen). There was no error but after i had done some research, i realize that it couldn't work because the linker setting of the project under system tab is by default set to Console (/SUBSYSTEM:CONSOLE). So i changed this setting to Windows (/SUBSYSTEM:WINDOWS). Then after i change these settings, the code above works (the dos window is hidden). How did i know that the code works is because i checked the Windows Task Manager and i saw that under processes tab, there is my *.exe is executing. The problem is that the network part didnt work since the server didnt receive any messages from the client. Then i differentiate the application running under Windows (/SUBSYSTEM:WINDOWS) with the one running under Console (/SUBSYSTEM:CONSOLE). I realize that when the application is running under /subsystem:windows and it is hidden, the windows task manager will display only at the processes running. For instance: my project name is hidden.exe. So, hidden.exe will be displayed only at the Processes running tab. There is no display under the Application running tab. But when i change to /subsystem:console and the dos window cif /SUBSYSTEM is console, that is console application, by default system provides a console, i am not sure whether it can be disabled, In linux, for console applications, console is not visible until an console IO statement is executed. In your sample, main() is not going to execute in (/SUBSYSTEM:WINDOWS) and WinMain is not going to execute in (/SUBSYSTEM:CONSOLE). However since in (/SUBSYSTEM:WINDOWS) application, since u r not creating any windows, it seems the application is hidden. 1)If you want any user interface and want to hide whenever possible, go for windows application and use ShowWindow() API to hide. If you never want to have an user interface in this application, 2) still u can use windows application with no window created or 3) go for "Windows Service Application", Windows Service application is usually meant for background and long run task.
-
Hello I have a problem on how to hide an application running in hidden mode. I found a code to hide the window. This code will hide all windows including the dos window. The code is :-
#include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { while(1) { Sleep(1000); } return 0; } main() { /* This is where all of the codes including function calls and API calls is placed here. Example the InitWSA()for initializing windows socket and other API calls */ }
Im not sure what does this code do but since i already test the code, it really hides the dos window. A brief about my system, i created client server based application using a win32 console application where the client will communicate and send messages to the server. The network part has already be done and the client currently can send messages to the server meanwhile the server has no problem to display the sent messages from the client. So this means that the client-server part has no problem. One of the requirement of my application is that the client application must be hidden from the user. So, I used the code above to hide the dos window from being seen by the user. At first, the code above didnt work (the dos window can still be seen). There was no error but after i had done some research, i realize that it couldn't work because the linker setting of the project under system tab is by default set to Console (/SUBSYSTEM:CONSOLE). So i changed this setting to Windows (/SUBSYSTEM:WINDOWS). Then after i change these settings, the code above works (the dos window is hidden). How did i know that the code works is because i checked the Windows Task Manager and i saw that under processes tab, there is my *.exe is executing. The problem is that the network part didnt work since the server didnt receive any messages from the client. Then i differentiate the application running under Windows (/SUBSYSTEM:WINDOWS) with the one running under Console (/SUBSYSTEM:CONSOLE). I realize that when the application is running under /subsystem:windows and it is hidden, the windows task manager will display only at the processes running. For instance: my project name is hidden.exe. So, hidden.exe will be displayed only at the Processes running tab. There is no display under the Application running tab. But when i change to /subsystem:console and the dos window cKogee San wrote:
Im not sure what does this code do...
If the code snippet is troubling you, it's obvious you need to start with the very basics, and leave window hiding for another time.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
if /SUBSYSTEM is console, that is console application, by default system provides a console, i am not sure whether it can be disabled, In linux, for console applications, console is not visible until an console IO statement is executed. In your sample, main() is not going to execute in (/SUBSYSTEM:WINDOWS) and WinMain is not going to execute in (/SUBSYSTEM:CONSOLE). However since in (/SUBSYSTEM:WINDOWS) application, since u r not creating any windows, it seems the application is hidden. 1)If you want any user interface and want to hide whenever possible, go for windows application and use ShowWindow() API to hide. If you never want to have an user interface in this application, 2) still u can use windows application with no window created or 3) go for "Windows Service Application", Windows Service application is usually meant for background and long run task.
Ok. understand now. So, since i dont want any windows interface for this application, I would like to choose either option 2 or 3. (Use windows application with no window created or go for windows service application" Let say if i choose option 2. How can i create windows application without affecting my network application (client/server) which has been coded in C. Must i use MFC or there are other options which is much more easier to use to create windows application and it can also integrate my client/server application in C. If i choose option 3, does windows service application accepts C as the programming platform? Can it be coded in Microsoft Visual Studio or it uses another programming application. Another thing, must i change the whole code of my client/server or i can use the previous one, just change the platform from visual studio to windows service application. Actually im kinda new to programming so im weak in choosing the requirements. Lastly, thank you from your previous reply and it really helps. Thanks again
-
Ok. understand now. So, since i dont want any windows interface for this application, I would like to choose either option 2 or 3. (Use windows application with no window created or go for windows service application" Let say if i choose option 2. How can i create windows application without affecting my network application (client/server) which has been coded in C. Must i use MFC or there are other options which is much more easier to use to create windows application and it can also integrate my client/server application in C. If i choose option 3, does windows service application accepts C as the programming platform? Can it be coded in Microsoft Visual Studio or it uses another programming application. Another thing, must i change the whole code of my client/server or i can use the previous one, just change the platform from visual studio to windows service application. Actually im kinda new to programming so im weak in choosing the requirements. Lastly, thank you from your previous reply and it really helps. Thanks again
First of all, it seems you need to be familiar with basics of windows programming, that can answer almost everything yourself in this context.
Kogee San wrote:
Must i use MFC or there are ...
since u don't need UI, u can avoid MFC for now. Infact u can integrate your C Code with both MFC and WIN32.
Kogee San wrote:
If i choose option 3, ...
WIN32, Win Service application can be implemented in VC, VC is C + Microsoft specifics there should be more than these 3 option to do this, it depends on the level of expertise in windows programming i can rate myself (1/10)