Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- For some reason my SetPixel external CrossHair isn't working- it's based off of another source, but almost completely rewritten to make it neater (IMHO). Here is the output (no errors when building):
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Users\Levi\Documents\Visual Studio 2012\Projects\[MPGH Public] External CrossHair v1.0\Release\[MPGH Public] External CrossHair v1.0.exe'. Symbols loaded.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
- '[MPGH Public] External CrossHair v1.0.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
- The program '[92] [MPGH Public] External CrossHair v1.0.exe' has exited with code -1073741510 (0xc000013a).
- Here is the code I have written/modified:
- #include <Windows.h>
- #include <iostream>
- #include <math.h>
- #define WIN32_LEAN_AND_MEAN
- namespace CrossHair_Variables {
- int Size;
- namespace Color {
- int Red;
- int Green;
- int Blue;
- };
- };
- int main() {
- std::cout << "Crosshair size in pixels:\n";
- std::cin >> CrossHair_Variables::Size;
- if((CrossHair_Variables::Size % 2) == 0) {
- CrossHair_Variables::Size += 1;
- };
- system("cls");
- std::cout << "Crosshair color (Red of RGB):\n";
- std::cin >> CrossHair_Variables::Color::Red;
- if (CrossHair_Variables::Color::Red > 255) {
- CrossHair_Variables::Color::Red = 255;
- }
- else if (CrossHair_Variables::Color::Red < 0) {
- CrossHair_Variables::Color::Red = 0;
- };
- system("cls");
- std::cout << "Crosshair color (Green of RGB):\n";
- std::cin >> CrossHair_Variables::Color::Green;
- if (CrossHair_Variables::Color::Green > 255) {
- CrossHair_Variables::Color::Green = 255;
- }
- else if (CrossHair_Variables::Color::Green < 0) {
- CrossHair_Variables::Color::Green = 0;
- };
- system("cls");
- std::cout << "Crosshair color (Blue of RGB):\n";
- std::cin >> CrossHair_Variables::Color::Blue;
- if (CrossHair_Variables::Color::Blue > 255) {
- CrossHair_Variables::Color::Blue = 255;
- }
- else if (CrossHair_Variables::Color::Blue < 0) {
- CrossHair_Variables::Color::Blue = 0;
- };
- system("cls");
- std::cout << "Loading CrossHair..";
- int BaseX = ((GetSystemMetrics(SM_CXSCREEN) / 2) - ((CrossHair_Variables::Size - 1) / 2));
- int BaseY = ((GetSystemMetrics(SM_CYSCREEN) / 2) - ((CrossHair_Variables::Size - 1) / 2));
- COLORREF Color = RGB(
- CrossHair_Variables::Color::Red,
- CrossHair_Variables::Color::Green,
- CrossHair_Variables::Color::Blue
- );
- while (true) {
- for(int Index = 0; (Index < CrossHair_Variables::Size); Index++) {
- SetPixel(
- (HDC)HWND_DESKTOP,
- (BaseX + Index),
- (BaseY + ((CrossHair_Variables::Size - 1) / 2)),
- Color
- );
- SetPixel(
- (HDC)HWND_DESKTOP,
- (BaseX + ((CrossHair_Variables::Size - 1) / 2)),
- (BaseY + Index),
- Color
- );
- };
- Sleep(5);
- };
- };
- And here is the original source (credits @SMOKe and @Hell_Demon // MPGH.NET):
- #include <windows.h>
- #include <iostream>
- #include <math.h>
- using namespace std;
- bool crosshairon=false;
- HDC ragedc = NULL;
- int crosshairsize=0;
- int cx=0;
- int cy=0;
- void CrossThread(void)
- {
- while(1)
- {
- if(GetAsyncKeyState(VK_NUMPAD0)&1)
- {
- crosshairon=!crosshairon;
- ragedc = GetDC(HWND_DESKTOP);
- cx=GetSystemMetrics(SM_CXSCREEN)/2-((crosshairsize-1)/2);
- cy=GetSystemMetrics(SM_CYSCREEN)/2-((crosshairsize-1)/2);
- }
- Sleep(1);
- }
- }
- int main()
- {
- cout<<"Crosshair size in pixels:\n";
- cin>>crosshairsize;
- if(crosshairsize%2==0) //check if its even
- {
- crosshairsize+=1; //if it is add 1
- }
- system("cls"); // clear the console :)
- cout<<"Press numpad0 to toggle the crosshair on and off\n";
- CreateThread(0,0,(LPTHREAD_START_ROUTINE)CrossThread,0,0,0);
- while(1)
- {
- if(crosshairon==true)
- {
- for(int i=0;i<crosshairsize;i++)
- {
- SetPixel(ragedc, cx+i, cy+((crosshairsize-1)/2), RGB(255,0,0));
- SetPixel(ragedc, cx+((crosshairsize-1)/2), cy+i, RGB(255,0,0));
- }
- }
- Sleep(1);
- }
- }
- For some reason their code works, mine doesn't, any ideas?
Advertisement
Add Comment
Please, Sign In to add comment