[SOLVED]Help with DrawText()
Hey guys, well i am reading Charle Petzold's Programming windows, and i learned about the DrawText() and TextOut () functions, so i got an idea to make a program that would write on other windows, not the window i make, so here is my code, and for this project i made it a console app not a win32 for this app, here is my code:
Can someone point out what is wrong with this. Cuz i am pretty frustrated.
Code:
#include <Windows.h>
#include <iostream>
int main()
{
PAINTSTRUCT ps;
HDC hdc;
HWND ss = FindWindow(NULL, TEXT("Spider Solitaire"));
RECT rect;
if(ss == NULL)
{
std::cout<<"Window NOT Found.";
}
else if (!ss ==0)
{
std::cout<<"you're good to go.";
}
while(true)
{
hdc = BeginPaint(ss, &ps);
GetClientRect(ss, &rect);
DrawText(hdc, TEXT("YOU WON"), -1, &rect, DT_CENTER);
EndPaint(ss, &ps);
}
}