Undefined
By: Guest | Date: Jan 10 2009 16:23 | Format: C++ | Expires: never | Size: 1.71 KB | Hits: 1402
- / gdi_draw.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
- //
- #include "stdafx.h"
- #include "class.h"
- #include <iostream>
- #include <string>
- #include <windows.h>
- #include "process.h"
- #include <cstdlib>
- #include <winbase.h>
- // hat ich auch schonmal versucht..
- void draw(){
- HWND hWnd=FindWindow(NULL,"Counter-Strike");
- HDC hdc=GetDC(hWnd);
- RECT r;
- // Obtain the window's client rectangle
- GetClientRect(hWnd, &r);
- // THE FIX: by setting the background mode
- // to transparent, the region is the text itself
- // SetBkMode(hdc, TRANSPARENT);
- // Bracket begin a path
- BeginPath(hdc);
- // Send some text out into the world
- TCHAR text[ ] = "Defenestration can be hazardous";
- TextOut(hdc,r.left,r.top,text, ARRAYSIZE(text));
- // Bracket end a path
- EndPath(hdc);
- // Derive a region from that path
- SelectClipPath(hdc, RGN_AND);
- // This generates the same result as SelectClipPath()
- // SelectClipRgn(hdc, PathToRegion(hdc));
- // Fill the region with grayness
- }
- using namespace std;
- //using namespace System::Threading;
- BOOL TextOut(int x, int y,
- LPCTSTR lpszString,
- int nCount);
- void runInThread();
- ///////////////
- int main(int argc, char *argv[]) {
- unsigned long threadId;
- HWND hWnd=FindWindow(NULL,"Counter-Strike");
- HDC hdc=GetDC(hWnd);
- cout<<"hWnd: "<<hWnd<<endl;
- cout<<"hcd: "<<hdc<<endl;
- HANDLE hThread = CreateThread(
- NULL, 2000, (LPTHREAD_START_ROUTINE)runInThread,"", 0, &threadId
- );
- for(int i=0;i<30;++i) {
- Sleep(10);
- RECT r;
- DrawText(hdc,"text",4,&r,DT_CENTER);
- }
- return EXIT_SUCCESS;
- }
- ///////////////
- void runInThread() {
- for(int i=0;i<30;++i) {
- printf("runinthread");
- }
- }
Latest pastes
1 hours ago
11 hours ago
1 days ago
2 days ago
2 days ago