Esempio n. 1
0
// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
// It loads a "hand" cursor from the winhlp32.exe module
void CHyperLink::SetDefaultCursor()
{
    if (m_hLinkCursor == NULL)                // No cursor handle - load our own
    {
        // Get the windows directory
        CString strWndDir;
        GetWindowsDirectory(strWndDir.GetBuffer(MAX_PATH), MAX_PATH);
        strWndDir.ReleaseBuffer();

        strWndDir += _T("\\winhlp32.exe");
        // This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
        HMODULE hModule = LoadLibrary(strWndDir);
        if (hModule) {
            HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
            if (hHandCursor)
                m_hLinkCursor = CopyCursor(hHandCursor);
        }
        FreeLibrary(hModule);
    }
}
Esempio n. 2
0
//
/// Loads a "hand" cursor from the winhlp32.exe module.
//
/// \note It appeared in Paul DiLascia's Jan 1998 MSJ articles.
void
TUrlLink::SetupCursor()
{
  SetCursor(GetModule(), IDC_HANDCURSOR);
  if(HCursor == 0){
    // if was problem try load cursor from winhlp32.exe
    // Get the windows directory
    TAPointer<tchar> Buffer(new tchar[MAX_PATH]);
    ::GetWindowsDirectory(Buffer, MAX_PATH);
     _tcscat(Buffer,_T("\\winhlp32.exe"));
    // This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
    HMODULE hModule = ::LoadLibrary(Buffer);
    if (hModule) {
      HCURSOR hHandCursor = ::LoadCursor(hModule, TResId(106));
      if (hHandCursor)
        HCursor = CopyCursor(hHandCursor); // it is a macro in Win32

      ::FreeLibrary(hModule);
    }
  }
}
Esempio n. 3
0
HCURSOR Globals::GetHandCursor()
{
	TCHAR szWinDir[MAX_PATH];
	EnterCriticalSection(&m_csGlobals);
	if (NULL == m_hHandCursor)
	{
		if (GetWindowsDirectory(szWinDir, MAX_PATH) > 0)
		{
			lstrcat(szWinDir, _T("\\winhlp32.exe"));
			HMODULE hModule = LoadLibrary(szWinDir);
			if (hModule) 
			{
				m_hHandCursor =	CopyCursor(::LoadCursor(hModule, MAKEINTRESOURCE(106)));
				FreeLibrary(hModule);
			}
		}
		if (NULL == m_hHandCursor)
			m_hHandCursor = LoadCursor(g_hInstance, MAKEINTRESOURCE(IDC_POINT));
	}
	LeaveCriticalSection(&m_csGlobals);
	return m_hHandCursor;
}
Esempio n. 4
0
///////////////////////////////////////////////////////////////////////////////
// SetDefaultCursor - borrowed from XHyperLink.cpp
void CXScrollBar::SetDefaultCursor()
{
	if (m_hCursor == NULL)				// No cursor handle - try to load one
	{
		// First try to load the Win98 / Windows 2000 hand cursor

		TRACE(_T("loading from IDC_HAND\n"));
		m_hCursor = AfxGetApp()->LoadStandardCursor(IDC_HAND);

		if (m_hCursor == NULL)			// Still no cursor handle -
										// load the WinHelp hand cursor
		{
			// The following appeared in Paul DiLascia's Jan 1998 MSJ articles.
			// It loads a "hand" cursor from the winhlp32.exe module.

			TRACE(_T("loading from winhlp32\n"));

			// Get the windows directory
			CString strWndDir;
			GetWindowsDirectory(strWndDir.GetBuffer(MAX_PATH), MAX_PATH);
			strWndDir.ReleaseBuffer();

			strWndDir += _T("\\winhlp32.exe");

			// This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
			HMODULE hModule = LoadLibrary(strWndDir);
			if (hModule)
			{
				HCURSOR hHandCursor = ::LoadCursor(hModule, MAKEINTRESOURCE(106));
				if (hHandCursor)
				{
					m_hCursor = CopyCursor(hHandCursor);
				}

				FreeLibrary(hModule);
			}
		}
	}
}
Esempio n. 5
0
BOOL CStaticUrl::OnSetCursor(CWnd*, UINT, UINT)
{
    if (m_hCursor == NULL)
    {
        TCHAR WinDir[MAX_PATH];
        GetWindowsDirectory(WinDir, MAX_PATH);
        _tcscat(WinDir, _T("\\winhlp32.exe"));
        HMODULE hModule = LoadLibrary(WinDir);
        if (hModule) {
            m_hCursor =
                CopyCursor(::LoadCursor(hModule, MAKEINTRESOURCE(106)));
        }
        FreeLibrary(hModule);
//      m_hCursor = theApp.LoadCursor(IDC_HAND);
    }
    if (m_hCursor)
    {
        ::SetCursor(m_hCursor);
        return TRUE;
    }
    else
        return FALSE;
}
Esempio n. 6
0
void RingStatic::SetHyperlink(COLORREF crNormal/*=0x00FF0000*/,COLORREF crHover/*=0x00FF0000*/)
{
	m_crTextColor = m_crNormal = crNormal;
	m_crHover = crHover;
	
	m_brush = (HBRUSH)GetStockObject(NULL_BRUSH);

	ReplaceStyle(0,SS_NOTIFY);
	
	if(m_cursor == NULL)
	{
		ringStr str(RSTR_WINPATH);
		str += "\\winhlp32.exe";
		HMODULE hModule = LoadLibrary(str.string());
		if(hModule)
		{
			HCURSOR hCursor = LoadCursor(hModule,MAKEINTRESOURCE(106));
			if(hCursor)
				m_cursor = CopyCursor(hCursor);
		}
		FreeLibrary(hModule);
	}
}
Esempio n. 7
0
//////////////////
// Set "hand" cursor to cue user that this is a link. If app has not set
// g_hCursorLink, then try to get the cursor from winhlp32.exe,
// resource 106, which is a pointing finger. This is a bit of a kludge,
// but it works.
//
BOOL CStaticLink::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
	if (g_hCursorLink == NULL) {
		static BOOL bTriedOnce = FALSE;
		if (!bTriedOnce) {
			CString windir;
			GetWindowsDirectory(windir.GetBuffer(_MAX_PATH), _MAX_PATH);
			windir.ReleaseBuffer();
			windir += _T("\\winhlp32.exe");
			HMODULE hModule = LoadLibrary(windir);
			if (hModule) {
				g_hCursorLink =
					CopyCursor(::LoadCursor(hModule, MAKEINTRESOURCE(106)));
			}
			FreeLibrary(hModule);
			bTriedOnce = TRUE;
		}
	}
	if (g_hCursorLink) {
		::SetCursor(g_hCursorLink);
		return TRUE;
	}
	return FALSE;
}
Esempio n. 8
0
/***********************************************************************
 *              OleIconToCursor (OLEAUT32.415)
 */
HCURSOR WINAPI OleIconToCursor( HINSTANCE hinstExe, HICON hIcon)
{
    FIXME("(%p,%p), partially implemented.\n",hinstExe,hIcon);
    /* FIXME: make a extended conversation from HICON to HCURSOR */
    return CopyCursor(hIcon);
}
Esempio n. 9
0
/**
 * @param hwndParent - parent window handle.
 */
CResManager::CResManager(HWND hwndParent)
{
    ZeroMemory(this, sizeof(*this));

    HDC hDisplayDC = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
    if (hDisplayDC == NULL)
        return;
    LONG lLogPixelsY = GetDeviceCaps(hDisplayDC, LOGPIXELSY);

    LOGFONT lf;
    ZeroMemory(&lf, sizeof(lf));
    lf.lfHeight = -MulDiv(FIXED_FONT_HEIGHT, lLogPixelsY, 720);
    lf.lfWeight = FW_NORMAL;
    lf.lfCharSet = ANSI_CHARSET;
    lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
    _tcscpy_s(lf.lfFaceName, countof(lf.lfFaceName), _T("Courier New"));
    m_hFixedFont = CreateFontIndirect(&lf);

    ZeroMemory(&lf, sizeof(lf));
    lf.lfHeight = -MulDiv(DIALOG_FONT_HEIGHT, lLogPixelsY, 720);
    lf.lfWeight = FW_NORMAL;
    lf.lfCharSet = ANSI_CHARSET;
    lf.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
    lf.lfUnderline = TRUE;
    _tcscpy_s(lf.lfFaceName, countof(lf.lfFaceName), _T("MS Sans Serif"));
    m_hUnderlinedFont = CreateFontIndirect(&lf);

    ZeroMemory(&lf, sizeof(lf));
    lf.lfHeight = -MulDiv(DIALOG_FONT_HEIGHT, lLogPixelsY, 720);
    lf.lfWeight = FW_NORMAL;
    lf.lfCharSet = ANSI_CHARSET;
    lf.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
    _tcscpy_s(lf.lfFaceName, countof(lf.lfFaceName), _T("MS Sans Serif"));
    m_hDialogFont = CreateFontIndirect(&lf);

    m_hHandCursor = LoadCursor(NULL, IDC_HAND);
    if (! m_hHandCursor)
    {
        // Thanks to Paul DiLascia.
        TCHAR szWinHelpPath[MAX_PATH];
        GetWindowsDirectory(szWinHelpPath, countof(szWinHelpPath));
        PathAppend(szWinHelpPath, _T("winhlp32.exe"));
        HMODULE hWinHelp = LoadLibrary(szWinHelpPath);
        if (hWinHelp)
        {
            HCURSOR hHandCursor = LoadCursor(hWinHelp, MAKEINTRESOURCE(106));
            if (hHandCursor)
                m_hHandCursor = CopyCursor(hHandCursor);
            FreeLibrary(hWinHelp);
        }
    }
    m_hArrowCursor = LoadCursor(NULL, IDC_ARROW);
    m_hAppStartingCursor = LoadCursor(NULL, IDC_APPSTARTING);
    m_hWaitCursor = LoadCursor(NULL, IDC_WAIT);
    m_hUpDownCursor = LoadCursor(NULL, IDC_SIZENS);
    m_hLeftRightCursor = LoadCursor(NULL, IDC_SIZEWE);
    m_hIBeamCursor = LoadCursor(NULL, IDC_IBEAM);

    m_hbrWindowBrush = GetSysColorBrush(COLOR_WINDOW);
    m_hbrButtonFaceBrush = GetSysColorBrush(COLOR_BTNFACE);
    m_hbrControlLight = GetSysColorBrush(COLOR_BTNHIGHLIGHT);
    m_hbrAppWorkspace = GetSysColorBrush(COLOR_APPWORKSPACE);

    m_bDestroyBigAppIcon = false;
    m_bDestroySmallAppIcon = false;
    if (hwndParent != NULL)
    {
        __try {
            DWORD_PTR dwResult;
            if (SendMessageTimeout(hwndParent, WM_GETICON, ICON_BIG, 0l, SMTO_ABORTIFHUNG, SEND_MSG_TIMEOUT, &dwResult))
                m_hBigAppIcon = (HICON)dwResult;
            else
                m_hBigAppIcon = NULL;
            if (m_hBigAppIcon == NULL)
                m_hBigAppIcon = (HICON)GetClassLongPtr(hwndParent, GCLP_HICON);
            if (SendMessageTimeout(hwndParent, WM_GETICON, ICON_SMALL, 0l, SMTO_ABORTIFHUNG, SEND_MSG_TIMEOUT, &dwResult))
                m_hSmallAppIcon = (HICON)dwResult;
            else
                m_hSmallAppIcon = NULL;
            if (m_hSmallAppIcon == NULL)
                m_hSmallAppIcon = (HICON)GetClassLongPtr(hwndParent, GCLP_HICONSM);
        } __except (EXCEPTION_EXECUTE_HANDLER) {
            // ignore any exception in broken app...
            m_hBigAppIcon = NULL;
            m_hSmallAppIcon = NULL;
        }
    }
Esempio n. 10
0
bool UCursor::copy(HCURSOR hCursor)
{
    // !!! CopyCursor is a macro.
    m_hObj = CopyCursor(hCursor);
    return (NULL != m_hObj);
}
Esempio n. 11
0
/**
 * Paints a mouse pointer in a Win32 image.
 *
 * @param s1 Context of the log information
 * @param s  Current grad structure
 */
static void paint_mouse_pointer(AVFormatContext *s1, struct gdigrab *gdigrab)
{
    CURSORINFO ci = {0};

#define CURSOR_ERROR(str)                 \
    if (!gdigrab->cursor_error_printed) {       \
        WIN32_API_ERROR(str);             \
        gdigrab->cursor_error_printed = 1;      \
    }

    ci.cbSize = sizeof(ci);

    if (GetCursorInfo(&ci)) {
        HCURSOR icon = CopyCursor(ci.hCursor);
        ICONINFO info;
        POINT pos;
        RECT clip_rect = gdigrab->clip_rect;
        HWND hwnd = gdigrab->hwnd;
        info.hbmMask = NULL;
        info.hbmColor = NULL;

        if (ci.flags != CURSOR_SHOWING)
            return;

        if (!icon) {
            /* Use the standard arrow cursor as a fallback.
             * You'll probably only hit this in Wine, which can't fetch
             * the current system cursor. */
            icon = CopyCursor(LoadCursor(NULL, IDC_ARROW));
        }

        if (!GetIconInfo(icon, &info)) {
            CURSOR_ERROR("Could not get icon info");
            goto icon_error;
        }

        pos.x = ci.ptScreenPos.x - clip_rect.left - info.xHotspot;
        pos.y = ci.ptScreenPos.y - clip_rect.top - info.yHotspot;

        if (hwnd) {
            RECT rect;

            if (GetWindowRect(hwnd, &rect)) {
                pos.x -= rect.left;
                pos.y -= rect.top;
            } else {
                CURSOR_ERROR("Couldn't get window rectangle");
                goto icon_error;
            }
        }

        av_log(s1, AV_LOG_DEBUG, "Cursor pos (%li,%li) -> (%li,%li)\n",
                ci.ptScreenPos.x, ci.ptScreenPos.y, pos.x, pos.y);

        if (pos.x >= 0 && pos.x <= clip_rect.right - clip_rect.left &&
                pos.y >= 0 && pos.y <= clip_rect.bottom - clip_rect.top) {
            if (!DrawIcon(gdigrab->dest_hdc, pos.x, pos.y, icon))
                CURSOR_ERROR("Couldn't draw icon");
        }

icon_error:
        if (info.hbmMask)
            DeleteObject(info.hbmMask);
        if (info.hbmColor)
            DeleteObject(info.hbmColor);
        if (icon)
            DestroyCursor(icon);
    } else {
        CURSOR_ERROR("Couldn't get cursor info");
    }
}
int
ga_win32_draw_system_cursor(struct vsource_frame *frame) {
    static int capture_cursor = -1;
    static unsigned char bitmask[8] = {
        0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
    };
    int i, j, ptx, pty;
    int ret = -1;
    //
    if(capture_cursor < 0) {
        if(ga_conf_readbool("capture-cursor", 0) != 0) {
            ga_error("vsource: capture-cursor enabled.\n");
            capture_cursor = 1;
        } else {
            capture_cursor = 0;
        }
    }
    if(capture_cursor == 0)
        return 0;
#ifdef WIN32
    ICONINFO iinfo;
    CURSORINFO cinfo;
    HCURSOR hc;
    BITMAP mask, cursor;
    int msize, csize;
    //
    bzero(&cinfo, sizeof(cinfo));
    cinfo.cbSize = sizeof(cinfo);
    if(GetCursorInfo(&cinfo) == FALSE) {
        ga_error("vsource: GetCursorInfo failed, capture-cursor disabled.\n");
        capture_cursor = 0;
        return -1;
    }
    if(cinfo.flags != CURSOR_SHOWING)
        return 0;
    if((hc = CopyCursor(cinfo.hCursor)) == NULL) {
        ga_error("vsource: CopyCursor failed, err = 0x%08x.\n", GetLastError());
        return -1;
    }
    if(GetIconInfo((HICON) hc, &iinfo) == FALSE) {
        ga_error("vsource: GetIconInfo failed.\n");
        goto quitFreeCursor;
    }
    //
    GetObject(iinfo.hbmMask, sizeof(mask), &mask);
    msize = mask.bmHeight * mask.bmWidthBytes;
    if(iinfo.hbmColor != NULL) {
        GetObject(iinfo.hbmColor, sizeof(cursor), &cursor);
        csize = cursor.bmHeight * cursor.bmWidthBytes;
    }
    if(iinfo.hbmColor == NULL) {	// B/W cursor
        unsigned char mbits[8192];
        unsigned char *mcurr, *ccurr, *fcurr;
        if(mask.bmBitsPixel != 1) {
            ga_error("vsource: unsupported B/W cursor bitsPixel - m:%d%s1\n",
                     mask.bmBitsPixel, mask.bmBitsPixel == 1 ? "==" : "!=");
            goto quitFreeIconinfo;
        }
        if(msize > sizeof(mbits)) {
            ga_error("vsource: B/W cursor too loarge, ignored.\n");
            goto quitFreeIconinfo;
        }
        if(mask.bmHeight != mask.bmWidth<<1) {
            ga_error("vsource: Bad B/W cursor size (%dx%d)\n",
                     mask.bmWidth, mask.bmHeight);
            goto quitFreeIconinfo;
        }
        GetBitmapBits(iinfo.hbmMask, msize, mbits);
#if 0
        ga_error("vsource: B/W cursor msize=%d point(%d-%d,%d-%d) %dx%d planes=%d bitsPixel=%d widthBytes=%d\n",
                 msize,
                 cinfo.ptScreenPos.x, iinfo.xHotspot,
                 cinfo.ptScreenPos.y, iinfo.yHotspot,
                 mask.bmWidth, mask.bmHeight,
                 mask.bmPlanes,
                 mask.bmBitsPixel,
                 mask.bmWidthBytes);
#endif
        mask.bmHeight = mask.bmHeight>>1;
        for(i = 0; i < mask.bmHeight; i++) {
            pty = cinfo.ptScreenPos.y - iinfo.yHotspot + i;
            if(pty < 0)
                continue;
            if(pty >= frame->realheight)
                break;
            mcurr = mbits + i * mask.bmWidthBytes;
            ccurr = mbits + (mask.bmHeight + i) * mask.bmWidthBytes;
            fcurr = frame->imgbuf + (pty * frame->realstride);
            for(j = 0; j < mask.bmWidth; j++) {
                ptx = cinfo.ptScreenPos.x - iinfo.xHotspot + j;
                if(ptx < 0)
                    continue;
                if(ptx >= frame->realwidth)
                    break;
                if((mcurr[j>>3] & bitmask[j&0x07]) == 0) {
                    if((ccurr[j>>3] & bitmask[j&0x07]) != 0) {
                        fcurr[ptx*4+0] = 0xff;//= 0;
                        fcurr[ptx*4+1] = 0xff;//= 0;
                        fcurr[ptx*4+2] = 0xff;//= 0;
                        //fcurr[ptx*4+3] = 0xff;
                    }
                } else {
                    if((ccurr[j>>3] & bitmask[j&0x07]) != 0) {
                        fcurr[ptx*4+0] ^= 0xff;//= 0;
                        fcurr[ptx*4+1] ^= 0xff;//= 0;
                        fcurr[ptx*4+2] ^= 0xff;//= 0;
                        //fcurr[ptx*4+3] = 0xff;
                    }
                }
            }
        }
Esempio n. 13
0
s3eResult CursorInit_platform()
{
	//HDC hMemDC;
	DWORD dwWidth, dwHeight;
	BITMAPV5HEADER bi;
	HBITMAP hBitmap;//, hOldBitmap;
	void *lpBits;
	DWORD x,y;


	dwWidth  = 32;  // width of cursor
	dwHeight = 32;  // height of cursor

	ZeroMemory(&bi,sizeof(BITMAPV5HEADER));
	bi.bV5Size           = sizeof(BITMAPV5HEADER);
	bi.bV5Width           = dwWidth;
	bi.bV5Height          = dwHeight;
	bi.bV5Planes = 1;
	bi.bV5BitCount = 32;
	bi.bV5Compression = BI_BITFIELDS;
	// The following mask specification specifies a supported 32 BPP
	// alpha format for Windows XP.
	bi.bV5RedMask   =  0x00FF0000;
	bi.bV5GreenMask =  0x0000FF00;
	bi.bV5BlueMask  =  0x000000FF;
	bi.bV5AlphaMask =  0xFF000000; 

	HDC hdc;
	hdc = GetDC(NULL);

	// Create the DIB section with an alpha channel.
	hBitmap = CreateDIBSection(hdc, (BITMAPINFO *)&bi, DIB_RGB_COLORS, 
		(void **)&lpBits, NULL, (DWORD)0);

	//hMemDC = CreateCompatibleDC(hdc);
	ReleaseDC(NULL,hdc);

	// Draw something on the DIB section.
	/*hOldBitmap = (HBITMAP)SelectObject(hMemDC, hBitmap);
	PatBlt(hMemDC,0,0,dwWidth,dwHeight,WHITENESS);
	SetTextColor(hMemDC,RGB(0,0,0));
	SetBkMode(hMemDC,TRANSPARENT);
	TextOut(hMemDC,0,9,"rgba",4);
	SelectObject(hMemDC, hOldBitmap);
	DeleteDC(hMemDC);*/

	// Create an empty mask bitmap.
	HBITMAP hMonoBitmap = CreateBitmap(dwWidth, dwHeight, 1, 1, NULL);

	// Set the alpha values for each pixel in the cursor so that
	// the complete cursor is semi-transparent.
	DWORD *lpdwPixel;
	lpdwPixel = (DWORD *)lpBits;
	for (x=0;x<dwWidth;x++)
	{
		for (y=0;y<dwHeight;y++)
		{
			// Clear the alpha bits
			*lpdwPixel &= 0x00FFFFFF;
			// Set the alpha bits to 0x9F (semi-transparent)
			*lpdwPixel|= 0x01000000; //0x9F000000;
			lpdwPixel++;
		}
	}

	ICONINFO ii;
	ii.fIcon = FALSE;  // Change fIcon to TRUE to create an alpha icon
	ii.xHotspot = 0;
	ii.yHotspot = 0;
	ii.hbmMask =  hMonoBitmap;
	ii.hbmColor = hBitmap;

	// Create the alpha cursor with the alpha DIB section.
	hAlphaCursor = CreateIconIndirect(&ii);
	hAlphaCursorCopy = CopyCursor(hAlphaCursor);

	DeleteObject(hBitmap);          
	DeleteObject(hMonoBitmap); 

    hcArrow = LoadCursor(0, IDC_ARROW);
    hcArrowCopy = CopyCursor(hcArrow);    
    
	//http://cboard.cprogramming.com/windows-programming/66327-restoring-cursor.html


	return S3E_RESULT_SUCCESS;
}
Esempio n. 14
-1
void TfrmMain::wmTimer(WPARAM wParam, LPARAM lParam) {
    if (wParam == ID_bvlTarget) { // Timer for Target selector
        static int primarymouse;
        if(!m_hTargetHighlighter) {
            primarymouse=GetSystemMetrics(SM_SWAPBUTTON)?VK_RBUTTON:VK_LBUTTON;
            m_hTargetHighlighter=CreateWindowEx(WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOOLWINDOW,(LPTSTR)g_clsTargetHighlighter,NULL,WS_POPUP,0,0,0,0,NULL,NULL,hInst,NULL);
            if(!m_hTargetHighlighter) return;
            SetLayeredWindowAttributes(m_hTargetHighlighter,0,123,LWA_ALPHA);
            SetSystemCursor(CopyCursor(IcoLib_GetIcon(ICO_PLUG_SSTARGET)),OCR_NORMAL);
            Hide();
        }
        if(!(GetAsyncKeyState(primarymouse)&0x8000)) {
            KillTimer(m_hWnd,ID_bvlTarget);
            SystemParametersInfo(SPI_SETCURSORS,0,NULL,0);
            DestroyWindow(m_hTargetHighlighter),m_hTargetHighlighter=NULL;
            SetTargetWindow(m_hTargetWindow);
            Show();
            return;
        }
        POINT point;
        GetCursorPos(&point);
        m_hTargetWindow=WindowFromPoint(point);
        if(!((GetAsyncKeyState(VK_SHIFT)|GetAsyncKeyState(VK_MENU))&0x8000))
            for(HWND hTMP; (hTMP=GetParent(m_hTargetWindow)); m_hTargetWindow=hTMP);
        if(m_hTargetWindow!=m_hLastWin) {
            m_hLastWin=m_hTargetWindow;
            RECT rect;
            GetWindowRect(m_hLastWin,&rect);
            int width=rect.right-rect.left;
            int height=rect.bottom-rect.top;
            if(g_iTargetBorder) {
                SetWindowPos(m_hTargetHighlighter,NULL,0,0,0,0,SWP_HIDEWINDOW|SWP_NOMOVE|SWP_NOSIZE);
                if(width>g_iTargetBorder*2 && height>g_iTargetBorder*2) {
                    HRGN hRegnNew=CreateRectRgn(0,0,width,height);
                    HRGN hRgnHole=CreateRectRgn(g_iTargetBorder,g_iTargetBorder,width-g_iTargetBorder,height-g_iTargetBorder);
                    CombineRgn(hRegnNew,hRegnNew,hRgnHole,RGN_XOR);
                    DeleteObject(hRgnHole);
                    SetWindowRgn(m_hTargetHighlighter,hRegnNew,FALSE);//cleans up hRegnNew
                } else SetWindowRgn(m_hTargetHighlighter,NULL,FALSE);
            }
            SetWindowPos(m_hTargetHighlighter,HWND_TOPMOST,rect.left,rect.top,width,height,SWP_SHOWWINDOW|SWP_NOACTIVATE);
        }
        return;
    }
    if (wParam == ID_chkTimed) { // Timer for Screenshot
#ifdef _DEBUG
        OutputDebugStringA("SS Bitmap Timer Start\r\n" );
#endif
        if(!m_bCapture) {		//only start once
            if (m_Screenshot) {
                FIP->FI_Unload(m_Screenshot);
                m_Screenshot = NULL;
            }
            m_bCapture = true;
            switch (m_opt_tabCapture) {
            case 0:
                m_Screenshot = CaptureWindow(m_hTargetWindow, m_opt_chkClientArea);
                break;
            case 1:
                m_Screenshot = CaptureMonitor((m_opt_cboxDesktop > 0) ? m_Monitors[m_opt_cboxDesktop-1].szDevice : NULL);
                break;
            default:
                KillTimer(m_hWnd,ID_chkTimed);
                m_bCapture = false;
#ifdef _DEBUG
                OutputDebugStringA("SS Bitmap Timer Stop (no tabCapture)\r\n" );
#endif
                return;
            }
            if (!m_Screenshot) m_bCapture = false;
        }
        if (m_Screenshot) {
            KillTimer(m_hWnd,ID_chkTimed);
            m_bCapture = false;
#ifdef _DEBUG
            OutputDebugStringA("SS Bitmap Timer Stop (CaptureDone)\r\n" );
#endif
            SendMessage(m_hWnd,UM_EVENT, 0, (LPARAM)EVT_CaptureDone);
        }
    }
}