This message has been sent to VIC@EE.LBL.GOV and BREZAK@APOLLO.HP.COM 21.10.96:

Dear colleagues, please excuse my English.
I am implemented the VIC grabber under Video for Windows. 
It's my first experience with a TCL/TK  application, 
thus some of the my solutions may be not direct or safe.

Sources: Tcl_7.5p1, Tk_4.1, Vic_2.8. Tools: Vc_4.1
The patches from README.WIN32 not applied.

Changes in Tk\Win, made mostly for correct work on highcolor display under Win95:

File "tkWinInit.c", function "TkPlatformInit", line 84, inserted:
    libDir = Tcl_GetVar(interp, "auto_path", TCL_GLOBAL_ONLY);
    if (libDir == NULL) {
        Tcl_SetVar(interp, "auto_path", ".", TCL_GLOBAL_ONLY);
    }
File "tkWinImage.c", function "XCreateImage", line 68, before the function inserted:
    Int
    WinXDestroyImage(image)
        XImage *image;
    {
        if (image->data) free(image->data);
        free(image);
        return 0;
    }
in the function's body the fragment :
    if (visual->class == TrueColor) {
        imagePtr->bits_per_pixel = 24;	
        imagePtr->f.put_pixel = PutPixel;
    } else {
        imagePtr->bits_per_pixel = 8;
        imagePtr->f.put_pixel = NULL;
    }
    ...
    imagePtr->f.destroy_image = NULL;
replaced by:
    if (imagePtr->depth > 16) imagePtr->f.put_pixel = PutPixel;
        else imagePtr->f.put_pixel = NULL;
    imagePtr->bits_per_pixel = imagePtr->depth;
    ...
    imagePtr->f.destroy_image = WinXDestroyImage;
File "tkWinDraw.c", function "TkPutImage", line 494, inserted:
    OSVERSIONINFO osinfo;
after, in the function the fragment:
    if (GetVersion() & 0x80000000) {
replaced by:
    osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    GetVersionEx(&osinfo);
    if (osinfo.dwPlatformId == VER_PLATFORM_WIN32s) {	
File "tkWinX.c", function "XOpenDisplay", line 314, the fragment:
    } else if (screen->root_depth == 16) {
        screen->root_visual->class = TrueColor;
        screen->root_visual->map_entries = 64;
        screen->root_visual->red_mask = 0xf8;
        screen->root_visual->green_mask = 0xfc00;
        screen->root_visual->blue_mask = 0xf80000;
replaced by:
    } else if (screen->root_depth == 16) {
        screen->root_visual->class = TrueColor;
        screen->root_visual->map_entries = 64;
        screen->root_visual->red_mask = 0x7c00;
        screen->root_visual->green_mask = 0x03e0;
        screen->root_visual->blue_mask = 0x001f;

Changes in Vic:
File "makefile.vc", inserted:
    LIB_GRABBER = \vc41\msdev\lib\vfw32.lib
    INCLUDE_GRABBER = \vc41\msdev\inc
    OBJ_GRABBER = grabber-win32.obj
File "main.cc", function "main", line 430, deleted:
    #ifdef WIN32
        TkSetPlatformInit(TkPlatformInit);
    #endif
(because LINK cannot find "TkSetPlatformInit"), 
also line 639, fragment:
    #ifdef NOYET
    ...
        if (Tk_DoOneEvent(TK_X_EVENTS|TK_IDLE_EVENTS|
            TK_DONT_WAIT) == 0)
            Tk_DoOneEvent(0);
replaced by:
    #ifdef WIN32
    ...
        extern void LetGrab();
        if (!Tk_DoOneEvent(TK_X_EVENTS|TK_IDLE_EVENTS|TK_DONT_WAIT))
        if (!Tk_DoOneEvent(TK_FILE_EVENTS|TK_TIMER_EVENTS|TK_DONT_WAIT))
        if (!Tk_DoOneEvent(TK_DONT_WAIT)) LetGrab();
(I know its ugly, but the TCL's "idle" doesn't seem to be idle enough).
File "win32.c", function "gettimeofday", line 112:
    extern void TclGetTime(Tcl_Time*);
    Tcl_Time tt;
    TclGetTime(&tt);
replaced by:
    extern void TclpGetTime(Tcl_Time*);
    Tcl_Time tt;
    TclpGetTime(&tt);
File "ui-grabber.tcl", line 134, inserted:
    proc build.msvideo w {
        global msvideoName msvideoSource
        set msvideoSource $w.f.button
        set f [smallfont]
        label $w.title -text "Grabber"

        frame $w.f -relief sunken -borderwidth 2

        button $w.f.button -font $f -text Source -anchor c \
            -command "grabber setsource" -state disabled
        label $w.f.name -font $f -text $msvideoName
    
        pack $w.title $w.f -fill x -expand 1   
        pack $w.f.button -side left 
        pack $w.f.name -side left -fill x -expand 1
    }

File "grabber-win32.cc" is sent as attachment.

Known grabber limitation: 
    the list of devices not implemented,
    the device must support one of the BI_RGB formats,
    the capture window not supported,
    the data conversion isn't optimized.

Known bugs:
    When some of the VIC's windows are closed by the Window manager,
(not by the "Dismiss" button), the program crashed.
    When the program exit during transmission, the grabber destructor not called,
I am forced to do it from static object, to make the videodriver free.
    When the large videowindow opens during bidirectional session, its completely 
hold the Windows on Pentium-90, and give very small breath on Pentium-133
(my modification of the main loop in "main.cc" helps significantly, but the 
program still not react, when receive bad packets).
    The "Size" option of the large videowindow didn't resize the window himself.

I will be very glad to see on your FTP the VIC with this (or better) Windows
grabber and all the other enhancements. Also I am currently under hard demand
to produce the full duplex version of VAT for Win95 in a month. I build the thing from
source already, but cannot think anything purposeful for a while. Please help,
if you can, or do it for me [8^).

Amir Jantimirov, Softlab-NSK
www.softlab-nsk.com
mailto: amir@iae.nsk.su
fax: 7 (3832) 35-16-73
