Click here to Skip to main content
15,906,626 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: File Dialog after dialog creation Pin
GeMe_Hendrix2-Dec-03 11:11
GeMe_Hendrix2-Dec-03 11:11 
GeneralGetProcAddress problem... Pin
LukeV2-Dec-03 10:19
LukeV2-Dec-03 10:19 
GeneralRe: GetProcAddress problem... Pin
LukeV2-Dec-03 10:30
LukeV2-Dec-03 10:30 
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 
Sorry, I was wrong when I suggested that you should get the entire body, because its sizes really equal to the entire body, consequently you cannot get anything else but the size of your entire DHTML client area in this way.

So, my new suggestion is that you take a pointer to that element only, the size of which you wanna get.
If you are interested in several elements at a time like <a>,<img> <table>etc. then put them all into one single <div> element, and deal with this container of elements.

In order to get a pointer to an element you can either
1.loop through all elements by checking for some property, like id, name, tagname etc., using IHTMLDocument2::get_all, and IHTMLElementCollection::item,(>=IE4), or
2.use IHTMLDocument3::getElementById, getElementsByName or getElementsByTagName (>=IE5)

The simplest thing is to give your element in question (or container element) an id attribute, e.g.
<div id="YourDivID">...</div>, so that you can find it.

Remark to your code: consider using smart pointers, which makes your task significantly easier by eliminating QueryInterfacing and releasing pointers.
CComPtr<IHTMLDocument2> spDoc;
//or 
MSHTML::IHTMLDocument2Ptr spDoc;

Your code:
MSHTML::IHTMLElementPtr spElem;
MSHTML::IHTMLDocument3Ptr spDoc3(spDoc);
spDoc3->getElementByID(CComBSTR("YourDivID"),&spElem);
spElem->get_offsetHeight(&nHeight);
spElem->get_offsetWidth(&nWidth);



Peter Molnar
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 
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 

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.