Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bitmap.cpp

    r11 r28  
    1919
    2020// ** CaptureWindow ******************************************************* /*FOLD00*/
    21 
     21#include <ctype.h>
    2222#define MAX_WAIT   15
    2323
     
    3636
    3737    // wait for the selected window to rise to the surface
    38     if ((hwndParent != HWND_DESKTOP) &&  f)
     38    if (f)
    3939    {
    4040        WinSetWindowPos (hwndParent, HWND_TOP, 0,0, 0,0, SWP_ZORDER);
     
    149149               sizeof (aptl) / sizeof (POINTL), /* Number of points in aptl */
    150150               aptl, ROP_SRCCOPY, BBO_IGNORE);
    151     SaveBitmap (hbm, hpsMem, sWidth, sHeight, bmp.cBitCount);
     151
     152    SWCNTRL  swctl;
     153    PID      pid;
     154    TID      tid;
     155    BOOL screen = FALSE, region = FALSE;
     156    CHAR title[11];
     157
     158    if (!f) {
     159        //hwndParent = WinQueryFocus(HWND_DESKTOP);
     160        if (hwndParent == hwndFrame) {
     161            hwndParent = WinQueryWindow(hwndFrame, QW_NEXTTOP );
     162        }
     163        screen = TRUE;
     164        if (prcl)
     165            region = TRUE;
     166    }
     167
     168    int rc = WinQueryWindowProcess(hwndParent, &pid, &tid);
     169    if (WinQuerySwitchEntry(WinQuerySwitchHandle(hwndParent, pid),
     170                            &swctl))
     171        WinQuerySwitchEntry(WinQuerySwitchHandle(NULLHANDLE, pid),
     172                            &swctl);
     173
     174    char buffer[MAXNAMEL+4];
     175    int length = strlen( swctl.szSwtitle );
     176    strcpy(buffer, swctl.szSwtitle);
     177    char *p;
     178    p = buffer;
     179    for (int i = 0; i < (length < 11 ? length : 11); i++) {
     180        if ( ispunct( *p ) || *p == '\\' || isblank( *p )) {
     181            *p = '_';
     182        }
     183        p++;
     184    }
     185
     186    if (region)
     187        snprintf( title, length < 8 ? length + 3 : 11, "SR%s", buffer);
     188    else if (screen)
     189        snprintf( title, length < 8 ? length + 3 : 11, "SC%s", buffer);
     190    else
     191        snprintf( title, length < 8 ? length + 3 : 11, "WD%s", buffer);
     192
     193    SaveBitmap (hbm, hpsMem, sWidth, sHeight, bmp.cBitCount, title);
    152194
    153195    // re-associate the previous bit map and the memory presentation space
Note: See TracChangeset for help on using the changeset viewer.