Click here to Skip to main content
16,005,037 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GetProcAddress problem... Pin
Tim Smith2-Dec-03 15:35
Tim Smith2-Dec-03 15:35 
QuestionSize of a CDHTMLDialog? Pin
Robert Mooney2-Dec-03 7:41
Robert Mooney2-Dec-03 7:41 
AnswerRe: Size of a CDHTMLDialog? Pin
Peter Molnar2-Dec-03 14:21
Peter Molnar2-Dec-03 14:21 
GeneralRe: Size of a CDHTMLDialog? Pin
Robert Mooney6-Dec-03 16:15
Robert Mooney6-Dec-03 16:15 
GeneralRe: Size of a CDHTMLDialog? Pin
Peter Molnar7-Dec-03 3:01
Peter Molnar7-Dec-03 3:01 
GeneralRe: Size of a CDHTMLDialog? Pin
Robert Mooney9-Dec-03 5:55
Robert Mooney9-Dec-03 5:55 
GeneralRe: Size of a CDHTMLDialog? Pin
Peter Molnar9-Dec-03 10:38
Peter Molnar9-Dec-03 10:38 
AnswerRe: Size of a CDHTMLDialog? Pin
Maciej Jaros7-Dec-12 7:21
Maciej Jaros7-Dec-12 7:21 
Here is a working code that resizes dialog window to the size of the body. Note that you should set body margin to 0 (e.g. with CSS).

Note that if you would want to also set width then you would have to set it first and recalculate and set height afterwards.

C++
// Called by the framework to notify an application when a document has achieved the READYSTATE_COMPLETE state.
void CYourDialogClassDlg::OnDocumentComplete(LPDISPATCH pDisp, LPCTSTR szUrl)
{
	CDHtmlDialog::OnDocumentComplete(pDisp, szUrl);

	// get document height (note - you need to set body margin to 0!)
	LONG nHeight;
	IHTMLDocument2 *pDocument;
	IHTMLElement *pElement;
	GetDHtmlDocument(&pDocument);
	pDocument->get_body(&pElement);
	pElement->get_offsetHeight(&nHeight);

	// get client to real window height difference
	LONG nHeightDiff;
	CRect rectClient;
	GetClientRect(&rectClient);
	CRect rectWindow;
	GetWindowRect(&rectWindow);
	nHeightDiff = rectWindow.Height() - rectClient.Height();

	// set height to fit body
	SetWindowPos(NULL, 0, 0, rectWindow.Width(), nHeight+nHeightDiff, SWP_NOMOVE | SWP_NOZORDER);
}


Of course you'll also need declaration in your h:
C++
virtual void OnDocumentComplete(LPDISPATCH pDisp, LPCTSTR szUrl);

Nux

GeneralDraw an Icon Pin
Hadi Dayvary2-Dec-03 6:52
professionalHadi Dayvary2-Dec-03 6:52 
GeneralRe: Draw an Icon Pin
David Crow2-Dec-03 9:40
David Crow2-Dec-03 9:40 
GeneralRe: Draw an Icon Pin
Monty22-Dec-03 19:15
Monty22-Dec-03 19:15 
GeneralKeyboard event in Dialog Box Pin
Member 3322372-Dec-03 6:32
Member 3322372-Dec-03 6:32 
GeneralRe: Keyboard event in Dialog Box Pin
GeMe_Hendrix2-Dec-03 11:18
GeMe_Hendrix2-Dec-03 11:18 
GeneralPlot graph Pin
Best Friend2-Dec-03 6:20
Best Friend2-Dec-03 6:20 
GeneralRe: Plot graph Pin
Member 3322372-Dec-03 7:58
Member 3322372-Dec-03 7:58 
GeneralSplitter with left side TreeView right side RichEditCtrlView Pin
Henitz2-Dec-03 5:55
Henitz2-Dec-03 5:55 
GeneralRe: Splitter with left side TreeView right side RichEditCtrlView Pin
Monty22-Dec-03 19:19
Monty22-Dec-03 19:19 
GeneralRe: Splitter with left side TreeView right side RichEditCtrlView Pin
Henitz3-Dec-03 10:40
Henitz3-Dec-03 10:40 
GeneralF1 Help for Dynamic dialog boxes Pin
ellenu2-Dec-03 4:53
ellenu2-Dec-03 4:53 
GeneralMSComm error Pin
El'Cachubrey2-Dec-03 4:29
El'Cachubrey2-Dec-03 4:29 
GeneralRe: MSComm error Pin
KellyR2-Dec-03 4:37
KellyR2-Dec-03 4:37 
QuestionSetting the cursor of a button? Pin
KellyR2-Dec-03 4:19
KellyR2-Dec-03 4:19 
AnswerRe: Setting the cursor of a button? Pin
valikac2-Dec-03 5:46
valikac2-Dec-03 5:46 
GeneralRe: Setting the cursor of a button? Pin
KellyR2-Dec-03 6:21
KellyR2-Dec-03 6:21 
QuestionHow to convert a UNICODE string to double data type? Pin
stberger2-Dec-03 4:12
stberger2-Dec-03 4:12 

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.