by some reason the TextOut() function don't show me the text:(
but see these code:

#include <iostream>
#include <string.h>
#include <windows.h>

using namespace std;

int main()
{
    HDC a=GetDC(GetForegroundWindow());
    cout << GetLastError();//i get 0(no errors)

    Rectangle(a,3,4,3+80,4+20);//the rectangule is showed
    TextOut(a,10,10,"hello world",strlen("hello world"));
    cout << GetLastError();//i get 0(no errors)
    cin.get();
}

why i can show the rectangule without problems, and the text isn't showed?
(on my game i use a double buffer, but i belive these isn't the problem)

i found the problem;)
my problem was with

strlen("hello world")

if i do:

strlen("hello world")+1

the text is showed.
thanks

another question: why don't accept an empty spaces string?

(like "                       "... only show me some spaces and not all)

It probably is showing you all the spaces it is just that it is using a variable width font and so thoses spaces are not very wide.

but if i use a letter(instead spaces), shows me normaly

Edited 3 Years Ago by cambalinho

CreateFont() or CreateFontIndirect(). You are already calling that in the code you postged in your other thread.

Also -- you shouldn't have two threads for the same question, it just causes confusion. This is my last post in this thread.

Edited 3 Years Ago by Ancient Dragon

i didn't understand what means 'fixed-width font'. now i understand.
you have right... sorry about that.
i will 'close' the thread.
thanks for all

This question has already been answered. Start a new discussion instead.