TheBeast32 54 Posting Whiz in Training

I switched from Dev-C++ to Code::Blocks recently. The interface is awesome. I'm using the MinGW compiler, so there's no difference in compile time (they are using the same compiler). The only thing that I like about Dev-C++ that Code::Blocks doesn't have is DevPaks. They are REALLY easy to add to Dev.

iamthwee commented: Second that. +18
TheBeast32 54 Posting Whiz in Training

I found this http://www.codeproject.com/KB/IP/sniffer.aspx. This is what I wanted to do.

Comatose commented: Fantastic Find +9
TheBeast32 54 Posting Whiz in Training

You can also do:

#include <iostream>
#include <conio.h>

int main()
{
   std::cout << "HELLO WORLD!!!!!!!111";
   getch();
}
TheBeast32 54 Posting Whiz in Training

I have tried to do this before. Just read a tutorial on how to do it by hand and make a function or whatever.

Check this out: http://www.permadi.com/tutorial/numBinToDec/index.html

Pretty much, you move left starting from the first binary digit on the right. You increment the power from 0, and multiply the digit by 2^power. So:

1010

0*(2^0) = 0
1*(2^1) = 2
0*(2^2) = 0
1*(2^3) = 8

0 + 2 + 0 + 8 = 10

1010 = 10

I'm pretty sure that you can do this conversion for any number base system. Like for base 3: instead of Digit*(2^Power), you would do Digit*(3^Power).

minigweek commented: Correct! +2
TheBeast32 54 Posting Whiz in Training

i'll attack the devpak! =)

iamthwee commented: Excellent! +17
TheBeast32 54 Posting Whiz in Training

marco93, I'm reading Programming Windows by Charles Petzold, and I know about MSDN, it doesn't show every cool thing that can be done with C++. If it did, I would be completely amazed. Also, HOW IS THE CODE HORRIBLE?. BlockInput can't do everything. Compile the first code for a mouse disabler. It makes it so you can only move it in a circle. Can you do that with BlockInput?

William Hemsworth commented: nicely said :) +3
mitrmkar commented: you posed a good question there ;) +4
TheBeast32 54 Posting Whiz in Training

Hi, I was wondering if anyone knew any code snippets that do something cool like:

Open the CD tray:

mciSendString("open CDAudio", NULL, 0, NULL);

cout << "Opening CD-ROM door ..." << endl;
mciSendString("set CDAudio door open", NULL, 0, NULL);

cout << "Closing the CD-ROM door in 5 seconds ..." << endl;
Sleep(5000);
mciSendString("set CDAudio door closed", NULL, 0, NULL);

mciSendString("close CDAudio", NULL, 0, NULL);

Turn the monitor off and on:

cout << "Turning off monitor...";
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);

cout << endl << "Turning monitor back on...";
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) -1);
William Hemsworth commented: Nice :) +3
TheBeast32 54 Posting Whiz in Training

Prabakar, a trainer is something that lets you cheat on games. They can give you like infinite money and health and stuff.
hdan, to get a variables address in your own program do this:

#include <iostream>
#include <ostream>
#include <ios>

using namespace std;

int main()
{
          int n;
          n = 1;
          cout << &n;
          cin.get();
          return 0;
}

I have tried to do the same thing in the past. Here's the code. You need the text of the window for the program to cheat on.

#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <iostream>
using namespace std;

int Memory(char Caption[], int long Address, int Value, bool _w)
{
    DWORD PROC_ID;
    HANDLE PROC_HANDLE;

    GetWindowThreadProcessId(FindWindow(NULL, (LPCTSTR)Caption), &PROC_ID);
    PROC_HANDLE = OpenProcess(PROCESS_ALL_ACCESS, false, PROC_ID);
    if(_w)
        WriteProcessMemory(PROC_HANDLE, (LPVOID)Address, &Value, sizeof(long int), NULL);
    else
        ReadProcessMemory(PROC_HANDLE, (LPVOID)Address, &Value, sizeof(long int), NULL);
    CloseHandle(PROC_HANDLE);
    return Value;
}

int main()
{
    SetConsoleTitle("EditMemory");
    char Caption[1000];
    cout << "Enter the caption: ";
    cin.getline(Caption, 1000);
    HWND Test = FindWindow(NULL, Caption);
    if (!Test)
    {
    cout << "\nCannot find window \"" << Caption << "\"!";
    cin.get();
    return 0;
    }
    
    LPVOID Address;
    cout << "\nEnter the address: ";
    cin >> Address;
    
    int Value;
    cout << "\nEnter the value to write: ";
    cin >> Value;
    
    bool _w;
    char aChar[100];
    cout << "\nEnter 'w' to write, or 'r' to read: ";
    cin >> aChar;
    
    switch (aChar[0])
    {
       case 'w':
       _w = true;
       break;
       
       case 'r':
       _w = false;
       break;
       
       default:
       cout << "\nYou didn't enter 'w' or 'r'!";
       cin.ignore();
       cin.get();
       return 0;
       break;
    }
    cout << …
Prabakar commented: Impressive:) +1
TheBeast32 54 Posting Whiz in Training

I looked around for a while. I'm going to use SendInput now. It works.

TheBeast32 54 Posting Whiz in Training

Hi, how would I use mouse_event to simulate the mouse wheel? I can only do clicks.

void Left_Click(const long x, const long y)
{
    mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
    mouse_event(MOUSEEVENTF_LEFTUP,x,y,0,0);
}
void Right_Click(const long x, const long y)
{
    mouse_event(MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0);
    mouse_event(MOUSEEVENTF_RIGHTUP, x, y, 0, 0);
}