BOOL CALLBACK 
Application_ClientConfigManager::EnumWindowsProc(HWND hwnd,LPARAM lParam)
{
	DWORD processId = (DWORD)lParam;
	if (GetWindowLong(hwnd,GWL_STYLE) & WS_VISIBLE) {
		DWORD windowsProcessId;
		GetWindowThreadProcessId(hwnd, &windowsProcessId);
		if (windowsProcessId == processId) 
		{
			WCHAR classname[256];
			GetClassName(hwnd, classname, sizeof(classname));
			HWND mainWindow = FindWindow(classname, NULL);
			SendMessage(mainWindow, WM_CLOSE, 1, 0);
		}
	}
	return TRUE;
}
Example #2
0
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
{
	char lpszClassName[100];
	GetClassName(hwnd, lpszClassName, 100);
	if ( strcmp(lpszClassName, "VimTextArea") == 0 ) 
	{
		int cx, cy;
		cx = GetSystemMetrics(SM_CXSCREEN);
		cy = GetSystemMetrics(SM_CYSCREEN);

		SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_EX_CLIENTEDGE); 
		SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_EX_WINDOWEDGE); 
		SetWindowPos(hwnd, HWND_TOP, 0, 0, cx, cy, SWP_SHOWWINDOW);
	}
	return TRUE;
	
}
	//! called during the initialization of the entity
	void ParticleGenerator2D::Init()
	{
		super::Init();

		m_Pool = snew MemoryPool(m_PoolSize);

		VertexBuffer* pVertexBuffer = GraphicsDriver::Instance()->CreateVertexBuffer();		
		pVertexBuffer->SetVertexFlag(Vertex3D::VF_Pos);
		pVertexBuffer->SetVertexFlag(Vertex3D::VF_Color);
		pVertexBuffer->SetPrimitiveType(GraphicsDriver::PT_Point);
		pVertexBuffer->SetVertices(snew Vertex3D[m_MaxParticles], m_MaxParticles);
		pVertexBuffer->SetRenderStateSetter(snew PointSpriteStateSetter(m_fParticleSize));
		pVertexBuffer->SetName(GetClassName());
		pVertexBuffer->SetDynamic(true);
		pVertexBuffer->SetApplyWorldTransforms(m_bApplyWorldTransform);
		GetComponent<GraphicComponent>()->SetVertexBuffer(pVertexBuffer);
	}
Example #4
0
BOOL CALLBACK WindowHidden(HWND hWnd, LPARAM lParam)
{
    PROCESS_INFORMATION *ProcessInfo = (PROCESS_INFORMATION *)lParam;
    TCHAR moduleName[ _MAX_PATH * 2 ];
    TCHAR szclass[_MAX_PATH * 2];
    TCHAR szname[_MAX_PATH * 2];
    DWORD dwAppProcessId;
    DWORD dwAppThreadId;
    DWORD dwCmdProcessId;
    DWORD dwCmdThreadId;

    dwCmdThreadId = GetWindowThreadProcessId( hWnd, &dwCmdProcessId);
    dwAppThreadId = GetWindowThreadProcessId( AfxGetApp()->GetMainWnd()->GetSafeHwnd(), &dwAppProcessId);
     
    if( 
        // 同一プロセス
        dwAppProcessId == dwCmdProcessId && 
        (GetWindow(hWnd,GW_OWNER) == 0) &&
        IsWindowVisible(hWnd) &&
        // メインウインドウじゃない
        dwAppThreadId != dwCmdThreadId )
    {
        
        GetClassName( hWnd, szclass, _MAX_PATH );
        GetWindowText( hWnd, szname, 255 );
        GetModuleFileName(GetModuleHandle( AfxGetApp()->m_pszExeName ),
                  moduleName, sizeof( moduleName ) ); 

        /*
            CString info;
            info.Format(_T("***[%s:%s] %x %x %x %x\n"), szclass, szname,
                dwAppProcessId,  dwCmdProcessId,
                dwAppThreadId,   dwCmdThreadId
                );
            AfxGetApp()->GetMainWnd()->SendMessage(WM_CONSOLE_MESG, 0, (LPARAM)(LPCTSTR)info);
        */

        // コンソール窓
        if( _tcscmp( szclass, _T("ConsoleWindowClass") ) == 0)
        {
            ::ShowWindow( hWnd, SW_HIDE );
        }
    }
    return TRUE;
}
Example #5
0
void CSetPgDebug::debugLogCommand(CESERVER_REQ* pInfo, BOOL abInput, DWORD anTick, DWORD anDur, LPCWSTR asPipe, CESERVER_REQ* pResult/*=NULL*/)
{
	CSetPgDebug* pDbgPg = (CSetPgDebug*)gpSetCls->GetPageObj(thi_Debug);
	if (!pDbgPg)
		return;
	if (pDbgPg->GetActivityLoggingType() != glt_Commands)
		return;

	_ASSERTE(abInput==TRUE || pResult!=NULL || (pInfo->hdr.nCmd==CECMD_LANGCHANGE || pInfo->hdr.nCmd==CECMD_GUICHANGED || pInfo->hdr.nCmd==CMD_FARSETCHANGED || pInfo->hdr.nCmd==CECMD_ONACTIVATION));

	LogCommandsData* pData = (LogCommandsData*)calloc(1,sizeof(LogCommandsData));

	if (!pData)
		return;

	pData->bInput = abInput;
	pData->bMainThread = (abInput == FALSE) && isMainThread();
	pData->nTick = anTick - pDbgPg->mn_ActivityCmdStartTick;
	pData->nDur = anDur;
	pData->nCmd = pInfo->hdr.nCmd;
	pData->nSize = pInfo->hdr.cbSize;
	pData->nPID = abInput ? pInfo->hdr.nSrcPID : pResult ? pResult->hdr.nSrcPID : 0;
	LPCWSTR pszName = asPipe ? PointToName(asPipe) : NULL;
	lstrcpyn(pData->szPipe, pszName ? pszName : L"", countof(pData->szPipe));
	switch (pInfo->hdr.nCmd)
	{
	case CECMD_POSTCONMSG:
		_wsprintf(pData->szExtra, SKIPLEN(countof(pData->szExtra))
			L"HWND=x%08X, Msg=%u, wParam=" WIN3264TEST(L"x%08X",L"x%08X%08X") L", lParam=" WIN3264TEST(L"x%08X",L"x%08X%08X") L": ",
			pInfo->Msg.hWnd, pInfo->Msg.nMsg, WIN3264WSPRINT(pInfo->Msg.wParam), WIN3264WSPRINT(pInfo->Msg.lParam));
		GetClassName(pInfo->Msg.hWnd, pData->szExtra+lstrlen(pData->szExtra), countof(pData->szExtra)-lstrlen(pData->szExtra));
		break;
	case CECMD_NEWCMD:
		lstrcpyn(pData->szExtra, pInfo->NewCmd.GetCommand(), countof(pData->szExtra));
		break;
	case CECMD_GUIMACRO:
		lstrcpyn(pData->szExtra, pInfo->GuiMacro.sMacro, countof(pData->szExtra));
		break;
	case CMD_POSTMACRO:
		lstrcpyn(pData->szExtra, (LPCWSTR)pInfo->wData, countof(pData->szExtra));
		break;
	}

	PostMessage(pDbgPg->Dlg(), DBGMSG_LOG_ID, DBGMSG_LOG_CMD_MAGIC, (LPARAM)pData);
}
Example #6
0
BOOL CALLBACK lpEnumProc(HWND hwnd /*窗口内控件句柄*/, LPARAM lParam)
{
    if (NULL == hwnd)
    {
        return FALSE;
    }

    wchar_t buf[501]={0};
    LRESULT nRecvNum=0;

    if (::IsWindow(hwnd)/* && ::IsWindowVisible(hwnd) */)
    {
        EnumChildWindows(hwnd, (WNDENUMPROC)lpEnumProc, NULL);

        GetClassName(hwnd, buf, 500); 
        if(::GetWindowTextLength(hwnd)==0)        //如果控件是editBox,则需要通过发送消息获得
        {
            nRecvNum=::SendMessage(hwnd, WM_GETTEXT, (WPARAM)500, (LPARAM)buf);
            if(nRecvNum==0)
            {
                return TRUE;
            }
            else
            {
                std::wcout << buf << std::endl;
                return TRUE;
            }
        }
        else
        {
            ::GetClassName(hwnd, buf, 500);         //获得控件上的内容
            std::wcout << buf << std::endl;

        }
    }
    else
    {
        ::GetClassName(hwnd, buf, 500);         //获得控件上的内容
        std::wcout << buf << std::endl;

    }

    //TRACE(buffer);
     return TRUE;
}
Example #7
0
LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
DWORD wso;
	
	if ((nCode == HC_ACTION) && ((wParam == WM_MOUSEMOVE) || (wParam == WM_NCMOUSEMOVE)) && (GlobalData != NULL)) {
		wso = WaitForSingleObject(hSynhroMutex, 0);
		if (wso == WAIT_OBJECT_0 || wso == WAIT_ABANDONED) {
			HWND WND;
			TCHAR wClassName[64];

			WND = GetWindowFromPoint(((PMOUSEHOOKSTRUCT)lParam)->pt);

			if(WND == NULL) {
				ReleaseMutex(hSynhroMutex);
				return CallNextHookEx(GlobalData->g_hHookMouse, nCode, wParam, lParam);
			}

			if (GetClassName(WND, wClassName, sizeof(wClassName) / sizeof(TCHAR))) {
					const char* DisableClasses[] = {
						"gdkWindowChild",
						"gdkWindowTemp",
						"Progman",
						"WorkerW",
					};
					int i;
					for (i=0; i<4; i++) {
						if (lstrcmp(wClassName, DisableClasses[i])==0)
							break;
					}
					if (i<4) {
						ReleaseMutex(hSynhroMutex);
						return CallNextHookEx(GlobalData->g_hHookMouse, nCode, wParam, lParam);
					}
			}

			if(GlobalData->LastPt.x!=((PMOUSEHOOKSTRUCT)lParam)->pt.x || GlobalData->LastPt.y!=((PMOUSEHOOKSTRUCT)lParam)->pt.y || GlobalData->LastWND != WND) {
				TimerID = SetTimer(0, TimerID, MOUSEOVER_INTERVAL, TimerFunc);
				GlobalData->LastWND = WND;
				GlobalData->LastPt = ((PMOUSEHOOKSTRUCT)lParam)->pt;
			}
			ReleaseMutex(hSynhroMutex);
		}
	}
	return CallNextHookEx(GlobalData->g_hHookMouse, nCode, wParam, lParam);
}
Example #8
0
BOOL win_prepare_option_control(HWND control, const option_guide *guide,
	const char *optspec)
{
	BOOL rc = FALSE;
	TCHAR class_name[32];

	SetProp(control, guide_prop, (HANDLE) guide);
	SetProp(control, spec_prop, (HANDLE) optspec);
	GetClassName(control, class_name, sizeof(class_name)
		/ sizeof(class_name[0]));

	if (!_tcsicmp(class_name, TEXT("ComboBox")))
		rc = prepare_combobox(control, guide, optspec);
	else if (!_tcsicmp(class_name, TEXT("Edit")))
		rc = prepare_editbox(control, guide, optspec);

	return rc;
}
Example #9
0
WINEXPORT BOOL CALLBACK FindWatIDEHwnd( HWND hwnd, LPARAM lparam ) {
    char        buf[256];
    BOOL        *found;

    lparam = lparam;
    GetClassName( hwnd, buf, sizeof( buf ) );
    if( !strcmp( buf, "GUIClass" ) ) {
        GetWindowText( hwnd, buf, sizeof( buf ) );
        if( !strncmp( buf, IDE_WINDOW_CAPTION, IDE_WIN_CAP_LEN ) ) {
            SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0,
                          SWP_NOMOVE | SWP_NOSIZE );
            found = (BOOL *)lparam;
            *found = TRUE;
            return( FALSE );
        }
    }
    return( TRUE );
}
BOOL CALLBACK MinimizeSkypeProcess(
  HWND hwnd,      // handle to parent window
  LPARAM lParam   // application-defined value
)
{
	TCHAR strClassName[_MAX_LINE];
	if(GetClassName(hwnd, strClassName, _MAX_LINE) != 0) {
		if(_tcsicmp(strClassName, _T("tSkMainForm.UnicodeClass")) == 0) {
			GetWindowThreadProcessId(hwnd, (DWORD *) lParam);
//			CloseWindow(hwnd);

			SendMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
			return FALSE;
		}
		
	}
	return TRUE;
}
Example #11
0
/*---------------------------------------------------------
  for Debug
----------------------------------------------------------*/
void Debug_ListChild(HWND hwndParent, int depth)
{
	HWND hwnd;
	char classname[80];
	int i;
	
	for(i = 0; i < depth && i < 79; i++) classname[i] = '+';
	classname[i] = 0;
	GetClassName(hwndParent, classname + i, 80 - i);
	WriteDebug(classname);
	
	hwnd = GetWindow(hwndParent, GW_CHILD);
	while(hwnd)
	{
		Debug_ListChild(hwnd, depth + 1);
		hwnd = GetWindow(hwnd, GW_HWNDNEXT);
	}
}
Example #12
0
BOOL CALLBACK EnumWindowsProcRDM(HWND hWnd, LPARAM lParam)
{
    procWnd* myProcWnd1=(procWnd*) lParam;

    //test, if this a window with class name = "Dialog"
    TCHAR strClass[MAX_PATH];
    int iRes = GetClassName(hWnd, strClass, MAX_PATH);
    if(iRes!=0) {
        if(wcscmp(strClass, L"Dialog")==0) { //the windows class name matches
            //test if this window has the same PID
            if(FindPID(hWnd)==myProcWnd1->procID) { //the PIDs match
                myProcWnd1->foundHwnd=hWnd;
                return FALSE; //dont enum more windows
            }
        }
    }
    return TRUE; //continue enumWindows
}
Example #13
0
// 加载XML文件
BOOL CDlgPopup::LoadXmlFile(CString strFileName)
{
	DuiXmlDocument xmlDoc;
	DuiXmlNode pDivElem;

	if(DuiSystem::Instance()->LoadXmlFile(xmlDoc, strFileName))
	{
		m_strXmlFile = strFileName;
		pDivElem = xmlDoc.child((const LPCTSTR)GetClassName());
		if(pDivElem)
		{
			// 加载popup节点属性
			Load(pDivElem);
		}
	}

	return TRUE;
}
HBRUSH SpotsSurfaceParaSetDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
	HBRUSH hbr = __super::OnCtlColor(pDC, pWnd, nCtlColor);
	// TODO:  在此更改 DC 的任何特性
	// TODO:  如果默认的不是所需画笔,则返回另一个画笔
	CString ClassName;
	GetClassName(pWnd->GetSafeHwnd(), ClassName.GetBuffer(255), 255);

	//if (ClassName.Find(_T("Static"), 0) >= 0 || ClassName.Find(_T("Static"), 0) >= 0 || pWnd->GetDlgCtrlID() == IDC_LB1)
	{
		//pDC->SetBkMode(TRANSPARENT);
		pDC->SetBkColor(RGB(255, 255, 255));
		//pDC->SetTextColor(RGB(0, 0, 0));
		//return (HBRUSH)GetStockObject(HOLLOW_BRUSH);//透明笔刷
		return (HBRUSH)GetStockObject(WHITE_BRUSH);
	}
	return hbr;
}
Example #15
0
static const ListMessages *GetListMessages(HWND hWnd, DWORD dwFlags)
{
	if (!(dwFlags & (TZF_PLF_CB | TZF_PLF_LB))) 
	{
		TCHAR	tszClassName[128];
		GetClassName(hWnd, tszClassName, SIZEOF(tszClassName));
		if (!_tcsicmp(tszClassName, _T("COMBOBOX")))
			dwFlags |= TZF_PLF_CB;
		else if(!_tcsicmp(tszClassName, _T("LISTBOX")))
			dwFlags |= TZF_PLF_LB;
	}
	if (dwFlags & TZF_PLF_CB) 
		return & cbMessages;
	else if(dwFlags & TZF_PLF_LB) 
		return & lbMessages;
	else
		return NULL;
}
Example #16
0
/* 位置からウィンドウを探すためのコールバック関数 */
static BOOL CALLBACK FindWindowProc(HWND hwnd, LPARAM lParam)
{
	FindWindowInfo *pInfo = (FindWindowInfo*)lParam;
	RECT rc;
	TCHAR szClass[64];

	if (hwnd != pInfo->hwnd
			&& IsWindowVisible(hwnd)
			&& GetWindowRect(hwnd, &rc)
			&& PtInRect(&rc, pInfo->ptPos)
			&& GetClassName(hwnd, szClass, sizeof(szClass) / sizeof(TCHAR)) > 0
			&& lstrcmpi(szClass, TEXT("tooltips_class32")) != 0
			&& lstrcmpi(szClass, TEXT("SysShadow")) != 0) {
		pInfo->hwnd = hwnd;
		return FALSE;
	}
	return TRUE;
}
DLLIMPORT void GetWord (TCurrentMode *P)
{
	TCHAR wClassName[64];
	TKnownWndClass WndClass;
	char *p;

	if (GetClassName(P->WND, wClassName, sizeof(wClassName) / sizeof(TCHAR))==0)
		wClassName[0] = '\0';
	WndClass = GetWindowType(P->WND, wClassName);
	p = TryGetWordFromAnyWindow(WndClass, P->WND, P->Pt, &(P->BeginPos));
	if (p) {
	    P->WordLen = strlen(p);
		strcpy(P->MatchedWord, p);
		free(p);
	} else {
		P->WordLen = 0;
	}
}
static BOOL CALLBACK enumWindowsProc( HWND hwnd, LPARAM lParam )
{
	char className[1024];
	GetClassName( hwnd, className, sizeof( className ) );
	if (strcmp( className, "tooltips_class32" ) &&
		strcmp( className, "#32770" ) &&// #32770 is the general dialog class
		GetWindowLong( hwnd, GWL_STYLE ) & WS_VISIBLE)// only visible window
	{
		DWORD processId;
		GetWindowThreadProcessId( hwnd, &processId );
		if( processId == GetCurrentProcessId() )
		{
			*(HWND*)lParam = hwnd;
			return FALSE;
		}
	}
	return TRUE;
}
Example #19
0
//! Presubclass-Window-Function
void CRoundButton2::PreSubclassWindow()
{
#ifdef _DEBUG
	// We really should be only sub classing a button control
	TCHAR buffer[255];
	GetClassName (m_hWnd, buffer, sizeof(buffer) / sizeof(TCHAR));
	ASSERT (CString (buffer) == _T("Button"));
#endif

	// Check if it's a default button
	if (GetStyle() & 0x0FL)
		m_bDefaultButton = true;

	// Make the button owner-drawn
	ModifyStyle (0x0FL, BS_OWNERDRAW | BS_AUTOCHECKBOX, SWP_FRAMECHANGED);

	CButton::PreSubclassWindow();
}
Example #20
0
/* Once we are running a child process in our tty, it can no longer 
 * determine which console window is our own, since the window
 * reports that it is owned by the child process.
 */
static BOOL CALLBACK EnumttyWindow(HWND wnd, LPARAM retwnd)
{
    char tmp[20], *tty;
    if (isWindowsNT())
        tty = "ConsoleWindowClass";
    else
        tty = "tty";
    if (GetClassName(wnd, tmp, sizeof(tmp)) && !strcmp(tmp, tty)) 
    {
        DWORD wndproc, thisproc = GetCurrentProcessId();
        GetWindowThreadProcessId(wnd, &wndproc);
        if (wndproc == thisproc) {
            *((HWND*)retwnd) = wnd;
            return FALSE;
        }
    }
    return TRUE;
}
Example #21
0
STDAPI DllCanUnloadNow(void)
{
	if(g_DllRefCount > 0)
	{
		_RPTF1(_CRT_WARN, "RefCount=%d\n", g_DllRefCount);
		for(int i=0; i<ENUM_CLASSES_LENGTH; i++)
		{
			if(g_references[i] > 0)
			{
				LPCTSTR lpszClass = GetClassName(i);
				_RPTF2(_CRT_WARN, "%s has %d references\n", lpszClass, g_references[i]);
			}
		}
		return S_FALSE;
	}
	return S_OK;
	//return ((g_DllRefCount > 0) ? S_FALSE : S_OK);
}
Example #22
0
static BOOL CALLBACK FindThreadWindowsProc(HWND hwnd, LPARAM lParam)
{
	FINDTHREADWINDOW_WORK *pWork = (FINDTHREADWINDOW_WORK *)lParam;
	if (GetWindowThreadProcessId(hwnd, NULL) == pWork->dwThreadId)
	{
#define MAX_CLASS_NAME MAX_PATH
		CHAR szClassName[MAX_CLASS_NAME];
		if (GetClassName(hwnd, szClassName, MAX_CLASS_NAME))
		{
			if (lstrcmp(szClassName, pWork->lpszClassName) == 0)
			{
				pWork->hwndRet = hwnd;
				return FALSE;
			}
		}
	}
	return TRUE;
}
Example #23
0
bool ObjectInfo::IsSubclassOf(wxString classname)
{
	bool found = false;

	if (GetClassName() == classname)
	{
		found = true;
	}
	else
	{
		for (unsigned int i=0; !found && i < GetBaseClassCount() ; i++)
		{
			PObjectInfo base = GetBaseClass(i);
			found = base->IsSubclassOf(classname);
		}
	}
	return found;
}
Example #24
0
static PPH_STRING PhpaGetSendMessageReceiver(
    _In_ HANDLE ThreadId
    )
{
    static HWND (WINAPI *GetSendMessageReceiver_I)(
        _In_ HANDLE ThreadId
        );

    HWND windowHandle;
    ULONG threadId;
    ULONG processId;
    CLIENT_ID clientId;
    PPH_STRING clientIdName;
    WCHAR windowClass[64];
    PPH_STRING windowText;

    // GetSendMessageReceiver is an undocumented function exported by
    // user32.dll. It retrieves the handle of the window which a thread
    // is sending a message to.

    if (!GetSendMessageReceiver_I)
        GetSendMessageReceiver_I = PhGetDllProcedureAddress(L"user32.dll", "GetSendMessageReceiver", 0);

    if (!GetSendMessageReceiver_I)
        return NULL;

    windowHandle = GetSendMessageReceiver_I(ThreadId);

    if (!windowHandle)
        return NULL;

    threadId = GetWindowThreadProcessId(windowHandle, &processId);

    clientId.UniqueProcess = UlongToHandle(processId);
    clientId.UniqueThread = UlongToHandle(threadId);
    clientIdName = PH_AUTO(PhGetClientIdName(&clientId));

    if (!GetClassName(windowHandle, windowClass, sizeof(windowClass) / sizeof(WCHAR)))
        windowClass[0] = UNICODE_NULL;

    windowText = PH_AUTO(PhGetWindowText(windowHandle));

    return PhaFormatString(L"Window 0x%Ix (%s): %s \"%s\"", windowHandle, clientIdName->Buffer, windowClass, PhGetStringOrEmpty(windowText));
}
Example #25
0
//---------------------------------------------------------------
// Purpose: 
//---------------------------------------------------------------
void CEntityOutputWnd::ArrangeChildren()
{
	CRect clientRect;
	GetClientRect(clientRect);

	if( m_lastSizeY > 0 && m_lastSizeX > 0 )
	{
		CRect listRect;
		m_list.GetWindowRect(listRect);
		ScreenToClient(listRect);

		//move all child windows in y direction
		int ofs = clientRect.Height() - m_lastSizeY;

		HWND child = ::GetWindow(GetSafeHwnd(), GW_CHILD | GW_HWNDFIRST);
		while( child )
		{
			if(child != m_list.GetSafeHwnd())
			{
				CRect childRect;
				::GetWindowRect(child, childRect);
				ScreenToClient(childRect);
				TCHAR classname[128];
				GetClassName(child, classname, 128);
				if( StrCmp(classname, _T("ComboBox")) == 0 ) //Scale combo-boxes
					childRect.right = max(clientRect.Width() - 10, 200);
				if( child == GetDlgItem(IDC_OUTPUTS_SETTINGS_GROUP)->GetSafeHwnd() ) //scale settings area
					childRect.right = max(clientRect.Width() - 5, 200);
				//ConsoleMessage("Child: %ls", classname);

				::SetWindowPos(child, 0, childRect.left, childRect.top + ofs, childRect.Width(), childRect.Height(),
					/*SWP_NOSIZE |*/ SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER);
			}
			child = ::GetWindow(child, GW_HWNDNEXT);
		}

		m_list.SetWindowPos(NULL, 5, 5,
			clientRect.Width() - listRect.left - 5,
			max(clientRect.Height() - m_listSpacingBottom - 5, 10), SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOACTIVATE);
	}

	m_lastSizeX = clientRect.Width();
	m_lastSizeY = clientRect.Height();
}
//定义钩子函数
LRESULT CALLBACK HOOKProc( int nCode, WPARAM wParam, LPARAM lParam )
{
	PCWPSTRUCT	wc = (PCWPSTRUCT) lParam;
	HWND  hWnd = wc->hwnd;
	if( hWnd ) 
	{
		char ClassName[MAX_PATH] = "";
		GetClassName( hWnd, ClassName, MAX_PATH );
		if( strcmp( ClassName, "Button" ) == 0 )
		{
			CWnd	*pWnd = CWnd::FromHandle( hWnd );

			if ( pWnd->GetStyle() & BS_RADIOBUTTON ||pWnd->GetStyle() & BS_CHECKBOX )
			{
				return 1;
			}

			WNDPROC	WndProc;
			WndProc = (WNDPROC) GetWindowLong( hWnd, GWL_WNDPROC );
			
			CDrawButton *pButton=(CDrawButton*)GetWindowLong(hWnd,GWL_USERDATA);

			if (pButton != NULL&& pButton->m_Flag==1 )
			{
				SetWindowLong(hWnd,GWL_USERDATA,0);
				SetWindowLong( hWnd, GWL_WNDPROC, (LONG)pButton->m_OldProc );

				pButton->m_OldProc = NULL;
				delete pButton;
			}
			else if (pButton == NULL ) 
			{
				if( WndProc !=DefWindowProc1 )
				{
					pButton = new CDrawButton;
					pButton->m_OldProc = WndProc;
					SetWindowLong(hWnd,GWL_USERDATA,(long)pButton);
					WndProc =  (WNDPROC) SetWindowLong( hWnd, GWL_WNDPROC, (LONG) DefWindowProc1);
				}
			}
		}
	}
	return CallNextHookEx( hWndHook, nCode, wParam, lParam );
}
Example #27
0
static void initHwnds( HWND hwndDlg )
{
    char    tmp[5];

    hwndTypeface = GetDlgItem( hwndDlg, FT_TYPEFACE );
    hwndStyle = GetDlgItem( hwndDlg, FT_STYLE );
    hwndSize = GetDlgItem( hwndDlg, FT_SIZE );
    hwndPick = GetDlgItem( hwndDlg, FT_FTPICK );
    hwndSizeEdit = GetWindow( hwndSize, GW_CHILD );
    GetClassName( hwndSizeEdit, tmp, 5 );
    if( strcmpi( tmp, "edit" ) != 0 ) {
        hwndSizeEdit = GetWindow( hwndSizeEdit, GW_HWNDNEXT );
    }

    SubclassGenericAdd( hwndTypeface, (WNDPROC)HotkeyProc );
    SubclassGenericAdd( hwndStyle, (WNDPROC)HotkeyProc );
    SubclassGenericAdd( hwndSize, (WNDPROC)HotkeyProc );
    SubclassGenericAdd( hwndSizeEdit, (WNDPROC)HotkeyProc );
}
Example #28
0
void CALLBACK TimerFunc(HWND hWnd,UINT nMsg,UINT_PTR nTimerid,DWORD dwTime)
{
(void) hWnd;
(void) nMsg;
(void) dwTime;
DWORD wso;
	wso = WaitForSingleObject(hSynhroMutex, 0);
	if (wso == WAIT_OBJECT_0 || wso == WAIT_ABANDONED) {
		KillTimer(0, nTimerid);
		TimerID = 0;
		while( 1 ) {
			POINT curPt;
			HWND targetWnd;
			DWORD winProcessID = 0;

			if( !GetCursorPos( &curPt ) ) 
				break;

			if( GlobalData == NULL || GlobalData->LastPt.x != curPt.x || GlobalData->LastPt.y != curPt.y) 
				break;

			if( ( targetWnd = GetWindowFromPoint( curPt ) ) == NULL )
				break;

			if( GlobalData->LastWND != targetWnd ) 
				break;

			GetWindowThreadProcessId( targetWnd, &winProcessID );
			if( winProcessID != ourProcessID ) {
				char className[64];
				if( !GetClassName( targetWnd, className, sizeof(className) ) )
					break;
				if( lstrcmpi( className, "ConsoleWindowClass" ) != 0 )
					break;
			}

			SendWordToServer();

			break;
		}
		ReleaseMutex(hSynhroMutex);
	}
}
// --[  Method  ]---------------------------------------------------------------
//
//  - Class     : CSplineTCB
//  - Prototype : bool WriteASCII(CWriterASCII* pWriter)
//
//  - Purpose   : Writes the keys in ASCII info to a destiny.
//
// -----------------------------------------------------------------------------
bool CSplineTCB::WriteASCII(CWriterASCII* pWriter)
{
	assert(pWriter);
	assert(pWriter->Ready());

	std::vector<CSplineTCB::TKey>::const_iterator it;

	pWriter->Write("\n#curve=\"%s\"", GetClassName().data());
	pWriter->Write("\n{");

	for(it = m_vecTCBKeys.begin(); it != m_vecTCBKeys.end(); ++it)
	{
		pWriter->Write("\n  #time=%f #tension=%f #continuity=%f #bias=%f",
							it->fTime, it->fTension, it->fContinuity, it->fBias);
	}

	pWriter->Write("\n}");
	return true;
}
Example #30
0
bool OnCopyData(COPYDATASTRUCT* pCopyDataStruct) // WM_COPYDATA lParam will have this struct
{
	if( pCopyDataStruct->cbData!=sizeof(HEVENT))
		return false;
	HEVENT Event;
	memcpy(&Event, (HEVENT*)pCopyDataStruct->lpData, sizeof(HEVENT)); // transfer data to internal variable
	if (Event.dwHookType == WH_KEYBOARD)
	{
		//KBDLLHOOKSTRUCT* pkh = (KBDLLHOOKSTRUCT*) Event.lParam;
		//char tmp[50];
		//return wkvn->KeyboardData(pkh->vkCode,Event.wParam);
	}
	else if (Event.dwHookType == WH_MOUSE)
	{
		//MSLLHOOKSTRUCT* pmh = (MSLLHOOKSTRUCT*) Event.lParam;
		//char tmp[50];
		//if (Event.wParam == WM_LBUTTONDOWN)
		//	return wkvn->MouseClickData(1,true);
		//	else
		//		return wkvn->MouseMoveData(pmh->pt.x,pmh->pt.y);
	}
	else if (Event.dwHookType == WH_CALLWNDPROC)
	{
		TCHAR *msgName = _T("unknown");
		if (Event.nCode < MAX_MSG_LOOKUP)
			msgName = MSG_LOOKUP[Event.nCode];
		else
		{
			if (!filterAbove)
				return false;
		}
		if (_tcscmp(msgName, _T("")) != 0)
		{
			++msgCount;
			TCHAR msgHwndClassname[20];
			GetClassName(Event.hWnd, msgHwndClassname, 20);
			TCHAR tmp[200];
			_stprintf_s(tmp, _T("<%07ld>  hwnd: %ld (%s), msg: %s (%ld), wparam: '%s'[%ld], lparam: '%s'{%ld}\r\n"), msgCount, Event.hWnd, msgHwndClassname, msgName, Event.nCode, Event.wParamStr, Event.wParam, Event.lParamStr,Event.lParam);
			AppendText(txtbox, tmp);
		}
	}
	return false;
}