G
Guest
I have done my due diligence over the last few days researching the net
for an answer on how to hide the pesky command window that is showing up
when I have xpe launch my custom shell.
As you can see below, I have created a small application (which is
my custom shell) used to set the current directory and launch the
java application which is my main application. As can be seen below
I tried several things to get rid of the command window (SW_HIDE,
javaw.exe, CREATE_NO_WINDOW) but to no avail.
The java application does indeed run. The standard output that the
java application generates goes to the bit bucket, everything
looks good. Except that the pesky command shell is still displayed with
nothing visible
within it.
Can anyone tell me what I am missing? How do I get rid if the seemingly
useless
black box?
Thanks in advance.
Kyle
P.S. Compiling and running this program on a normal Windows XP system using
the
GUI "Start->Run <enter your exe here>" works as described above. So
the problem is not an issue unique to XP embedded itself.
---------------------------
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#define BUFSIZE MAX_PATH
int _tmain(int argc, _TCHAR* argv[])
{
if (!SetCurrentDirectory(_T("c:\\MyDir"))) {
_tprintf(_T("SetCurrentDirectory failed (%d).\n"), GetLastError());
return 0;
}
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
PROCESS_INFORMATION pi;
ZeroMemory(&pi, sizeof(pi));
// Start the child process.
if (!CreateProcess(
_T("c:\\WINDOWS\\system32\\javaw.exe"),
_T("-classpath \".;my.jar\" com.mycompany.myapp"), // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW,
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return 1;
}
// Wait until child process exits.
//
WaitForSingleObject(pi.hProcess, INFINITE);
// Close process and thread handles.
//
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return 0;
}
for an answer on how to hide the pesky command window that is showing up
when I have xpe launch my custom shell.
As you can see below, I have created a small application (which is
my custom shell) used to set the current directory and launch the
java application which is my main application. As can be seen below
I tried several things to get rid of the command window (SW_HIDE,
javaw.exe, CREATE_NO_WINDOW) but to no avail.
The java application does indeed run. The standard output that the
java application generates goes to the bit bucket, everything
looks good. Except that the pesky command shell is still displayed with
nothing visible
within it.
Can anyone tell me what I am missing? How do I get rid if the seemingly
useless
black box?
Thanks in advance.
Kyle
P.S. Compiling and running this program on a normal Windows XP system using
the
GUI "Start->Run <enter your exe here>" works as described above. So
the problem is not an issue unique to XP embedded itself.
---------------------------
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <tchar.h>
#define BUFSIZE MAX_PATH
int _tmain(int argc, _TCHAR* argv[])
{
if (!SetCurrentDirectory(_T("c:\\MyDir"))) {
_tprintf(_T("SetCurrentDirectory failed (%d).\n"), GetLastError());
return 0;
}
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
PROCESS_INFORMATION pi;
ZeroMemory(&pi, sizeof(pi));
// Start the child process.
if (!CreateProcess(
_T("c:\\WINDOWS\\system32\\javaw.exe"),
_T("-classpath \".;my.jar\" com.mycompany.myapp"), // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW,
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return 1;
}
// Wait until child process exits.
//
WaitForSingleObject(pi.hProcess, INFINITE);
// Close process and thread handles.
//
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return 0;
}