Example #1
0
//   int  VwGetPosHight(VApiHandle hWnd)
SQInteger VwGetPosHight(HSQUIRRELVM v)
{
    SQInteger      nargs         = sq_gettop(v);
    SQInteger      nWnd          = 0;
    WinMgrItem*    pWin          = NULL;
    HWND           hWnd          = NULL;
    SQInteger      nRet          = 0;
    RECT           rc            = {0};

    if (!v || 1 + 1 != nargs) {goto _Exit_;}
    if (OT_INTEGER != sq_gettype(v, 2)) {goto _Exit_;}

    sq_getinteger(v, 2, &nWnd);

    if (-1 == nWnd) {
        CScriptMgr* pMgr = (CScriptMgr*)sq_getforeignptr(v);
        if (!pMgr) {goto _Exit_;}
        CPaintManagerUI* pPM = pMgr->GetManager();
        if (!pPM) {goto _Exit_;}
        hWnd = pPM->GetPaintWindow();
    } else {
        hWnd = QiHwHandleToWin(nWnd)->pWinObj->GetHWND();
    }

    ::GetWindowRect(hWnd, &rc);
    nRet = rc.bottom - rc.top;

_Exit_:
    sq_pushinteger(v, nRet);
    return 1;
}
Example #2
0
// void VwSetWindowPos(HWND hWnd, HWND hWndlnsertAfter,int X, int Y, int cx, int cy, UNIT Flags)
SQInteger VwSetWindowPos(HSQUIRRELVM v)
{
    SQInteger         uIDEvent         = 0;
    SQInteger         nargs            = sq_gettop(v);
    SQInteger         nWnd             = 0;
    SQInteger         nWndlnsertAfter  = NULL;
    HWND              hWnd             = NULL;
    HWND              hWndlnsertAfter  = NULL;
    int               X                = 0;
    int               Y                = 0;
    int               cx               = 0;
    int               cy               = 0;
    UINT              uFlags           = 0;

    if (!v || 7 + 1 != nargs) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 2)) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 3)) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 4) && OT_FLOAT  != sq_gettype(v, 4)) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 5) && OT_FLOAT  != sq_gettype(v, 5)) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 6) && OT_FLOAT  != sq_gettype(v, 6)) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 7) && OT_FLOAT  != sq_gettype(v, 7)) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 8)) {goto _Exit_;}

    sq_getinteger(v, 2, &nWnd);
    sq_getinteger(v, 3, &nWndlnsertAfter);
    sq_getinteger(v, 4, &X);
    sq_getinteger(v, 5, &Y);
    sq_getinteger(v, 6, &cx);
    sq_getinteger(v, 7, &cy);
    sq_getinteger(v, 8, (SQInteger*)&uFlags);

    if (-1 == nWnd) {
        CScriptMgr* pMgr = (CScriptMgr*)sq_getforeignptr(v);
        if (!pMgr) {goto _Exit_;}
        CPaintManagerUI* pPM = pMgr->GetManager();
        if (!pPM) {goto _Exit_;}
        hWnd = pPM->GetPaintWindow();
    } else {
        hWnd = QiHwHandleToWin(nWnd)->pWinObj->GetHWND();
    }

    if (HWND_TOP == (HWND)nWndlnsertAfter    ||
        HWND_BOTTOM == (HWND)nWndlnsertAfter ||
        HWND_TOPMOST == (HWND)nWndlnsertAfter ||
        HWND_TOPMOST == (HWND)nWndlnsertAfter) {
        hWndlnsertAfter = (HWND)nWndlnsertAfter;
    } else {
        hWndlnsertAfter = QiHwHandleToWin(nWndlnsertAfter)->pWinObj->GetHWND();
    }

    ::SetWindowPos(hWnd, hWndlnsertAfter, X, Y, cx, cy, uFlags);
	//::MoveWindow( hWnd, X, Y, cx, cy, TRUE);

_Exit_:
    return 0;
}
Example #3
0
// HANDLE VwSnapShot(VApiHandle hWnd)
SQInteger VwSnapShot(HSQUIRRELVM v)
{
    SQInteger        nargs         = sq_gettop(v);
    SQInteger        nWnd          = 0;
    HWND             hWnd          = NULL;
	CUIImage*        pImg          = NULL;
	CScriptMgr*      pMgr          = NULL;
	CPaintManagerUI* pPM           = NULL;
	BOOL             bIsAlphaWin   = NULL;
	VApiHandle       hRet          = NULL;
	CUIRect          rt;

    if (!v || 1 + 1 != nargs) {goto _Exit_;}
    if (OT_INTEGER != sq_gettype(v, 2)) {goto _Exit_;}

    sq_getinteger(v, 2, &nWnd);

    if (-1 == nWnd) {
        pMgr = (CScriptMgr*)sq_getforeignptr(v);
        if (!pMgr) {goto _Exit_;}
        pPM = pMgr->GetManager();
        if (!pPM) {goto _Exit_;}
        hWnd = pPM->GetPaintWindow();
    } else {
        hWnd = QiHwHandleToWin(nWnd)->pWinObj->GetHWND();
    }

	::GetWindowRect(hWnd, &rt);
	bIsAlphaWin = pPM->IsAlphaWin();
	pImg = new CUIImage();
	pImg->Create(pPM->GetPaintDC(), rt.GetWidth(), rt.GetHeight(), 0, TRUE);
	
	::PrintWindow(hWnd, pImg->GetDC(), 0);
	::SendMessage(hWnd, WM_PRINT, (WPARAM)pImg->GetDC(), PRF_NONCLIENT | PRF_CLIENT | PRF_ERASEBKGND | PRF_CHILDREN);

	hRet = QiHwObjToHandle(pImg);

_Exit_:
	sq_pushinteger(v, hRet);
	return 1;
}
Example #4
0
//BOOL VwSetLayeredWindowAttributes(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags);
SQInteger VwSetLayeredWindowAttributes(HSQUIRRELVM v)
{
    SQInteger         uIDEvent         = 0;
    SQInteger         nargs            = sq_gettop(v);
    SQInteger         nWnd             = 0;
    HWND              hWnd             = NULL;
    COLORREF          crKey            = 0;
    int               bAlpha           = 0;
    DWORD             dwFlags          = 0;

    if (!v || 4 + 1 != nargs) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 2)) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 3)) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 4)) {goto _Exit_;}
    if (OT_INTEGER  != sq_gettype(v, 5)) {goto _Exit_;}

    sq_getinteger(v, 2, &nWnd);
    sq_getinteger(v, 3, (SQInteger*)&crKey);
    sq_getinteger(v, 4, (SQInteger*)&bAlpha);
    sq_getinteger(v, 5, (SQInteger*)&dwFlags);

    if (-1 == nWnd) {
        CScriptMgr* pMgr = (CScriptMgr*)sq_getforeignptr(v);
        if (!pMgr) {goto _Exit_;}
        CPaintManagerUI* pPM = pMgr->GetManager();
        if (!pPM) {goto _Exit_;}
        hWnd = pPM->GetPaintWindow();
    } else {
        hWnd = QiHwHandleToWin(nWnd)->pWinObj->GetHWND();
    }

    //::SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) ^ WS_EX_LAYERED);
    ::SetLayeredWindowAttributes(hWnd, crKey, (BYTE)bAlpha, dwFlags);
    ::RedrawWindow(hWnd, NULL, NULL,
        RDW_ERASE | RDW_INVALIDATE | 
        RDW_FRAME | RDW_ALLCHILDREN);

_Exit_:
    return 1;
}
Example #5
0
//   BOOL VwKillTimer(SQInteger uIDEvent)
SQInteger VwKillTimer(HSQUIRRELVM v)
{
    SQUserPointer     uIDEvent   = 0;
    SQInteger         nargs      = sq_gettop(v);

    if (!v || 1 + 1 != nargs) {goto _Exit_;}
    if (OT_USERPOINTER  != sq_gettype(v, 2)) {goto _Exit_;}

    sq_getuserpointer(v, 2, &uIDEvent);

    CScriptMgr* pMgr = (CScriptMgr*)sq_getforeignptr(v);
    if (!pMgr) {goto _Exit_;}
    CPaintManagerUI* pPM = pMgr->GetManager();
    if (!pPM) {goto _Exit_;}

    ::KillTimer(pPM->GetPaintWindow(), (UINT_PTR)uIDEvent);
    delete (SetTimerParam*)uIDEvent;

_Exit_:
	sq_pushbool(v, TRUE);
    return 1;
}
Example #6
0
SQInteger _VwSetTimerInternal(HSQUIRRELVM v, TIMERPROC lpTimerFunc)
{
	SQInteger      nargs         = sq_gettop(v);
	SQInteger      Handle        = 0;
	SQInteger      uElapse       = 0;
	LPCTSTR        pstrFunc      = NULL;
	SetTimerParam* pTimerParam   = NULL;
	SQUserPointer      nRet          = NULL;

	if (!v || 3 + 1 != nargs) {goto _Exit_;}
	if (OT_INTEGER  != sq_gettype(v, 2)) {goto _Exit_;}
	if (OT_STRING   != sq_gettype(v, 3)) {goto _Exit_;}
	if (OT_INSTANCE != sq_gettype(v, 4)) {goto _Exit_;}

	sq_getinteger(v, 2, &uElapse);
	sq_getstring(v, 3, &pstrFunc);

	pTimerParam = new SetTimerParam();
	pTimerParam->v = v;
	pTimerParam->sFunc = pstrFunc;
	sq_getstackobj(v, 4, &pTimerParam->Obj);

	CScriptMgr* pMgr = (CScriptMgr*)sq_getforeignptr(v);
	if (!pMgr) {goto _Exit_;}
	CPaintManagerUI* pPM = pMgr->GetManager();
	if (!pPM) {goto _Exit_;}

	if (NULL != ::SetTimer(pPM->GetPaintWindow(), (UINT_PTR)pTimerParam, uElapse, lpTimerFunc)) {
		nRet = (SQUserPointer)pTimerParam;
	} else {
		nRet = NULL;
	}

_Exit_:
	sq_pushuserpointer(v, nRet);
	return 1;
}