Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - OCX + WM_SIZE magic
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

OCX + WM_SIZE magic

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: OCX + WM_SIZE magic
    Posted: 17 January 2010 at 8:08pm
Often when I put an OCX control inside a dialog, the border of the control is not painted correctly. I've seen this quite often, so I thought it's time to find the root cause!
 
The solution has always been to explicitly send a WM_SIZE message (no other trick seems to work):
 
CRect rect;
m_htmlCtrl.GetClientRect(rect);
m_htmlCtrl.SendMessage(WM_SIZE, SIZE_RESTORED, MAKELPARAM(rect.Width(), rect.Height()));
 
I tried to find the underlying problem and found out that the desired rectangle was always decreased by 4 pixels (width and height). Strange.
 
Any ideas? I really dislike the hack above :(
PokerMemento - http://www.pokermemento.com/
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 21 January 2010 at 9:11am

Do you add the control via the resource editor (drag and drop) or are you doing it via code? If not using the editor, try that in a sample app and then see if there are any messages such as your size message sent to the control.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.