#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);
}
}
using namespace std;
while(true)
{
hdc = GetDC(ss);
BeginPaint(ss, &ps);
GetClientRect(ss, &rect);
DrawText(hdc, TEXT("YOU WON"), -1, &rect, DT_CENTER);
EndPaint(ss, &ps);
ReleaseDC(ss, hdc);
}
while(true)
{
if(GetAsyncKeyState(VK_LBUTTON) &1)
{
GetCursorPos(&p);
hdc = GetDC(ss);
std::cout<<p.x<<p.y;
GetClientRect(ss, &rect);
TextOut(hdc, p.x, p.y, TEXT("YOU WON"), 0);
ReleaseDC(ss, hdc);
}
}
#include <windows.h>
#include <iostream>
using namespace std;
int DrawOnSC(char szBuffer[], int bottom, int left, int right, int top, RECT& rect, HDC& hdc, HWND& hwnd, int& iLength)
{
SetRect(&rect, bottom, left, right + 34, top + 34);
DrawText(hdc, szBuffer, iLength, &rect, 32);
return 0;
}
int main()
{
char WindowName[] = "Spider Solitaire";
TCHAR szBuffer[50] = {0};
RECT rect;
HWND hwnd = FindWindow(0, WindowName);
HDC hdc = GetDC(hwnd);
int iLength = 0;
iLength = wsprintf(szBuffer, "YOU WON");
if (!FindWindow(0, WindowName)) { MessageBox(0, WindowName, "Window not found", 0); exit(0); }
while (true) {
DrawOnSC(szBuffer, 0, 0, 0, 0, rect, hdc, hwnd, iLength);
if ( ( (GetAsyncKeyState(VK_END)) ? 1 : 0) ) { return 0; }
}
return 0;
}