Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Maciej Jaros

@Maciej Jaros
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Size of a CDHTMLDialog?
    M Maciej Jaros

    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.

    // 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:

    virtual void OnDocumentComplete(LPDISPATCH pDisp, LPCTSTR szUrl);

    Nux

    C / C++ / MFC question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups