Hallo,
Anyone know how I could go about making a program invisible/hidden when run on startup?
Need to make sure the main window isn't seen so it runs in the background.
Hmm interesting. The Windows
CreateProcess API function seems to allow it through the
lpStartupInfo parameter, but IDK if there's something which will do it for you...
I think this only affects a startup window, and may not work if the application creates multiple windows, or perhaps doesn't define the window as a startup one...
What application are you trying to hide?
Fomine NetSend GUI for LAN message sending, because the msg (previously net send) command doesn't work on the LAN - NetSend GUI uses standard TCP/IP and it worked straight away.
In order to receive messages NetSend GUI has to be running, so putting it in Startup is logical. However, I don't want anyone but me sending messages - so I removed the Send button, as well as the Tray icon with Resource Hacker but the program always appears center of the screen, automatically going on top of all other windows when it starts up so it's hard to ignore.
I looked around for a better more suited for the purpose program yesterday and surprised not to find any. (Almost always I end up looking at msg/net send related pages)
Senseito7 Wrote: [ -> ]Fomine NetSend GUI for LAN message sending, because the msg (previously net send) command doesn't work on the LAN - NetSend GUI uses standard TCP/IP and it worked straight away.
In order to receive messages NetSend GUI has to be running, so putting it in Startup is logical. However, I don't want anyone but me sending messages - so I removed the Send button, as well as the Tray icon with Resource Hacker but the program always appears center of the screen, automatically going on top of all other windows when it starts up so it's hard to ignore.
I looked around for a better more suited for the purpose program yesterday and surprised not to find any. (Almost always I end up looking at msg/net send related pages)
maybe try launching as a service via registry and see if its still centered?
HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices
I don't have that registry key O.o
Nevertheless I added the Service but no dice: "Error 1053: The service did not respond to the start or control request in a timely fashion" - it's not even starting the program ~_~
Thanks for the suggestion though.
Sure it doesn't work over LAN?
Perhaps you've disabled whatever protocol it relies on.
Lol @ hijacking other computers on your network.
Anyway, I tried - can't get it to work :(
For some reason, it ignores me if I tell it to hide. It works fine if I say to minimize etc. Documentation says nothing about not being able to hide...
C Code
#include <windows.h>
#include <string.h>
#include <wchar.h>
int main(void) {
STARTUPINFOW si;
PROCESS_INFORMATION pi;
int result=1;
WCHAR* cmdIn = (WCHAR*)GetCommandLineW();
int numArgs, tmpLen;
LPWSTR* cmdArgs = CommandLineToArgvW((LPCWSTR)cmdIn, &numArgs);
WCHAR cmd[MAX_PATH];
si.cb = sizeof(pi);
si.lpReserved = NULL;
si.lpDesktop = NULL;
si.lpTitle = NULL;
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
si.cbReserved2 = 0;
si.lpReserved2 = NULL;
tmpLen = wcslen(*cmdArgs);
if(cmdIn[0] == L'"') tmpLen += 2;
cmdIn += tmpLen;
while(cmdIn[0] == L' ')
cmdIn++;
wcscpy(cmd, cmdIn);
ShellExecuteW(NULL, L"open", (LPWSTR)cmd, NULL, NULL, SW_HIDE);
LocalFree(cmdArgs);
return !result;
}
|
EDIT:
I'm not sure if user mode applications can be run as services, but actually SchmilK has a good idea. Try using psexec and running it on the SYSTEM account.
:o
I can write such an app.
I used this to hide a command window for the ventrilo server I run
If you know about programming
look into the c++ function
ShowWindow();
as in
ShowWindow((HWND)ventProc»MainWindowHandle.ToPointer(), SW_HIDE);
if you need me to write an application let me know the exe name or the main window name of the application you want to hide.
but doing this means you will have to call a program to hide that program and then possibly call another program when you want to unhide it
Tried it, the messages don't appear on the user though :[
I think I'll have to figure out how to get msg/net send working otherwise look somewhere else.
Thanks for the help guys.
Edit - Slush - NetSendGUI.exe
So I'm looking at my program I wrote and what it appears to do is start itself, and then start the process I want. Then since the program that started the process has a handle to that process it hides it's window =3
so it's essentially what you want but I guess you also want me to exit/hide the process that starts the process
EDIT:
My compiler is being stupid right now and won't let me start a new project, but c# and c++ 2010 are out now so I guess I'll upgrade them and then get right on this. Sorry for the inconvenience.
Hiding the window after the app starts means you're going to have to do some polling, which isn't exactly nice (perfectly plausible to have the actual window flash on screen).
You don't need to handle the process itself, just run it, and poll with something like FindWindow.
Good luck otherwise.