Exemplo n.º 1
0
HWND FindTrayWnd()
{
		HWND hTrayWnd = FindWindow(L"Shell_TrayWnd", NULL);
		hTrayWnd = FindWindowEx(hTrayWnd, 0, L"TrayNotifyWnd", NULL);
 		HWND hwndTmp;	
		hwndTmp = ::FindWindowEx(hTrayWnd, 0, L"SysPager", NULL);
		if(!hwndTmp)
			hTrayWnd=::FindWindowEx(hTrayWnd,0,L"ToolbarWindow32",NULL);
		else
			hTrayWnd=::FindWindowEx(hwndTmp,0,L"ToolbarWindow32",NULL);




		return hTrayWnd;
}
Exemplo n.º 2
0
HWND FindVisibleWindow(CTSTR lpClass, CTSTR lpTitle)
{
    HWND hwndNext = nullptr;
    HWND hwnd = nullptr;

    do
    {
        hwnd = FindWindowEx(NULL, hwndNext, lpClass, lpTitle);
        if (hwnd && IsWindowVisible(hwnd))
            break;

        hwndNext = hwnd;
    } while (hwnd != nullptr);

    return hwnd;
}
Exemplo n.º 3
0
void CPostMsgData::Work()
{
	std::vector<HWND> vhWnd;
	HWND hWnd = FindWindow(NULL,L"{C3CE0473-57F7-4a0a-9CF4-C1ECB8A3C514}_dsmainmsg_ie");
	UINT uCnt = 0;
	while (hWnd != NULL)
	{
		uCnt++;
		::PostMessage(hWnd,m_uMsg,m_wParam,m_lParam);
		hWnd = FindWindowEx(HWND_MESSAGE, hWnd, NULL,L"{C3CE0473-57F7-4a0a-9CF4-C1ECB8A3C514}_dsmainmsg_ie");
	}
	if (m_lRef != LUA_REFNIL)
	{
		g_wndMsg.PostMessage(WM_POSTWNDMSG, uCnt, (LPARAM) this);
	}
}
Exemplo n.º 4
0
HWND CFrame::aigisHwnd()
{
	HWND hChrome = chromeHwnd();
	if (!hChrome)
	{
		return nullptr;
	}

	HWND hFrame = FindWindowEx(hChrome, 0, _T("Chrome_RenderWidgetHostHWND"), _T("Chrome Legacy Window"));
	if (!hFrame)
	{
		return nullptr;
	}

	return hFrame;
}
Exemplo n.º 5
0
static void vboxTrayRemoveTrayIcon()
{
    if (gNotifyIconData.cbSize > 0)
    {
        /* Remove the system tray icon and refresh system tray. */
        Shell_NotifyIcon(NIM_DELETE, &gNotifyIconData);
        HWND hTrayWnd = FindWindow("Shell_TrayWnd", NULL); /* We assume we only have one tray atm. */
        if (hTrayWnd)
        {
            HWND hTrayNotifyWnd = FindWindowEx(hTrayWnd, 0, "TrayNotifyWnd", NULL);
            if (hTrayNotifyWnd)
                SendMessage(hTrayNotifyWnd, WM_PAINT, 0, NULL);
        }
        RT_ZERO(gNotifyIconData);
    }
}
Exemplo n.º 6
0
BOOL vmsOeWindows::Initialize()
{
	
	m_hwndMain = FindWindow ("Outlook Express Browser Class", NULL);	
	if (m_hwndMain == NULL)
		return FALSE;
	

	
	m_hwndRebar = FindWindowEx (m_hwndMain, NULL, "SizableRebar", NULL);
	if (m_hwndRebar)
		m_hwndRebar = FindWindowEx (m_hwndRebar, NULL, "ReBarWindow32", NULL);
	

	
	m_hwndMessageList = FindWindowEx (m_hwndMain, NULL, "Outlook Express Message View", NULL);

	if (m_hwndMessageList)
		m_hwndMessageList = FindWindowEx (m_hwndMessageList, NULL, "Outlook Express Message List", NULL);

	if (m_hwndMessageList)
		m_hwndMessageList = FindWindowEx (m_hwndMessageList, NULL, "ATL:SysListView32", NULL);
	

	
	HWND m_hwndFoldersList = FindWindowEx (m_hwndMain, NULL, "Outlook Express Navigation Pane", NULL);

	if (m_hwndFoldersList)
		m_hwndFoldersList = FindWindowEx (m_hwndFoldersList, NULL, "Outlook Express Pane Frame", NULL);

	if (m_hwndFoldersList)
		m_hwndFoldersList = FindWindowEx (m_hwndFoldersList, NULL, "ThorTreeViewWndClass", NULL);

	if (m_hwndFoldersList)
		m_hwndFoldersList = FindWindowEx (m_hwndFoldersList, NULL, "SysTreeView32", NULL);
	

	return TRUE;
}
/*********************************************************************
*
*       _WndProcMain
*/
static LRESULT CALLBACK _WndProcMain(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
  HWND hWndStatus;
  SIM_GUI_HandleKeyEvents(message, wParam);
  switch (message) {
  case WM_SIZE:
    hWndStatus = FindWindowEx(hWnd, NULL, STATUSCLASSNAME, NULL);
    if (hWndStatus) {
      _SetParts(hWndStatus);
      SendMessage(hWndStatus, message, wParam, lParam);
    }
    break;
  case WM_DESTROY:
    PostQuitMessage(0);
    break;
  }
  return DefWindowProc(hWnd, message, wParam, lParam);
}
Exemplo n.º 8
0
int __stdcall COpenDirHelper::BrowseCallbackProcDIR(HWND  hwnd,UINT  uMsg,LPARAM  lParam,LPARAM  lpData)
{
	HWND checkbox;

	//Initialization callback message
	if(uMsg==BFFM_INITIALIZED) {
		SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)(LPCTSTR)strLastOpenDir);

		RECT ListViewRect;
		RECT Dialog;
		RECT ClientArea;
		RECT ButtonRect;

		checkbox = CreateWindowEx(0, _T("BUTTON"), ResStr(IDS_MAINFRM_DIR_CHECK),
								  WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | BS_AUTOCHECKBOX | BS_MULTILINE, 0, 100, 100,
								  50, hwnd, 0, AfxGetApp()->m_hInstance, NULL);

		HWND ListView=FindWindowEx(hwnd,NULL,_T("SysTreeView32"),NULL);

		HWND id_ok = GetDlgItem(hwnd, IDOK);
		HWND id_cancel = GetDlgItem(hwnd, IDCANCEL);

		GetWindowRect(hwnd,&Dialog);
		MoveWindow(hwnd, Dialog.left, Dialog.top, Dialog.right-Dialog.left+50, Dialog.bottom-Dialog.top+70, TRUE);
		GetWindowRect(hwnd,&Dialog);

		GetClientRect(hwnd,&ClientArea);

		GetWindowRect(ListView,&ListViewRect);
		MoveWindow(ListView, ListViewRect.left-Dialog.left-3, ListViewRect.top-Dialog.top-55, ListViewRect.right-ListViewRect.left+49, ListViewRect.bottom-ListViewRect.top+115, TRUE);
		GetWindowRect(ListView,&ListViewRect);

		GetWindowRect(id_ok,&ButtonRect);
		MoveWindow(id_ok, ButtonRect.left-Dialog.left+49, ButtonRect.top-Dialog.top+50, ButtonRect.right-ButtonRect.left, ButtonRect.bottom-ButtonRect.top, TRUE);

		GetWindowRect(id_cancel,&ButtonRect);
		MoveWindow(id_cancel, ButtonRect.left-Dialog.left+49, ButtonRect.top-Dialog.top+50, ButtonRect.right-ButtonRect.left, ButtonRect.bottom-ButtonRect.top, TRUE);

		SetWindowPos(checkbox, HWND_BOTTOM, (ListViewRect.left-Dialog.left-3), ClientArea.bottom - 35, 120, 27, SWP_SHOWWINDOW);
		SetFont(checkbox,_T("Tahoma"),13);

		CBProc = (WNDPROC) SetWindowLongPtr(checkbox, GWLP_WNDPROC, (LONG_PTR) CheckBoxSubclassProc);
		SendMessage(checkbox,BM_SETCHECK,(WPARAM)m_incl_subdir,0);
	}
	return 0;
}
Exemplo n.º 9
0
void AlreadyRun(void)
{
	HWND	FirsthWnd, FirstChildhWnd;

	if((FirsthWnd = FindWindowEx(NULL, NULL, szWindowClass, NULL )) != NULL)
	{
		FirstChildhWnd = GetLastActivePopup(FirsthWnd);
		SetForegroundWindow(FirsthWnd);
	
		if(FirsthWnd != FirstChildhWnd)
		{
			SetForegroundWindow(FirstChildhWnd);
		}
		
		ShowWindow(FirsthWnd, SW_SHOWNORMAL);
	}
}
Exemplo n.º 10
0
// Paul Brannan 8/7/98
// This code is from Michael 'Hacker' Krelin (author of KINSole)
// (slightly modified)
HWND TelnetGetConsoleWindow() {
	DWORD pid = GetCurrentProcessId(), wpid;
	char title[512], *t = title;
	HWND hrv = NULL;

#ifndef __BORLANDC__	// Ioannou Dec. 8, 1998
	if(!GetConsoleTitle(title, sizeof(title))) t = NULL;

	for(;;) {
		if((hrv = FindWindowEx(NULL, hrv, "tty", t)) == NULL) break;
		if(!GetWindowThreadProcessId(hrv, &wpid)) continue;
		if(wpid == pid) return hrv;
	}
#endif

	return GetForegroundWindow();
}
Exemplo n.º 11
0
void clickChildButton (HWND dialog, const char *caption) {
    HWND dialogItem = NULL;
    while (1) {
        dialogItem = FindWindowEx(dialog, dialogItem, NULL, NULL);
        if (dialogItem == NULL) {
            break;
        }
        char windowText[255];
        GetWindowText(dialogItem, windowText, 255);
        printf("found subitem: %s\n", windowText);
        if (strcmp(windowText, caption) == 0) {
            SetActiveWindow(dialog);
            SendMessage(dialogItem, BM_CLICK, NULL, NULL);
            break;
        }
    }
}
Exemplo n.º 12
0
static HWND FindTopWindow(HWND hParent, LPCWSTR sClass)
{
	HWND hLast = NULL;
	HWND hFind = NULL;
	int Coord = 99999;
	while ((hFind = FindWindowEx(hParent, hFind, sClass, NULL)) != NULL)
	{
		RECT rc; GetWindowRect(hFind, &rc);
		if ((hLast == NULL)
			|| (rc.top < Coord))
		{
			Coord = rc.top;
			hLast = hFind;
		}
	}
	return hLast;
}
Exemplo n.º 13
0
void vmsIeHelper::GetIeWindows(vector <HWND> &vWnds)
{
	HWND hwnd = NULL;
	DWORD dwCPID = GetCurrentProcessId ();
	
	do
	{
		hwnd = FindWindowEx (NULL, hwnd, _T ("IEFrame"), NULL);
		if (hwnd)
		{
			DWORD dwPID = 0;
			GetWindowThreadProcessId (hwnd, &dwPID);
			if (dwPID == dwCPID)
				vWnds.push_back (hwnd);
		}
	}
	while (hwnd != NULL);
}
Exemplo n.º 14
0
int vmsIeHelper::GetTabCount(HWND hwndIeWindow)
{
	HWND hwnd = NULL;
	int cTabs = 0;

	do 
	{
		hwnd = FindWindowEx (hwndIeWindow, hwnd, _T ("Frame Tab"), NULL);
		if (hwnd)
			cTabs++;
	} 
	while (hwnd != NULL);

	if (!cTabs)
		cTabs = 1;

	return cTabs;
}
Exemplo n.º 15
0
UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	OpenFileSubclassData *data= (OpenFileSubclassData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);

	switch(msg) {
	case WM_INITDIALOG:
		{
			OPENFILENAME *ofn = (OPENFILENAME *)lParam;

			data = (OpenFileSubclassData *) malloc(sizeof(OpenFileSubclassData));
			SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
			data->locking_request = (BYTE *)ofn->lCustData;
			data->setView = TRUE;

			TranslateDialogDefault(hwnd);
			CheckDlgButton(hwnd, IDC_PROTECTAVATAR, *(data->locking_request));
		}
		break;

	case WM_COMMAND:
		if (LOWORD(wParam) == IDC_PROTECTAVATAR)
			*(data->locking_request) = IsDlgButtonChecked(hwnd, IDC_PROTECTAVATAR) ? TRUE : FALSE;
		break;

	case WM_NOTIFY:
		if (data->setView) {
			HWND hwndParent = GetParent(hwnd);
			HWND hwndLv = FindWindowEx(hwndParent, NULL, _T("SHELLDLL_DefView"), NULL) ;
			if (hwndLv != NULL) {
				SendMessage(hwndLv, WM_COMMAND, SHVIEW_THUMBNAIL, 0);
				data->setView = FALSE;
			}
		}
		break;

	case WM_NCDESTROY:
		free((OpenFileSubclassData *)data);
		SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)0);
		break;
	}

	return FALSE;
}
//---------------------------------------------------------------------------
DWORD WINAPI ExitWhile(LPVOID lpParameter)  //
{
    do
    {
        HWND    hWnd = FindWindow(NULL ,"UIPOWER");// Form1
        if(hWnd!=NULL)
        {
            //ShowMessage("hWnd!=NULL");
            HWND    hChildWnd = FindWindowEx(hWnd ,NULL ,NULL ,"否(&N)");
            if(hChildWnd!=NULL)
            {
                PostMessage(hChildWnd ,WM_KEYDOWN ,(WPARAM)'N' ,NULL);
                break;
            }
        }
        Sleep(100);
    }
    while(true);
    return	1;
}
ExecutionProcess OpenOfficeAction::GetExecutingProcess()
{
	ExecutionProcess process;

	process = ActionExecution::GetExecutingProcess();

	if (process.IsEmpty() == false)
	{
		return process;
	}

	if (FindWindowEx(NULL, NULL, LISTENER_WINDOWCLASS, NULL) == NULL)
	{
		return ExecutionProcess();
	}
	else
	{
		return ExecutionProcess(KILLTRAY_MESSAGE, L"", true);
	}
}
Exemplo n.º 18
0
void Announcer::ToMessenger(wstring artist, wstring album, wstring title, BOOL show) {
  if (title.empty() && show) return;
  
  COPYDATASTRUCT cds;
  WCHAR buffer[256];

  wstring wstr = L"\\0Music\\0" + ToWstr(show) + L"\\0{1}\\0" + 
    artist + L"\\0" + title + L"\\0" + album + L"\\0\\0";
  wcscpy_s(buffer, 256, wstr.c_str());

  cds.dwData = 0x547;
  cds.lpData = &buffer;
  cds.cbData = (lstrlenW(buffer) * 2) + 2;

  HWND hMessenger = NULL;
  while (hMessenger = FindWindowEx(NULL, hMessenger, L"MsnMsgrUIManager", NULL)) {
    if (hMessenger > 0) {
      SendMessage(hMessenger, WM_COPYDATA, NULL, (LPARAM)&cds);
    }
  }
}
Exemplo n.º 19
0
DWORD WINAPI ThreadVentProc(LPVOID lpParam)
{
	hWndVent = NULL;
	while(1)
	{
		if(!IsWindow(hWndVent))
		{
			pKillVentHook();
			hWndVent = FindWindow(NULL, "Ventrilo");
			if(hWndVent != NULL)
			{
				threadID = GetWindowThreadProcessId(hWndVent, NULL);
				hWndXmit = FindWindowEx(hWndVent, NULL, "Static", "--XMIT--");
				if(threadID != NULL && hWndXmit != NULL)
					pSetVentHook(threadID, hWndXmit);
			}
		}
		Sleep(2000);
	}
	return 0;
}
Exemplo n.º 20
0
HWND GetTargetWindow()
{
#if 0
	HWND desktop = GetDesktopWindow();
	HWND testWindow = FindWindowEx(desktop, NULL, "InjectionTestWindow", "Injection Test Window");

	return testWindow;
#endif
#if 1
	HWND worker;
	HWND defView;
	HWND listView;

	if(!util::FindDesktopWindows(worker, defView, listView))
	{
		return NULL;
	}

	return listView;
#endif
}
Exemplo n.º 21
0
static HWND
html_find_ie_window(HWND win)
{
    static const TCHAR ie_wc[] = _T("Internet Explorer_Server");
    HWND w;

    w = FindWindowEx(win, NULL, ie_wc, NULL);
    if(w != NULL)
        return w;

    win = GetWindow(win, GW_CHILD);
    while(win != NULL) {
        w = html_find_ie_window(win);
        if(w != NULL)
            return w;

        win = GetWindow(win, GW_HWNDNEXT);
    }

    return NULL;
}
LPCTSTR SnarlInterface::GetAppPath()
{
	HWND hWnd = GetSnarlWindow();
	if (hWnd)
	{
		HWND hWndPath = FindWindowEx(hWnd, NULL, _T("static"), NULL);
		if (hWndPath)
		{
			TCHAR strTmp[MAX_PATH] = {0};
			int nReturn = GetWindowText(hWndPath, strTmp, MAX_PATH-1);
			if (nReturn > 0) {
				TCHAR* strReturn = AllocateString(nReturn + 1);
				_tcsncpy(strReturn, strTmp, nReturn + 1);
								strReturn[nReturn] = 0;
				return strReturn;
			}
		}
	}

	return NULL;
}
Exemplo n.º 23
0
int main( int argc, char **argv )
{
	int cmd = -1;
	HWND hwnd = NULL;
	
	
	print_license();
	printf( "\n" );
	
	if( argc < 2 )
		show_usage_and_exit();
	
	cmd = find_command( argv[ 1 ] );
	if( cmd == -1 )
		show_usage_and_exit();
	
	hwnd = FindWindowEx( NULL, NULL, "gdkWindowToplevel", "Workrave" );
	if( !hwnd )
	{
		printf( "Error: Workrave window not found!\n" );
		return 1;
	}
	
	printf( "Sending Workrave command %s...\n", command[ cmd ] );
	fflush( stdout );
	
	SetLastError( 0 );
	if( SendMessageTimeout( hwnd, WM_USER, cmd, 0, SMTO_BLOCK, 15000, NULL ) )
	{
		printf( "Command sent.\n" );
		return 0;
	}
	
	if( GetLastError() == ERROR_TIMEOUT )
		printf( "Error: SendMessageTimeout() timed out!\n" );
	else
		printf( "Error: SendMessageTimeout() failed!\n" );
	
	return 1;
}
Exemplo n.º 24
0
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow *npwin)
{
    InstanceData *data;

    if (!instance)
    {
        plogf("sp: NPP_SetWindow() errro: NPERR_INVALID_INSTANCE_ERROR");
        return NPERR_INVALID_INSTANCE_ERROR;
    }

    plogf("sp: NPP_SetWindow()");

    data = (InstanceData *)instance->pdata;
    if (!npwin)
    {
        data->npwin = NULL;
    }
    else if (data->npwin != npwin)
    {
        HWND hWnd = (HWND)npwin->window;
        
        data->npwin = npwin;
        SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
        SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)PluginWndProc);
    }
    else
    {
        // The plugin's window hasn't changed, just its size
        HWND hWnd = (HWND)npwin->window;
        HWND hChild = FindWindowEx(hWnd, NULL, NULL, NULL);
        
        if (hChild)
        {
            ClientRect rcClient(hWnd);
            MoveWindow(hChild, rcClient.x, rcClient.y, rcClient.dx, rcClient.dy, FALSE);
        }
    }
    
    return NPERR_NO_ERROR;
}
Exemplo n.º 25
0
int click_button(const char *window, const char *button)
{
    int message = 0;
    while (1) {
        HWND window_handle = FindWindow(NULL, window);
        if(window_handle == NULL) {
            if(message == 0) {
                printf("Error: Failed to find window '%s'.\n", window);
                message = 1;
            }
            Sleep(50);
            continue;
        }

        HWND button_handle = FindWindowEx(window_handle, NULL, NULL, button);
        if(button_handle == NULL) {
            if(message == 0) {
                printf("Error: failed to find window/button '%s' '%s'.\n",
                    window, button);
                message = 1;
            }
            Sleep(50);
            continue;
        }

        SetActiveWindow(window_handle);
        if(IsWindowEnabled(button_handle) != FALSE) {
            SendMessage(button_handle, BM_CLICK, 0, 0);
            break;
        }
        else {
            printf("Waiting: Button not enabled yet.\n");
            Sleep(50);
            continue;
        }
    }

    return 0;
}
Exemplo n.º 26
0
void 
CUpgradrHelperbar::CreateMainWindow()
{
	// Only create the window if it doesn't exist yet.
	if (m_MainWindow) return;

	HWND parent = GetParent();
	if (!parent) throw CUpgradrRuntimeError(LoadStringResource(IDS_ERROR_NOPARENTWINDOW));

	ATLASSERT(m_BrowserId!=NULL_BROWSER);
	m_MainWindow.SetBrowserId(m_BrowserId);
	m_MainWindow.SetDisplayMode(CHelperbarWindow::EDM_PINNED);
	m_MainWindow.Create(parent, rcDefault, HELPERBAR_WINDOW_NAME);

	// subclass toolbar
	HWND hToolbarWnd = FindWindowEx(m_hWnd, NULL, TOOLBARCLASSNAME, NULL);
	m_Toolbar.SubclassWindow(hToolbarWnd);

	// make our new button visible
	m_Toolbar.ModifyStyle(0, TBSTYLE_WRAPABLE);
	m_Toolbar.ResizeClient(20, 40);
}
Exemplo n.º 27
0
HRESULT CTaskBar::Taskbar_RegisterTab(HWND hBtn, LPVOID pVCon, BOOL abSetActive /*= FALSE*/)
{
	HRESULT hr, hr1;

	// mp_TaskBar1 may be NULL if NO task bar is created (e.g. 'explorer.exe' is closed)
	_ASSERTE(mp_TaskBar1!=NULL || FindWindowEx(NULL, NULL, L"Shell_TrayWnd", NULL)==NULL);

	Taskbar_GhostAppend(pVCon);

	// Tell the taskbar about this tab window
	if (mp_TaskBar3)
	{
		hr = mp_TaskBar3->RegisterTab(hBtn, ghWnd);
		hr1 = mp_TaskBar3->SetTabOrder(hBtn, NULL);
	}
	else if (mp_TaskBar1)
	{
		//ShowWindow(hBtn, SW_SHOWNA);
		hr = mp_TaskBar1->AddTab(hBtn);
	}
	else
	{
		hr = E_NOINTERFACE;
	}

	if (SUCCEEDED(hr) && abSetActive)
	{
		hr1 = Taskbar_SetActiveTab(hBtn);
	}

	if (SUCCEEDED(hr) && mp_TaskBar4)
	{
		hr1 = mp_TaskBar4->SetTabProperties(hBtn, STPF_NONE/*STPF_USEAPPTHUMBNAILWHENACTIVE|STPF_USEAPPPEEKWHENACTIVE*/);
	}

	Taskbar_GhostReorder();

	return hr;
}
Exemplo n.º 28
0
BOOL CALLBACK RefreshShellView( HWND hWnd, LPARAM lParam )
{
  if( hWnd ) 
  {
    TCHAR szClassName[MAX_PATH]={};
    DWORD dwLen=MAX_PATH;
    GetClassName(hWnd,szClassName,dwLen);
    if( (_tcscmp(szClassName,_T("ExploreWClass"))==0) || (_tcscmp(szClassName,_T("CabinetWClass"))==0) )
    {
      HWND hwndShellView = FindWindowEx(hWnd,NULL,_T("NSFViewClass"),NULL);
      if(hwndShellView !=NULL)
      {			
        HWND hwndExcept =(HWND)lParam;
        if((hwndExcept!=NULL && hwndExcept!=hwndShellView) ||
         (hwndExcept==NULL) )
          ::SendMessage(hwndShellView,WM_COMMAND,ID_VIEW_REFRESH,0);
      }
    }

  }
  return( TRUE );
}
Exemplo n.º 29
0
MArray<CDpiForDialog::DlgItem>* CDpiForDialog::LoadDialogItems(HWND hDlg)
{
	MArray<DlgItem>* p = new MArray<DlgItem>();
	DlgItem i = {hDlg};
	if (!GetWindowRect(hDlg, &i.r))
	{
		delete p;
		return NULL;
	}
	OffsetRect(&i.r, -i.r.left, -i.r.top);
	p->push_back(i);

	i.h = NULL;
	while ((i.h = FindWindowEx(hDlg, i.h, NULL, NULL)) != NULL)
	{
		if (GetWindowRect(i.h, &i.r) && MapWindowPoints(NULL, hDlg, (LPPOINT)&i.r, 2))
		{
			#ifdef _DEBUG
			DWORD_PTR ID = GetWindowLong(i.h, GWL_ID);
			if (ID == cbExtendFonts)
			{
				RECT rcMargin = {};
				if (Button_GetTextMargin(i.h, &rcMargin))
				{
					wchar_t szLog[100];
					_wsprintf(szLog, SKIPCOUNT(szLog) L"CheckBox Rect={%i,%i}-{%i,%i} Margin={%i,%i}-{%i,%i}",
						LOGRECTCOORDS(i.r), LOGRECTCOORDS(rcMargin));
					LogString(szLog);
				}
			}
			#endif

			p->push_back(i);
		}
	}

	return p;
}
Exemplo n.º 30
0
MArray<CDpiForDialog::DlgItem>* CDpiForDialog::LoadDialogItems(HWND hDlg)
{
	MArray<DlgItem>* p = new MArray<DlgItem>();
	DlgItem i = {hDlg};
	if (!GetWindowRect(hDlg, &i.r))
	{
		delete p;
		return NULL;
	}
	OffsetRect(&i.r, -i.r.left, -i.r.top);
	p->push_back(i);

	i.h = NULL;
	while ((i.h = FindWindowEx(hDlg, i.h, NULL, NULL)) != NULL)
	{
		if (GetWindowRect(i.h, &i.r) && MapWindowPoints(NULL, hDlg, (LPPOINT)&i.r, 2))
		{
			p->push_back(i);
		}
	}

	return p;
}