Click here to Skip to main content
15,918,049 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: to send message to console exe Pin
Software_Developer27-Nov-11 8:56
Software_Developer27-Nov-11 8:56 
GeneralRe: to send message to console exe Pin
Randor 27-Nov-11 9:06
professional Randor 27-Nov-11 9:06 
GeneralRe: to send message to console exe Pin
Richard Andrew x6427-Nov-11 9:57
professionalRichard Andrew x6427-Nov-11 9:57 
GeneralRe: to send message to console exe Pin
Randor 27-Nov-11 11:15
professional Randor 27-Nov-11 11:15 
GeneralRe: to send message to console exe Pin
Albert Holguin28-Nov-11 7:46
professionalAlbert Holguin28-Nov-11 7:46 
AnswerRe: to send message to console exe Pin
Software_Developer27-Nov-11 7:46
Software_Developer27-Nov-11 7:46 
AnswerRe: to send message to console exe Pin
David Crow27-Nov-11 11:03
David Crow27-Nov-11 11:03 
QuestionDifferent GUI rendereng between WinXP and Vista-Win7 Pin
Bram van Kampen26-Nov-11 14:38
Bram van Kampen26-Nov-11 14:38 
Hi,

I have gotten arount Most of the security challenges around the New Windows Model.
One issue remains a challenge. I created a derrived MFC Control: 'CMultiColumListBox', derived from MFC-'CListBox'. It in turn, is used as a Baseclass for various data tabulations. it all works to perfection under Win 95/98. Win NT, and Windows XP. With Vista and Windows 7, the Header Button listtakes up about 80% of the width of the CListbox Window, the Text Colums take up even Less.
One part of the creation process sets up the display Geometry parameters. I must have missed a Translation Somewhere.

The Salient part of the control that does this is as follows:-

C++
BOOL CMultiColumListBox::RegisterControl(CDialog * pDialog)
{
	if(!m_bDrawButtons)return TRUE;
	ASSERT(pDialog->IsKindOf( RUNTIME_CLASS(CWnd) ) );

	ASSERT(::IsWindow(pDialog->m_hWnd));
	CDC* pDC=pDialog->GetDC();
	ASSERT(pDC);

	m_pParentDialog=pDialog;

	CRect CtrlRect,DlgWndRect,DlgClientRect,BnRect;
	
	GetWindowRect(&CtrlRect);// Coordinates based on WindowRect
	//
	pDialog->GetWindowRect(&DlgWndRect);

	// Calculate the height of the Title Bar
	// We need this to calculate the Position of
	// the Header tabs in Client Coordinates
	pDialog->GetClientRect(&DlgClientRect);
	int BorderWidth=DlgWndRect.Width() - DlgClientRect.Width();
	int TitleBarHeight=DlgWndRect.Height() - 
		DlgClientRect.Height()-BorderWidth;
	BorderWidth/=2;

	int Base_x,Base_y,BaseWidth;
	Base_x=CtrlRect.left-1;
	Base_y=CtrlRect.top;
	BaseWidth=CtrlRect.Width();

	for(int i=0;i<m_nNrOfColumns;i++){
		CWnd* pWnd=pDialog->GetDlgItem(m_nColumList[i].n_ID);
		ASSERT(pWnd);
		pWnd->ShowWindow(SW_NORMAL);
		int Width=m_nColumList[i].width;

		if(i==m_nNrOfColumns-1)Width=BaseWidth;
		if(Width>BaseWidth)Width=BaseWidth;

		BnRect.left=Base_x-DlgWndRect.left-BorderWidth;
		BnRect.right=Base_x+Width-DlgWndRect.left-BorderWidth;

		BnRect.top=Base_y-m_nItemHeight*2-TitleBarHeight-DlgWndRect.top-1;
		BnRect.bottom=Base_y-TitleBarHeight-DlgWndRect.top-1;

		pWnd->MoveWindow(&BnRect);// Moves Based on ClientRect
		Base_x+=Width;
		BaseWidth-=Width;
		char* p=m_nColumList[i].lpcstrColumHeader;
		if(p)pWnd->SetWindowText(p);
	}
	return TRUE;
}


This function would Typicaly be called from OnInitDialog()from the Dlg that contains it. It sets the Parameters for subsequent Drawing and Painting.

Any Idea about DlgToScreen() ScreenToDlg(),etc tha should have been used here






Confused | :confused:
Bram van Kampen

Questionhow to read a character array line by line in C? Pin
robin70025-Nov-11 14:38
robin70025-Nov-11 14:38 
AnswerRe: how to read a character array line by line in C? Pin
robin70025-Nov-11 18:49
robin70025-Nov-11 18:49 
GeneralRe: how to read a character array line by line in C? Pin
enhzflep25-Nov-11 21:35
enhzflep25-Nov-11 21:35 
AnswerRe: how to read a character array line by line in C? Pin
Richard MacCutchan25-Nov-11 22:24
mveRichard MacCutchan25-Nov-11 22:24 
AnswerRe: how to read a character array line by line in C? Pin
CPallini26-Nov-11 0:45
mveCPallini26-Nov-11 0:45 
GeneralRe: how to read a character array line by line in C? Pin
enhzflep26-Nov-11 0:59
enhzflep26-Nov-11 0:59 
GeneralRe: how to read a character array line by line in C? Pin
CPallini26-Nov-11 1:11
mveCPallini26-Nov-11 1:11 
QuestionWaitForSingleObject, Run do loop, win32 api Pin
jkirkerx25-Nov-11 13:44
professionaljkirkerx25-Nov-11 13:44 
AnswerRe: WaitForSingleObject, Run do loop, win32 api Pin
Chris Meech25-Nov-11 14:13
Chris Meech25-Nov-11 14:13 
GeneralRe: WaitForSingleObject, Run do loop, win32 api Pin
jkirkerx25-Nov-11 15:18
professionaljkirkerx25-Nov-11 15:18 
AnswerRe: WaitForSingleObject, Run do loop, win32 api Pin
Randor 25-Nov-11 14:24
professional Randor 25-Nov-11 14:24 
GeneralRe: WaitForSingleObject, Run do loop, win32 api Pin
jkirkerx25-Nov-11 15:19
professionaljkirkerx25-Nov-11 15:19 
AnswerRe: WaitForSingleObject, Run do loop, win32 api Pin
Chuck O'Toole25-Nov-11 15:05
Chuck O'Toole25-Nov-11 15:05 
GeneralRe: WaitForSingleObject, Run do loop, win32 api Pin
jkirkerx25-Nov-11 15:20
professionaljkirkerx25-Nov-11 15:20 
AnswerRe: WaitForSingleObject, Run do loop, win32 api Pin
Erudite_Eric26-Nov-11 9:15
Erudite_Eric26-Nov-11 9:15 
GeneralRe: WaitForSingleObject, Run do loop, win32 api Pin
jkirkerx26-Nov-11 12:37
professionaljkirkerx26-Nov-11 12:37 
QuestionRe: WaitForSingleObject, Run do loop, win32 api Pin
Randor 26-Nov-11 13:35
professional Randor 26-Nov-11 13:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.