Error 'DrawText' is not a member of CDC 
Author Message
 Error 'DrawText' is not a member of CDC

I am trying to use 'DrawText' function of CDC class in my
application using an instantiated object of CPaintDC class
(which is inherited from CDC class), but compiler gives
the following error

Error C2039: 'DrawText' : is not a member of 'CPaintDC'
I donot know what is the cause of this error as 'DrawText'
is member of CDC which is base class of CPaintDC.

I tried to use this function in another sample application
of dialog box, it works fine, but in my main application
it gives above error

Any thoughts about it?

Cheers
Fayyaz



Sun, 11 Sep 2005 17:13:08 GMT  
 Error 'DrawText' is not a member of CDC


Quote:
> I am trying to use 'DrawText' function of CDC class in my
> application using an instantiated object of CPaintDC class
> (which is inherited from CDC class), but compiler gives
> the following error

> Error C2039: 'DrawText' : is not a member of 'CPaintDC'

Is that the exact error message? (Formatting looks a bit different.)

Quote:
> I donot know what is the cause of this error as 'DrawText'
> is member of CDC which is base class of CPaintDC.

> I tried to use this function in another sample application
> of dialog box, it works fine, but in my main application
> it gives above error

> Any thoughts about it?

Is DrawText perhaps mis-spelled?

Jay



Sun, 11 Sep 2005 20:07:19 GMT  
 Error 'DrawText' is not a member of CDC
Yeah the 'DrawText' is correctly spelled and error message
is also correct. Actually I downloaded a sample code to
change colours, fonts and text size of Group Box. The URL
is http://www.codeguru.com/controls/SxGroupBox.html. When
I downloaded the application it works well, but when I try
to use these classes (same files SxGroupBox.cpp,
SxGroupBox.h & SxLogFont.h) in one of my application the
undermentioned error comes.

The strange thing that 'DrawText' function works ok in
application but when these files are used in my
application the error which I mentioned occured.

Any thought about that?

Regards

Fayyaz

Quote:
>-----Original Message-----



>> I am trying to use 'DrawText' function of CDC class in
my
>> application using an instantiated object of CPaintDC
class
>> (which is inherited from CDC class), but compiler gives
>> the following error

>> Error C2039: 'DrawText' : is not a member of 'CPaintDC'

>Is that the exact error message? (Formatting looks a bit
different.)

>> I donot know what is the cause of this error
as 'DrawText'
>> is member of CDC which is base class of CPaintDC.

>> I tried to use this function in another sample
application
>> of dialog box, it works fine, but in my main application
>> it gives above error

>> Any thoughts about it?

>Is DrawText perhaps mis-spelled?

>Jay

>.



Sun, 11 Sep 2005 21:50:20 GMT  
 Error 'DrawText' is not a member of CDC


Quote:
> Yeah the 'DrawText' is correctly spelled and error message
> is also correct. Actually I downloaded a sample code to
> change colours, fonts and text size of Group Box. The URL
> is http://www.codeguru.com/controls/SxGroupBox.html. When
> I downloaded the application it works well, but when I try
> to use these classes (same files SxGroupBox.cpp,
> SxGroupBox.h & SxLogFont.h) in one of my application the
> undermentioned error comes.

> The strange thing that 'DrawText' function works ok in
> application but when these files are used in my
> application the error which I mentioned occured.

> Any thought about that?

I'm afraid I don't. Project Settings? Someone redefining CPaintDC or
DrawText?

You need to identify what the difference is between your app and the sample
app. Without seeing your project, it's not possible to tell.

Jay



Mon, 12 Sep 2005 18:20:13 GMT  
 Error 'DrawText' is not a member of CDC


Quote:



> > Yeah the 'DrawText' is correctly spelled and error message
> > is also correct. Actually I downloaded a sample code to
> > change colours, fonts and text size of Group Box. The URL
> > is http://www.codeguru.com/controls/SxGroupBox.html. When
> > I downloaded the application it works well, but when I try
> > to use these classes (same files SxGroupBox.cpp,
> > SxGroupBox.h & SxLogFont.h) in one of my application the
> > undermentioned error comes.

> > The strange thing that 'DrawText' function works ok in
> > application but when these files are used in my
> > application the error which I mentioned occured.

> > Any thought about that?

> I'm afraid I don't. Project Settings? Someone redefining CPaintDC or
> DrawText?

Ok. I spoke too soon. Something kept nagging at the back of my mind... :)

Normally, the word "DrawText" is mapped (#define'd) some place in windows.h
to either DrawTextA or DrawTextW. The methods in MFC (I suspect) get renamed
the same way. So the member function *isn't* named DrawText (which is why it
couldn't find it). If you #undef DrawText, then the renaming to DrawTextA or
DrawTextW doesn't happen, and the right function name isn't used.

Now, why DrawText isn't the normal windows.h #define, I don't know. I'd look
through your code for someone changing its definition.

Jay



Mon, 12 Sep 2005 18:34:11 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. CDC::DrawText() and '&'

2. CDC::DrawText doesn't return correct RECT values

3. Error 'DrawText' is not member of CPaint DC

4. error C2039: 'exception' : is not a member of '`global namespace''

5. error C2039: 'CoInitializeEx' : is not a member of '`global namespace''

6. error C2039: 'exception' : is not a member of '`global namespace''

7. error C2039: 'InlineIsEqualGUID' : is not a member of 'ATL'

8. error C2509: 'FinalConstruct' : member function not declared in 'CMYClass'

9. ERROR 2039: 'm_dwVersion' : is not a member of 'AFX_MODULE_STATE'

10. error C2039: 'classCOaaPlotView' : is not a member of 'COaaPlotView'

11. CDC::DrawText does not report the correct rectangle size

12. CDC::DrawText not visible in CMetaFileDC

 

 
Powered by phpBB® Forum Software