Jump to content

  • Log In with Google      Sign In   
  • Create Account

Creating a compatible DC


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 jtecin   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 December 1999 - 06:15 AM

Okay, I am trying to find a quick way to display text. I think the easiest way is to just create a compatible DC and print text on it. However, when I use the following function, it always says "failed to create compatible DC". Here is my function:

void Draw_Text(char *string, int size)
{
if (lpddsback->GetDC(&main_window_handle) == DD_OK)
{
SetBkColor( main_window_handle, RGB( 0, 0, 0) );
SetTextColor( main_window_handle, RGB( 255, 255, 255 ) );
TextOut( main_window_handle, 0, 0, string, size);
lpddsback->ReleaseDC(main_window_handle);
}
}

It is probably something obvious that I am just overlooking, but I'm stumped.



Sponsor:

#2 blaze   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 December 1999 - 10:35 AM

You code looks OK. I'm assuming that your backbuffer is vaild and that the surface isn't locked of course. I would check how you've created the backbuffer.

------------------
--Shannon Schlomer, BLAZE Technologies, Inc.


#3 CJ   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 December 1999 - 06:15 AM

I also would be sure that main_window_handle is an HDC. I can't find any problems in that bit of code. The backbuffer, shouldn't be locked........and it should work.

------------------
Dance with me......

http://members.xoom.com/CJdeVos/index.htm





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS