Is it somehow possible to start Windows applications from xterm so that they "remain" in X-Server area?

David Fraser davidf@sjsoft.com
Tue Jun 1 10:49:00 GMT 2004


Kensuke Matsuzaki wrote:

>Hi,
>
>  
>
>>On Sun, 30 May 2004, Ariel Burbaickij wrote:
>>
>>    
>>
>>>I guess the topic says it all, gentlemen ;-)
>>>      
>>>
>>No. There is currently no possibility to do this. The windows application 
>>uses GDI to draw to the screen. 
>>
>>There is of course the possibility to catch the GDI calls at some point in
>>the windows layers and translate them to X11 but there is currently no 
>>project which has managed to create at least code in alpha stage. 
>>    
>>
>
>Sawanaka did that.
>He ported PEACE on BSD to Cygwin, it seems to be called Cygpeace.
>His site is wrote in Japanese. Please use online translation :)
>http://www.d1.dion.ne.jp/~sawanaka/peace/
>
>Screenshot of 'Mine Sweeper' on X
>http://www.d1.dion.ne.jp/~sawanaka/peace/winmine.jpg
>
>It has not been update since March 16, 2003.
>
>Kensuke Matsuzaki
>  
>
Wow! This is amazing! I wish I had known about it before ...
Still works, I only had to patch it to set the DEFAULT_CHARSET to Ansi 
(see ttfont.cc, line 1140 or so for where to patch this)

Basic instructions for those not wanting to do the translation (actually 
this is all in the page):
Download detours.exe from http://research.microsoft.com/sn/detours/
wget http://www.d1.dion.ne.jp/~sawanaka/peace/cygpeace-030316.tar.gz
Then make cygpeace:

tar zxvf cygpeace-030316.tar.gz
cd peace/dll/cygpeace
make
make install

Note that you make it in the cygpeace directory, don't try make in the 
ui.so.dll directory
To extract and make detours (requires Visual C++)

$ ./detours.exe ([unzip to folder:] ./detours)
$ cd detours
$ rm lib/detours.pdb
$ nmake

$ cp samples/bin/withdll.exe /usr/local/bin/

To run a standard windows program using the hook to display in XWindows:

$ export PEACE_FONTPATH=`cygpath -u $WINDIR/Fonts`
$ export DISPLAY=:0.0
$ XWin -rootless &
$ openbox & # this is just to run a window manager
$ withdll -d:peacehook.dll winmine

To compile a program to use the hook interface directly:
$ cat msgbox.c

#include <windows.h>
int main()
{
    MessageBox(NULL, "test", NULL, MB_OK);
    return 0;
}

$ gcc msgbox.c -o msgbox -L/usr/local/lib -lui.so
$ export DISPLAY=:0.0
$ ./msgbox

Voila. It even works on a remote X session from Linux :-)

David



More information about the Cygwin-xfree mailing list