using
might get you help fasterCode:This
As my first c++ program, I am making a crosshair that will show on top of all other programs. I finished designing a cool shape pixel by pixel and coded it to show up, but whenever I go fullscreen, it dissapears. This means I can't use it for it's original purpose: FPS games. Here is the source, tell me if you have any ideas to fix this problem.
#include<windows.h>
#include<iostream>
int main()
{
int x = 960; /*This is just 1/2 the horizontal resolution, for possible development to work on multiple resolutions*/
int y = 600; /*same as previous but for y*/
HDC hdc=GetDC(NULL);
while(1)
{
SetPixel(hdc,x,y,255);
Sleep(1);
SetPixel(hdc,x+1,y,255);
Sleep(1);
SetPixel(hdc,x-1,y,255);
Sleep(1);
SetPixel(hdc,x,y+1,255);
Sleep(1);
SetPixel(hdc,x,y-1,255);
Sleep(1);
SetPixel(hdc,x+2,y,255);
Sleep(1);
SetPixel(hdc,x-2,y,255);
Sleep(1);
SetPixel(hdc,x,y+2,255);
Sleep(1);
SetPixel(hdc,x,y-2,255);
Sleep(1);
SetPixel(hdc,x-1,y-1,255);
Sleep(1);
SetPixel(hdc,x+1,y+1,255);
Sleep(1);
SetPixel(hdc,x+1,y-1,255);
Sleep(1);
SetPixel(hdc,x-1,y+1,255);
Sleep(1);
SetPixel(hdc,x-3,y,255);
Sleep(1);
SetPixel(hdc,x-2,y,255);
Sleep(1);
SetPixel(hdc,x-4,y,255);
Sleep(1);
SetPixel(hdc,x-3,y+1,255);
Sleep(1);
SetPixel(hdc,x-3,y-1,255);
Sleep(1);
SetPixel(hdc,x-1,y,255);
Sleep(1);
SetPixel(hdc,x-5,y,255);
Sleep(1);
SetPixel(hdc,x-3,y+2,255);
Sleep(1);
SetPixel(hdc,x-3,y-2,255);
Sleep(1);
SetPixel(hdc,x-4,y-1,255);
Sleep(1);
SetPixel(hdc,x-2,y+1,255);
Sleep(1);
SetPixel(hdc,x-2,y-1,255);
Sleep(1);
SetPixel(hdc,x-4,y+1,255);
Sleep(1);
SetPixel(hdc,x+3,y,255);
Sleep(1);
SetPixel(hdc,x+4,y,255);
Sleep(1);
SetPixel(hdc,x+2,y,255);
Sleep(1);
SetPixel(hdc,x+3,y+1,255);
Sleep(1);
SetPixel(hdc,x+3,y-1,255);
Sleep(1);
SetPixel(hdc,x+5,y,255);
Sleep(1);
SetPixel(hdc,x+1,y,255);
Sleep(1);
SetPixel(hdc,x+3,y+2,255);
Sleep(1);
SetPixel(hdc,x+3,y-2,255);
Sleep(1);
SetPixel(hdc,x+2,y-1,255);
Sleep(1);
SetPixel(hdc,x+4,y+1,255);
Sleep(1);
SetPixel(hdc,x+4,y-1,255);
Sleep(1);
SetPixel(hdc,x+2,y+1,255);
Sleep(1);
SetPixel(hdc,x,y+3,255);
Sleep(1);
SetPixel(hdc,x+1,y+3,255);
Sleep(1);
SetPixel(hdc,x-1,y+3,255);
Sleep(1);
SetPixel(hdc,x,y+4,255);
Sleep(1);
SetPixel(hdc,x,y+2,255);
Sleep(1);
SetPixel(hdc,x+2,y+3,255);
Sleep(1);
SetPixel(hdc,x-2,y+3,255);
Sleep(1);
SetPixel(hdc,x,y+5,255);
Sleep(1);
SetPixel(hdc,x,y+1,255);
Sleep(1);
SetPixel(hdc,x-1,y+2,255);
Sleep(1);
SetPixel(hdc,x+1,y+4,255);
Sleep(1);
SetPixel(hdc,x+1,y+2,255);
Sleep(1);
SetPixel(hdc,x-1,y+4,255);
Sleep(1);
SetPixel(hdc,x,y-3,255);
Sleep(1);
SetPixel(hdc,x+1,y-3,255);
Sleep(1);
SetPixel(hdc,x-1,y-3,255);
Sleep(1);
SetPixel(hdc,x,y-2,255);
Sleep(1);
SetPixel(hdc,x,y-4,255);
Sleep(1);
SetPixel(hdc,x+2,y-3,255);
Sleep(1);
SetPixel(hdc,x-2,y-3,255);
Sleep(1);
SetPixel(hdc,x,y-1,255);
Sleep(1);
SetPixel(hdc,x,y-5,255);
Sleep(1);
SetPixel(hdc,x-1,y-4,255);
Sleep(1);
SetPixel(hdc,x+1,y-2,255);
Sleep(1);
SetPixel(hdc,x+1,y-4,255);
Sleep(1);
SetPixel(hdc,x-1,y-2,255);
Sleep(1);
SetPixel(hdc,x+6,y,255);
Sleep(1);
SetPixel(hdc,x+7,y,255);
Sleep(1);
SetPixel(hdc,x+5,y,255);
Sleep(1);
SetPixel(hdc,x+6,y+1,255);
Sleep(1);
SetPixel(hdc,x+6,y-1,255);
Sleep(1);
SetPixel(hdc,x+8,y,255);
Sleep(1);
SetPixel(hdc,x+4,y,255);
Sleep(1);
SetPixel(hdc,x+6,y+2,255);
Sleep(1);
SetPixel(hdc,x+6,y-2,255);
Sleep(1);
SetPixel(hdc,x+5,y-1,255);
Sleep(1);
SetPixel(hdc,x+7,y+1,255);
Sleep(1);
SetPixel(hdc,x+7,y-1,255);
Sleep(1);
SetPixel(hdc,x+5,y+1,255);
Sleep(1);
SetPixel(hdc,x-6,y,255);
Sleep(1);
SetPixel(hdc,x-5,y,255);
Sleep(1);
SetPixel(hdc,x-7,y,255);
Sleep(1);
SetPixel(hdc,x-6,y+1,255);
Sleep(1);
SetPixel(hdc,x-6,y-1,255);
Sleep(1);
SetPixel(hdc,x-4,y,255);
Sleep(1);
SetPixel(hdc,x-8,y,255);
Sleep(1);
SetPixel(hdc,x-6,y+2,255);
Sleep(1);
SetPixel(hdc,x-6,y-2,255);
Sleep(1);
SetPixel(hdc,x-7,y-1,255);
Sleep(1);
SetPixel(hdc,x-5,y+1,255);
Sleep(1);
SetPixel(hdc,x-5,y-1,255);
Sleep(1);
SetPixel(hdc,x-7,y+1,255);
Sleep(1);
SetPixel(hdc,x,y+6,255);
Sleep(1);
SetPixel(hdc,x+1,y+6,255);
Sleep(1);
SetPixel(hdc,x-1,y+6,255);
Sleep(1);
SetPixel(hdc,x,y+7,255);
Sleep(1);
SetPixel(hdc,x,y+5,255);
Sleep(1);
SetPixel(hdc,x+2,y+6,255);
Sleep(1);
SetPixel(hdc,x-2,y+6,255);
Sleep(1);
SetPixel(hdc,x,y+8,255);
Sleep(1);
SetPixel(hdc,x,y+4,255);
Sleep(1);
SetPixel(hdc,x-1,y+5,255);
Sleep(1);
SetPixel(hdc,x+1,y+7,255);
Sleep(1);
SetPixel(hdc,x+1,y+5,255);
Sleep(1);
SetPixel(hdc,x-1,y+7,255);
Sleep(1);
SetPixel(hdc,x,y-6,255);
Sleep(1);
SetPixel(hdc,x+1,y-6,255);
Sleep(1);
SetPixel(hdc,x-1,y-6,255);
Sleep(1);
SetPixel(hdc,x,y-5,255);
Sleep(1);
SetPixel(hdc,x,y-7,255);
Sleep(1);
SetPixel(hdc,x+2,y-6,255);
Sleep(1);
SetPixel(hdc,x-2,y-6,255);
Sleep(1);
SetPixel(hdc,x,y-4,255);
Sleep(1);
SetPixel(hdc,x,y-8,255);
Sleep(1);
SetPixel(hdc,x-1,y-7,255);
Sleep(1);
SetPixel(hdc,x+1,y-5,255);
Sleep(1);
SetPixel(hdc,x+1,y-7,255);
Sleep(1);
SetPixel(hdc,x-1,y-5,255);
Sleep(1);
}
return 0;
}
using
might get you help fasterCode:This
Light travels faster than sound. That's why most people seem bright until you hear them speak.
Most games block trying to draw topmost. You're going to have to hook onto the functions the game uses to draw and use it to draw your crosshair. Well, as far as I know, that's the only way.
This is why programmers invented loops. :L
Try using a drawline function as well as it would be a lot easier, also not sure if this will work for Games since they write directly to the screen buffer.
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
My "Hello World" pwns his crosshair![]()
my tumblrOriginally Posted by TOXIN
How To: Not Get Banned Botting
![]()
"Had a dream I was king. I woke up, still king."
.................................................-Eminem
Notepad tells me you have 234 lines within your while loop.
234/2 = 117 Sleep(1)'s.
That would be about 120 miliseconds per draw loop, 1000/120 = 8.34 per second.
Lag up your game so you have less then 8 fps and you should see it just fine(or just remove all Sleep(1)'s except for the very last one :P)