This is the mail archive of the cygwin-xfree@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: launching xterm


>That is because it is a Cygwin application, not a win32 native.
>Therefore it needs to open a console if you do not start it from bash
shell.

You can make a small program that will hide the console window when
executing a X program

Take the following code segment and save it to a file called
fw_hide_x.cpp

// -------------- begin code (file fw_hide_x.cpp) ---------------
#include <windows.h>

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR cmd, int)
{
 STARTUPINFO si;
 PROCESS_INFORMATION pi;

        memset(&si, 0, sizeof(si));
        si.cb = sizeof(si);
        si.wShowWindow = SW_HIDE;
        si.dwFlags = STARTF_USESHOWWINDOW;

CreateProcess(NULL, cmd, NULL, NULL, false,
CREATE_NEW_CONSOLE|NORMAL_PRIORITY_CLASS,  NULL, NULL, &si, &pi);

        return 0;
}
// -------------- end code (file fw_hide_x.cpp) ---------------

Then compile the program using the following command line:

gcc -mno-cygwin -mwindows -o fw_hide_x  fw_hide_x.cpp

This should create a program file called fw_hide_x.exe

When you then want to make a shortcut to a X program, you put the
following string in the Target field of the shortcut (The command line)

<path to fw_hide_x>fw_hide_x.exe <command line to X program>

example:  c:\fw_hide_x.exe c:/cygwin/usr/X11R6/bin/xterm.exe

Hope this helps

            Stubbe F. Hviid
--

-----------------------------------------
Stubbe Faurschou Hviid
Max Planck Institut fuer Aeronomie
Max Planck Strasse 2
37191 Katlenburg Lindau
email: sfhviid@linmpi.mpg.de
phone: 5556 979 219
fax:   5556 979 240
-----------------------------------------



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]