OnDraw and CStatic VC 6.0 Only

Sat. July 24, 2004 11:20 PM PT

I am deriving my own control from MFC's CStatic. I want to get OnDraw
message, inderived control. I properly set the SS_OWNERDRAW to get
WM_DRAWITEM message. But my code does not reach to the DrawItem Function.
The same code/ class/ control works perfectly in Visual Studio .Net 2003 but
not in VC 6.0.

Anybody knows what is wrong? Ultimately I just grab WM_PAINT and put the
same code in this message handler.

Thanks.


0
Lord2702 (51)
7/25/2004 6:21:12 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
1483 Views

Similar Articles

[PageSpeed] 44

Lord2702,

OnPaint (that is handling WM_PAINT) is the way to go for CStatics. The added
benefit is that you don't need to set any flag for the static :-)

Johan Rosengren
Abstrakt Mekanik AB

"Lord2702" <Lord2702@MSN.com> a �crit dans le message de
news:esdvW%23gcEHA.3420@TK2MSFTNGP12.phx.gbl...
> Sat. July 24, 2004 11:20 PM PT
>
> I am deriving my own control from MFC's CStatic. I want to get OnDraw
> message, inderived control. I properly set the SS_OWNERDRAW to get
> WM_DRAWITEM message. But my code does not reach to the DrawItem Function.
> The same code/ class/ control works perfectly in Visual Studio .Net 2003
but
> not in VC 6.0.
>
> Anybody knows what is wrong? Ultimately I just grab WM_PAINT and put the
> same code in this message handler.
>
> Thanks.
>
>


0
7/25/2004 4:08:11 PM
Johan,

On the other hand, like most MS controls a STATIC can and will do some of
its painting directly in response to event messages without doing an
Invalidate. One example that springs to mind is the WM_UPDATEUISTATE message
handler wherein it does a GetDC and calls its internal WM_PAINT handler as a
subroutine.
-- 
Jeff Partch [VC++ MVP]

"Johan Rosengren" <johan.rosengren@telia.com> wrote in message
news:OwAaZImcEHA.3904@TK2MSFTNGP12.phx.gbl...
> Lord2702,
>
> OnPaint (that is handling WM_PAINT) is the way to go for CStatics. The
added
> benefit is that you don't need to set any flag for the static :-)
>
> Johan Rosengren
> Abstrakt Mekanik AB
>
> "Lord2702" <Lord2702@MSN.com> a �crit dans le message de
> news:esdvW%23gcEHA.3420@TK2MSFTNGP12.phx.gbl...
> > Sat. July 24, 2004 11:20 PM PT
> >
> > I am deriving my own control from MFC's CStatic. I want to get OnDraw
> > message, inderived control. I properly set the SS_OWNERDRAW to get
> > WM_DRAWITEM message. But my code does not reach to the DrawItem
Function.
> > The same code/ class/ control works perfectly in Visual Studio .Net 2003
> but
> > not in VC 6.0.
> >
> > Anybody knows what is wrong? Ultimately I just grab WM_PAINT and put the
> > same code in this message handler.
> >
> > Thanks.
> >
> >
>
>


0
jeffp (1711)
7/25/2004 4:30:37 PM
"Lord2702" <Lord2702@MSN.com> wrote in message
news:esdvW%23gcEHA.3420@TK2MSFTNGP12.phx.gbl...
> Sat. July 24, 2004 11:20 PM PT
>
> I am deriving my own control from MFC's CStatic. I want to get OnDraw
> message, inderived control. I properly set the SS_OWNERDRAW to get
> WM_DRAWITEM message. But my code does not reach to the DrawItem Function.
> The same code/ class/ control works perfectly in Visual Studio .Net 2003
but
> not in VC 6.0.
>
> Anybody knows what is wrong? Ultimately I just grab WM_PAINT and put the
> same code in this message handler.

It looks like MFC42 makes no provision for SS_OWNERDRAW/WM_DRAWITEM
reflection in its CStatic implementation. I think you'll need to override
OnChildNotify and copy either the MFC7 code or the code from one of the
control types for which MFC42 does handle this (CButton for example).
-- 
Jeff Partch [VC++ MVP]


0
jeffp (1711)
7/25/2004 4:56:38 PM
No, you want a WM_PAINT message; there is no "OnDraw" message, and "OnDraw" is a VIEW
method, not a CWnd method. Just create an OnPaint handler in your subclass. The extension
to DrawItem appears to be a VC7 add-on, not present in VC6.

One of the EXTREMELY unfortunate aspects of Microsoft's approach to documentation is that
ONLY the latest version exists. There is no reference to the concept that any other
version ever existed. Note that while the API descriptions will tell you that something
exists only in Win2K, or XP SP 2, or something like that, no other documentation contains
this information, especially MFC. I consider this deeply irresponsible. In addition, they
will REMOVE "obsolete" documentation, so if you are maintaining older code you need to
keep older versions of the DDK and MSDN installed on your machine, or you don't have any
hope of figuring out what the old code did.

I have raised this issue many times with Microsoft, and the attitude appears to be "You
don't need to know about anything older than the latest version, and we are certainly not
going to expend the energy telling you what is new and what is old". Combine this with
their latest "pruning" of the MSDN, where we still have articles dealing with 16-bit
Windows 3.11 but critical Win32 articles have been "deleted" to "make space", and I wonder
who really is exercising any intelligent oversight over the documentation. 

What is even less excusable is that not only are important articles being deleted from the
distribution MSDN, but they are also being deleted from the online KB! Given the number of
grossly buggy articles that already exist (I think I have FINALLY managed to kill off the
horrible articles that explain how FindWindow will find your "other instance", even though
this technique is provably flawed beyond recovery), deleting useful articles has little
justification.
					joe

On Sat, 24 Jul 2004 23:21:12 -0700, "Lord2702" <Lord2702@MSN.com> wrote:

>Sat. July 24, 2004 11:20 PM PT
>
>I am deriving my own control from MFC's CStatic. I want to get OnDraw
>message, inderived control. I properly set the SS_OWNERDRAW to get
>WM_DRAWITEM message. But my code does not reach to the DrawItem Function.
>The same code/ class/ control works perfectly in Visual Studio .Net 2003 but
>not in VC 6.0.
>
>Anybody knows what is wrong? Ultimately I just grab WM_PAINT and put the
>same code in this message handler.
>
>Thanks.
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
7/25/2004 5:08:32 PM
Jeff,

"Jeff Partch [MVP]" <jeffp@mvps.org> a �crit dans le message de
news:%23BJs2SmcEHA.1656@TK2MSFTNGP09.phx.gbl...
> Johan,
>
> On the other hand, like most MS controls a STATIC can and will do some of
> its painting directly in response to event messages without doing an
> Invalidate. One example that springs to mind is the WM_UPDATEUISTATE
message
> handler wherein it does a GetDC and calls its internal WM_PAINT handler as
a
> subroutine.
> -- 

Gaaaaahhh! Seems like I'll have to start using CWnd instead. Pity, as the
subclassing is so easy with CStatics on a dialog. And a big, fat *sigh* -
aren't the Windows developers reading this group - no painting outside a
WM_PAINT-handler :-)))


Johan Rosengren

<snip>


0
7/25/2004 7:02:17 PM
"Johan Rosengren" <johan.rosengren@telia.com> wrote in message
news:uktOdnncEHA.1408@TK2MSFTNGP12.phx.gbl...
> Jeff,
>
> "Jeff Partch [MVP]" <jeffp@mvps.org> a �crit dans le message de
> news:%23BJs2SmcEHA.1656@TK2MSFTNGP09.phx.gbl...
> > Johan,
> >
> > On the other hand, like most MS controls a STATIC can and will do some
of
> > its painting directly in response to event messages without doing an
> > Invalidate. One example that springs to mind is the WM_UPDATEUISTATE
> message
> > handler wherein it does a GetDC and calls its internal WM_PAINT handler
as
> a
> > subroutine.
> > -- 
>
> Gaaaaahhh! Seems like I'll have to start using CWnd instead. Pity, as the
> subclassing is so easy with CStatics on a dialog. And a big, fat *sigh* -
> aren't the Windows developers reading this group - no painting outside a
> WM_PAINT-handler :-)))

Johan,

Well, I was about to reply that WM_UPDATEUISTATE might not be worth that
much anguish, but further testing indicates that the STATIC also employs
this same 'optimization' when it handles WM_SETTEXT. :(
-- 
Jeff Partch [VC++ MVP]



0
jeffp (1711)
7/25/2004 11:05:30 PM
Reply:

Similar Artilces:

Doubt on porting from WinCE 5.0 to WinCE 6.0 IPU driver
Hello, I have a OS project on Windows CE 5.0 and BSP Freescale iMX31. I have cloned the ipu.h file in the directory PLATFORM\<MyBSP>\SRC\DRIVERS\IPU\SDC from directory PUBLIC\COMMON\OAK\CSP\ARM\FREESCALE\MXARM11\DRIVERS\IPU\INC to modify it and to avoid the modifications in public common code. Now, I have to porting the project on Windows CE 6.0 where CSP under PUBLIC\COMMON doesn't exist but there is the SOC and PLATFORM\COMMON. I have to modify directly PLATFORM\COMMON\SRC\SOC\FREESCALE\MXARM11_FSL_V1\IPU\INC\Ipu.h file or I have to apply the same solution as in Win...

WDK 7.0.0.7600 Tape and Medium Changer Driver Samples?
I noticed that miniTape and Medium Changer Driver samples have been removed. Will I encounter build issues if I move legacy minitape and medium changer driver src that was built with WDK 6000 into this enviroment? Thanks, Steve they should build just fine, barring any new warnings/improvements in the compiler -- This posting is provided "AS IS" with no warranties, and confers no rights. "S. Heck" <SHeck@discussions.microsoft.com> wrote in message news:D736B2F9-B2E9-4062-95F2-1CF1F7498870@microsoft.com... > I noticed that miniTape and Med...

Import Mail from Netscape 7.0
I work for a company that uses Netscape 7.0 for our email. We are looking into converting to Outlook 2003, but I cannot find a way to import messages from Netscape 7.0 into Outlook or Outlook Express. All the articles I read are about importing 4.7 and below. Can anyone help me? Thanks! I believe that is the tool for it; downgrade to Netscape 4.7 first and import the messages into OE and then export them to Outlook. -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -Backup and Restore -Create an Office XP CD slipstreamed with Service Pack 3 ----- "Jo...

Number formatting #6
I want to use an endash in a format for zeroes in a financial statement. I cannot seem to get the format to recognize a special character. Any help would be appreciated. Excel has that built in under format>cells>number accounting format otherwise if you use custom format hold down alt key while typing 0150 on the numpad, release alt key -- Regards, Peo Sjoblom "Mary Lue" <mlfarrell@sbcglobal.net> wrote in message news:3b7801c3fe46$0dbea6b0$a001280a@phx.gbl... > I want to use an endash in a format for zeroes in a > financial statement. I cannot seem to ...

Convert Word 6.0 to Word 2003 programatically
With the latest security update from MS Security Existing word templates documents could not be loaded and they started throwing exceptions each time we load. We would like to convert the existing Word 6.0 to Word 2003 programmatically or by using a tool. How do we convert using .NET? Or any existing MS Tool Thanks for the help It sounds like your problem maybe with the KB973904 security update. Try removing it. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, ...

Formula to enter to round an Excel value up to the next $0.5?
If I have a value of $10 and add 10% by dividing by 0.90, I get $11.11 which I would like to round up to the nearest $0.5, i.e. $11.15. Does anybody know the formula and can you use it on a result which is also a formula? Thanks, Lee "Lee" wrote: > If I have a value of $10 and add 10% by dividing by 0.90, > I get $11.11 which I would like to round up to the > nearest $0.5, i.e. $11.15. From your example, I presume you mean "nearest $0.05" (nickel). > Does anybody know the formula and can you use it on a > result which is also a formula? If you truly ...

Solved Problem
Solved Problem - dotnefx Net Framework 2.0 3.5 not installing in WinXP the solution is just install this hotfix (its actually a hotfix for .msi installer - but it solves the problem anyhow !!!) ---> WindowsXP-KB942288-v3-x86.exe <--- Windows Installer 4.5 Redistributable which can be found here : http://www.microsoft.com/downloadS/details.aspx?familyid=5A58B56F-60B6-4412-95B9-54D056D6F9F4&displaylang=en#QuickInfoContainer i was experiencing the same trouble trying to update my Windows Xp Pro SP3 (this works for SP2 also as far as i know) which gave me all kinds of ...

Lookup Issue (V 3.0 CRM)
Hello, On my Opportunity Form, I have a look-up field called "customerid". I need to write some JavScript code that when the user selects a customer (account) from the customerid field lookup, the custom field CFScompanyname is automatically fills in. How do I get the company name from the above LookUp Does anyone have an idea on how I would go about doing this? Thanks In the onChange event of the customerid field, put a javascript like: var custName=crmForm.all.customerid.DataValue[0].name; { crmForm.CFScompanyname.value=custName; } -- Matt Wittemann, CRM MVP http:/...

How to move our data from Online CRM 4.0 to On Premise 4.0
Greetings everyone, We have been evaluating the on line version of Microsoft Dynamics CRM 4.0 for almost a month. The 12 employees who were selected for the test period spent many hours on uploading their contacts and calendar to the online website. Now we decided to use the on premise version and need to export all the data out to the online account and import to on premise. I was wondering if anyone can direct me to a document or any kind of resources that explains the process. Thank you, E. I was wondering about this too a few months ago. There are tools available for moving fro...

Outlook Client
When I attempt to go offline with the Outlook client, I receive the error, Failed move data for entity Case during action salnsert, countRows........ I saw a couple of other posts about this error but no response to them. Can anyone provide some additional information about how to correct the issue? Thank you, Donna This could happen for a few different reasons but make sure the user has permissions to the BCP folder in his profile... C:\Documents and Settings\%UserName%\Application Data\Microsoft\MSCRM\BCP "Donna Edwards" wrote: > When I attempt to go offline with the O...

Financial Settings in CRM 3.0
Is there any way (supported or un) to change/undo the fiscal period template settings? -- --Dodd ...

How do I enter a date in excel without "/" ex. 041504 will show 0.
Excel can't do this without some help. You could look at: http://www.xldynamic.com/source/xld.QDEDownload.html for an addin that can set this up. tj "Amy" wrote: > ...

vc++ 6.0 application runs on windows 20003 (64 bit CPU 32 bit OS)
Hi I have a VC++ 6.0 application runs on windows 20003 (64 bit CPU and 32 bit OS), it does not work. The same application runs fine on Windows XP and Windows 2000. When I debug it with VC++ 6.0, the break points and the source code totally messed up. I have a if else statement, the debug goes from inside if goes to else block if (...) { ....................... } else { ............... } Does any one have any idea about this? Thank you for your help There is no content whatsoever in the phrase "does not work". There is always a specific statement as to why something do...

Sum of 6 moving cells
Good day to all, Sheet1: Column A is the date (from Jan 1, 2005 to the current date), Col B contains the hours worked on that date and Col C is hours worked for the last 12 days. I manually type in the hours worked everyday on Col B and there is a formula on Col C to add the last 12 days. There's about 45 units that I keep track of the hours worked. How can I show on a summary sheet, the hours worked of each unit as of yesterday? My problem is that the cell that totals the last 12 days moves down one cell everyday. -- ledzepe --------------------------------------------------------...

Does CRM 4.0 work well with Office 2003?
Hi all, We're looking at upgrading from CRM 3 to 4.0. Most of our users are at MS Office 2003 and we'd like to keep that way for now. I understand 4.0 is supposed to be "compatible" with MS Office 2003 but I've been researching the issues. Are there any known compatibility issues between CRM 4.0 and MS Office 2003? Will using 2003 instead of 2007 cause any loss of functionality in CRM? (Such as disabling the tracking token.) Thank you, Mohamed Both Outlook 2003 and 2007 works fine with Microsoft CRM 4.0. We have a mix of Outlook versions being used everyday for the l...

"Multitasking" mit Outlook Express 6 funktioniert nicht
Hallo Leute Bis anhin konnte ich w�hrend dem Herunterladen eines gr�sseren Beitrages in den Foren den n�chsten aussuchen und anklicken, so dass ich w�hrend dem langsamen Herunterladen nicht nur warten musste. Nach der Neuinstallation dieses Programmes funktioniert das nun nicht mehr. Das Programm ist "blockiert", bis der angew�hlte Beitrag fertig heruntergeladen wurde. Ich finde keinen Hinweis, wo und wie ich diesen Umstand wieder so herrichten kann, wie vorher. Kann mir jemand sagen wo ich das umstellen kann? Vielen Dank f�r Eure Tips Gruss Heinz F'up2 microsoft.public.de.g...

Any word on the release of CRM version 2.0?
I was reading the recent press release from Microsoft (http://www.microsoft.com/presspass/features/2004/dec04/12-14YearReview.asp#empowering) and noticed no mention of the next release of Microsoft CRM in it. Does anyone know when the next version is planned for release? There is a product roadmap on the partner site inside a powerpoint presentation: https://partner.microsoft.com/productssolutions/business/40006821 This says Version 2 is slated for Q2 of 2005 (April-June). Matt Wittemann http://icu-mscrm.blogspot.com "Jim" wrote: > I was reading the recent press releas...

����,VC++����ADO����ACCESS,���
ʵ��û�취��.... try { m_pRecordset->Open("SELECT * FROM disk" , theApp.m_pConnection.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText); } catch(_com_error *e) { AfxMessageBox(e->ErrorMessage()); } ���������dzɹ���,���� try { m_pRecordset->Open("SELECT diskid FROM disk" , theApp.m_pConnection.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText); } catch(_com_error *e) { AfxMessageBox(e->ErrorMessage()); } �����Ͳ��ɹ���,Ϊʲô...

HIDE #div/0
i need to hide #div/0 when PMT(E6/12,F6,E4 equal a 0 i tried IF(ISERROR (PMT(E6/12,F6,E4),"",(PMT(E6/12,F6,E4)) but it is not working You haven't matched the parentheses properly. Use: IF(ISERROR (PMT(E6/12,F6,E4)),"",(PMT(E6/12,F6,E4))) Regards, Fred "bobmuse" <bobmuse@discussions.microsoft.com> wrote in message news:D030826A-9E40-4A2D-A130-86B6B1C27874@microsoft.com... >i need to hide #div/0 when PMT(E6/12,F6,E4 equal a 0 > > i tried > IF(ISERROR (PMT(E6/12,F6,E4),"",(PMT(E6/12,F6,E4)) > but it is n...

Outlook 2003/Adobe 6.0 Standard
We are using Outlook 2003 with Exchange. The workstation is Windows XP. We only have a couple users getting this error message: "A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this?" This error comes up the first time you try to reply to a message and once you click past the error message it doesn't re-appear until you've restart Outlook. The email editor is Word from within Outlook. I thought I saw a thread that mentioned Adobe updates to clear this message. I've updated the Windows updates, the Office updat...

Advice on Install 4.0 please
Hello, I just finished installing a new Server 2008 AD DC for installing MS CRM 4.0. My question is please. Do I need Exchange to do this or can I use another mail server? Also what OU should this application run in? Thank you Joe I double posted this sorry. I made a mistake and posted in the wrong place. CRM does not require Exchange. 4.0's email router can be setup to use any SMTP/POP3 mail server. The OU does not matter either. -- Matt Parks MVP - Dynamics CRM "Joe" <Joe@discussions.microsoft.com> wrote in message news:5CFCA484-C63B-415F-80BD-EC828920CF15@...

After Upgrade to CRM 3.0 cannot send email (urgent)
Hi all, i completed upgrade the crm 1.2 to crm 3.0. but now my crm 3.0 cannot send email. i can't find any error msg in event viewer. i suspect is when i key in exchange server name not correct. have any way to check exchange server i key in it is correct or not. or change the exchange name without uninstall crm 3.0 therefore, have anyone can give some tips to solve the problem? any help will be greatly apprieated. Thank you regards, Ng Ng, You could try to run the setup again and choose the 'repair' option. This let's you set the exchange server and SMTP server a...

CRM 3.0 authenticates via iexplore, but fails with outlook client.
CRM server 3.0 is installed on the primary domain controller for the shop, and crm client 3.0 for outlook is installed in a laptop. The laptop is running a "clean" install of Windows XP, Symantec Antivirus 9.0, Outlook for Office 2007, and CRM 3.0 (and dependancies per the CRM install tools). The laptop is a member of the domain, and the user is logged into his domain account on the laptop. Nothing else is installed in the laptop. Everything below takes place from within the domain--no VPN, no DMZ involved. Using Internet Explorer (from the laptop) If I type in the url for MSCRM se...

Sync Windows Mobile 5.0 with Office 2008 Mac?
Version: 2008 Hello, is it possible to synchronize Office 2008 with Windows Mobile 5.0? Is it supported? Does it require any special software for synchronization? I have searched some forum threads but I haven't searched any clear information. Thanks a lot. Lucie ...

Help, please: to move data from OExpress 6 to O2000 ?
Help, please... On a pretty good Win XP PC, I need to upgrade from Outlook Express 6 to Outlook 2000. I installed Outlook and it imported all the folders/messages/identities from OE6. Outlook 2000 starts up, and all seems fine, and I'm looking at the new message that it created... "Welcome to Outlook 2000". If I try to view any other message, it locks up. I see the perpetual hourglass. It's dead. So, I installed Outlook 2000 on another XP PC, created a mail account, and it seems to work fine. I can read and send messages. Cool. How can I export all of the folders/me...