Note that there are some explanatory texts on larger screens.

plurals
  1. POWindows API Programming
    primarykey
    data
    text
    <p>Its me Vijay..</p> <p>I m Trying to make a CrossHair(some kind of cursor) On The Screen while running a Game (Counter Strike)...</p> <p>so i did this...</p> <pre><code>############################# </code></pre> <p><code>#include&lt;iostream.h&gt;</code><br> <code>#include&lt;windows.h&gt;</code><br> <code>#include&lt;conio.h&gt;</code><br> <code>#include&lt;dos.h&gt;</code><br> <code>#include&lt;stdlib.h&gt;</code><br> <code>#include&lt;process.h&gt;</code><br> <code>#include &lt;time.h&gt;</code><br> int main()<br> {<br> <code>HANDLE hl = OpenProcess(PROCESS_ALL_ACCESS,TRUE,pid);</code> // Here pid is the process ID of the Game...<br> <code>HDC hDC = GetDC(NULL);</code> //Here i pass NULL for Entire Screen...<br> <code>HBRUSH hb=CreateSolidBrush(RGB(0,255,255));</code> <code>SelectObject(hDC,hb);</code> <code>POINT p;</code> <code>while(!kbhit())</code><br> {<br> <code>int x=1360/2,y=768/2;</code><br> <code>MoveToEx(hDC,x-20,y,&amp;p);</code><br> <code>LineTo(hDC,x+20,y);</code> </p> <pre><code> SetPixel(hDC,x,y,RGB(255,0,0)); SetPixel(hDC,x-1,y-1,RGB(255,0,0)); SetPixel(hDC,x-1,y+1,RGB(255,0,0)); SetPixel(hDC,x+1,y+1,RGB(255,0,0)); SetPixel(hDC,x+1,y-1,RGB(255,0,0)); MoveToEx(hDC,x,y-20,&amp;p); LineTo(hDC,x,y+20); } cin.get(); return 0; </code></pre> <p>} <code>####################################</code></p> <p>it works fine....at desktop i see crosshair...but my problem is that when i run game...the cross here got disappeared....</p> <p>so i think i did not handle the process of game...</p> <p>so i pass the HANDLE to the GetDC(hl)...</p> <p>But GetDC take only HWND(Handle To Window)...</p> <p>so i typecast it like this...</p> <p>HWND hl = (HWND)OpenProcess(PROCESS_ALL_ACCESS,TRUE,pid);</p> <p>and passed hl to the GetDC(hl)...</p> <p>but it doesnt work...Whats wrong with the code...</p> <p>plz tell me how do i make a simple shape at the screen on a process or game...</p> <p>PS : (My Compiler Is DevCPP and OS WinXP SP3....)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload