示例#1
0
void BindAPI( ASInterface *as )
{
	PrebindURL( as );
	PrebindEvent( as );
	PrebindEventListener( as );
	PrebindElement( as );
	PrebindWindow( as );
	PrebindIrc( as );
	PrebindL10n( as );

	PrebindOptionsForm( as );
	PrebindServerbrowser( as );
	PrebindDataSource( as );
	PrebindDemoInfo( as );
	PrebindDownloadInfo( as );
	PrebindGame( as );
	PrebindMatchMaker( as );

	// now bind the class functions
	BindURL( as );
	BindEvent( as );
	BindElement( as );
	BindWindow( as );
	BindIrc( as );
	BindL10n( as );

	BindOptionsForm( as );
	BindServerbrowser( as );
	BindDataSource( as );
	BindDemoInfo( as );
	BindDownloadInfo( as );
	BindGame( as );
	BindMatchMaker( as );
}
MFCDERIVED_API void afxSubClientWindow(HWND hChild)
{
	//if(GetProp(hChild,__UMyProp__)) return;	//已经绑定过了
	RECT rtWindow={0};
	TCHAR szName[64]={0};
	DWORD wndStyle=GetWindowLong(hChild,GWL_STYLE);
	DWORD wndStyleEx=GetWindowLong(hChild,GWL_EXSTYLE);
	::GetWindowRect(hChild,&rtWindow);
	rectScreenToClient(GetParent(hChild),&rtWindow);
	GetClassName(hChild,szName,64);
	if(!lstrcmp(szName,WC_BUTTON))
	{
		switch(wndStyle&SS_TYPEMASK)
		{
		case	BS_DEFPUSHBUTTON:	//默认按钮
		case	BS_PUSHBUTTON:		//普通按钮
			if(ButtonUltimate*pButton=new ButtonUltimate)
			{
				::MoveWindow(hChild,rtWindow.left,rtWindow.top,rtWindow.right-rtWindow.left,26,FALSE);
				BindWindow(hChild,pButton,wndStyle,wndStyleEx);
				if(::GetDlgCtrlID(hChild)==IDOK)
				{
					
				}
				if(::GetDlgCtrlID(hChild)==IDCANCEL)
				{
					
				}
			}
			break;
		}
		return;
	}
}
示例#3
0
void
compzillaWindow::Damaged (XRectangle *rect)
{
    BindWindow ();

    if (!rect) {
        XRectangle allrect = { mAttr.x, mAttr.y, mAttr.width, mAttr.height };
        Damaged (&allrect);
        return;
    }

    for (PRUint32 i = mContentNodes.Count() - 1; i != PRUint32(-1); --i) {
        RedrawContentNode (mContentNodes.ObjectAt(i), rect);
    }
}
示例#4
0
void
compzillaWindow::Mapped (bool override_redirect)
{
    if (mAttr.map_state == IsViewable ||
        mAttr.c_class == InputOnly)
        return;

    mAttr.map_state = IsViewable;
    mAttr.override_redirect = override_redirect;

    BindWindow ();

    for (PRUint32 i = mObservers.Count() - 1; i != PRUint32(-1); --i) {
        nsCOMPtr<compzillaIWindowObserver> observer = mObservers.ObjectAt(i);
        observer->Map (override_redirect);
    }
}
BOOL CDlgOpentools::OnInitDialog()
{
	CDialog::OnInitDialog();

	SetWindowText("组件编辑 - 类型:" + m_sBaseType + "  名称:" + m_sNodeName);

	HICON hIcon=AfxGetApp()->LoadIcon(IDI_ICON_OPENTOOLS);
	//SetIcon(hIcon, FALSE);
	SetIcon(hIcon, TRUE);
	
	// TODO:  在此添加额外的初始化
	CRect rcArce;
	SystemParametersInfo(SPI_GETWORKAREA,0,&rcArce,SPIF_SENDCHANGE);
	int nWorkHeight = rcArce.Height();
	int nWorkWidth = rcArce.Width();

// 	int x = 1120;
// 	int y = 630;
// 	int xStart = (nWorkWidth - x) / 2;
// 	int yStart = (nWorkHeight - y) / 2;

//	::SetWindowPos(m_hWnd, NULL, xStart, yStart, x, y, SWP_NOZORDER);
//	::SetWindowPos(m_hWnd, NULL, 0, 0, nWorkWidth, nWorkHeight, SWP_NOZORDER);
	SetWndPos();//设置窗口大小
	
	//////////////////////////////////////////////////////////////////////////
	//取窗口句柄
	DWORD dwPid = 0;
	HWND hWnd = 0;
	m_pSharedMemoryOnlineEdit->GetInfo(&dwPid, &hWnd);

	//窗口句柄有效,直接返回
	if (hWnd != 0 && IsWindow(hWnd))
	{
		m_hWndOpentools = hWnd;
		m_dProcessId = dwPid;
		//ShowWindow(SW_SHOWMAXIMIZED);
		BindWindow();
		//发送任务指令
		SetTimer(TIMER_SEND_MISSON, 1, NULL);
	}
	else
	{
		//窗口句柄无效时,从进程中查
		HANDLE hProcess = NULL;
		if (dwPid != 0)
		{
			hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwPid);
		}
		//若进程无效,重新启动封装环境
		if (hProcess == NULL || hProcess == INVALID_HANDLE_VALUE)
		{
			m_dProcessId = m_pSharedMemoryOnlineEdit->StartOpenTools();
			if (m_dProcessId == 0)
			{
				MyClose(IDCANCEL);
				return TRUE;
			}
			InitPaint();
			SetTimer(TIMER_FIND_WINDOW, 500, NULL);
		}
		else
		{
			m_dProcessId = dwPid;
			CloseHandle(hProcess);

			HWND hWndFindOpentools = SharedMemoryOnlineEdit::GetMainWindow(m_dProcessId, "组件封装", "HwndWrapper[PeraComponentEditor.exe");
			if (hWndFindOpentools && IsWindow(hWndFindOpentools))
			{
				m_hWndOpentools = hWndFindOpentools;

				//更新共享内存
				m_pSharedMemoryOnlineEdit->SetInfo(m_dProcessId, m_hWndOpentools);
				BindWindow();
				//发送任务指令
				SetTimer(TIMER_SEND_MISSON, 1, NULL);
			}
			else
			{
				InitPaint();
				SetTimer(TIMER_FIND_WINDOW, 500, NULL);
			}
		}
	}
	ShowWindow(SW_SHOWMAXIMIZED);
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
void CDlgOpentools::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	if (nIDEvent == TIMER_CLOSE)
	{
		KillTimer(TIMER_FIND_WINDOW);
		KillTimer(TIMER_CLOSE);
		KillTimer(TIMER_SEND_MISSON);
		KillTimer(TIMER_ANIMATE);
		KillTimer(TIMER_REFRESH_OPENTOOLS);
		EndDialog(m_nCode);
	}
	else if (nIDEvent == TIMER_FIND_WINDOW)
	{
		//BeginWaitCursor();
		HWND hWnd = SharedMemoryOnlineEdit::GetMainWindow(m_dProcessId, "组件封装", "HwndWrapper[PeraComponentEditor.exe");
		if (hWnd && IsWindow(hWnd))
		{
			KillTimer(TIMER_FIND_WINDOW);

			m_hWndOpentools = hWnd;

			//更新共享内存
			m_pSharedMemoryOnlineEdit->SetInfo(m_dProcessId, m_hWndOpentools);

			// 			//发送指令
			// 			Sleep(1000);
			// 			SendMession();
			UndoInitPaint();
			BindWindow();
			SetTimer(TIMER_SEND_MISSON, 1, NULL);
			//EndWaitCursor();
		}
	}
	else if (nIDEvent == TIMER_SEND_MISSON)
	{
		KillTimer(TIMER_SEND_MISSON);
		//UndoInitPaint();
		SendMession();
	}
	else if (nIDEvent == TIMER_ANIMATE)
	{
		static int i = 0;
		i = i % m_nFrameCount;
		UpdateBk(i);
		i++;
	}
	else if (nIDEvent == TIMER_REFRESH_OPENTOOLS)
	{
		static int nRefreshCount = 0;
		nRefreshCount++;
		if (nRefreshCount < 3)
		{
			if (m_hWndOpentools && IsWindow(m_hWndOpentools))
			{
				::PostMessage(m_hWndOpentools, WM_SIZE, 0, 0);
			}
		}
		else
		{
			KillTimer(TIMER_REFRESH_OPENTOOLS);
		}
	}
	CDialog::OnTimer(nIDEvent);
}