Print Page | Close Window

OCX + WM_SIZE magic

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=16028
Printed Date: 17 May 2024 at 1:24pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: OCX + WM_SIZE magic
Posted By: znakeeye
Subject: OCX + WM_SIZE magic
Date 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/



Replies:
Posted By: rdhd
Date 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.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net