OK I figured after looking at some of my top down style original application that I wanted to make it a bit more classy, and organized as well as simply just use a class to both keep familiar and give me dynamic options. I have ran into problems and cannot make sense of it.

The code is to grab a games window, using GetPixel() to look for certain pixels on the games screen I can code automation processes or game cheats per say.

Well the original code works great, but trying to convert it all to a class has ran into problems. It doesnt seem as if any of my COLORREFS are being used for the graphical manipulation. Let me give code than to explain it.

It's been a while since I put classes to use, and I think I'm crossing something or the way of thinking.
In basic... the original which works fine for me. Is vars and COLORREFS and all variables at the top of the code under the header files, then the prototypes, then the main() function inside the main function is a message loop to get keys and so forth and below the main() is the function declarations and definition bodies.

I get no errors on registering the keys, and using SetPixel to output on the screen for troubleshooting I declared COLORREF RedDot and set it to red for red to be painted in the zones I do pixel searches. It's not painting to the screen, and is not processing hotkeys it seems.

In my main program am I supposed to initialize each variable?
for every COLORREF which I set to an RGB macro am I supposed to re-state each?
Such as HAK hax; hax.cr; hax.crTargeted; and declare each one all over again like this?

Thanks for anyone who helps me. Allot of thanks to Ancient Dragon, and Triumph for the many many great answers and direction provided I learned allot from you two. **AWESOME POSTERS YOU BOTH ARE**


Main.cpp

/**********DEVELOPED BY CODY OEBEL: AKA MANEGARD aka DRAXZ**************/
/////////////////////////////////////////////////////////////////////////


#include <windows.h>
#include <stdlib.h>
#include <Winuser.h>
#include <iostream>
#include <sstream>
#include <tlhelp32.h>
#include <tchar.h>
#include <dos.h>
#include <fstream>
#include "DCFUNC.h"
using namespace std;
void Pk2(int* pNum);
void Hunt2(int* pNum);
HAK hax;


int anum = 0;

////////////////Start of Windows Main /////////////////////////
int main()
{
    
int OFF = 0;    
hax.hwndDC = FindWindow(0, "MY GAME WINDOW");
hax.hdcDC = GetDC(hax.hwndDC);
hax.IsDcOpen();
hax.TurnOffReuse();
hax.TurnOffReuse();
hax.RegisterHotKeys();
hax.ProcWindows();
HANDLE HUNT = :: CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Hunt2,&anum,0,0);
HANDLE PK = :: CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Pk2,&anum,0,0);
::SuspendThread(HUNT);
::SuspendThread(PK);
MessageBox(hax.hwndDC,"AUTO CURE\\HEALER note: This runs invisible","v1.2 by: DRAXZ aka MANEGARD", MB_OK|MB_ICONINFORMATION);
MessageBox(hax.hwndDC,"IF YOU HAVE THIS PROGRAM WITHOUT MY PERSMISSION AND ARE NOT SUPPOSED TO. YOU WILL REGRET IT!","v1.2 by: DRAXZ aka MANEGARD", MB_OK|MB_ICONINFORMATION);


while(OFF == 0)
{      
       hax.HuntMode();
       hax.CombatMode();
       
      hax.IsDcOpen();
      if(hax.IsDcOpen()== 86)
      {
        OFF = 1;
      };
      MSG msg = {0};    
      PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);// Peak Message returns no matter what
      if(msg.message == WM_HOTKEY) 
      {		switch(msg.wParam)
		    {   
            
			case 1:   
		    hax.CurePot(); // if shift key is pressed  CurePot(); to cure poison\disease
            break;
			case 2:
            ::TerminateThread(HUNT,0);
            ::CloseHandle(HUNT);    
            PK = :: CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Pk2,&anum,0,0);

			break;
			case 3: 
            ::TerminateThread(PK,0);
            ::CloseHandle(PK);            // return code for ID3 hotkey, key is 2key, to turn on PK mode
            HUNT = :: CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Hunt2,&anum,0,0);

            break;
            case 4:  // ID4 is hotkey set to 3key which runs potion buyer macro function
            hax.PotionBuyer();
            break;
            
            case 5:  // ID5 is the 4 key which turns off thread function processing
          ::TerminateThread(PK,0);
          ::TerminateThread(HUNT,0);
          ::CloseHandle(PK);     
          ::CloseHandle(HUNT);
          DestroyWindow(hax.hwndDC);
          return 0;
            break;
            
            case 6:
                   // ID6 hotkey is key 5 to turn enable thread to run by setting GO_ON true or to 1.
            break;
            
            
            case 7:  // ID7 is program and threads termination and program will close
            OFF = 1;
            return 0; //Kill Program
            break;
            default:
            break;
            };
  
         };     
         

};
OFF = 0;


   return 0;
    
};



void Pk2(int* pNum)
{
SetPriorityClass(GetCurrentProcess(),ABOVE_NORMAL_PRIORITY_CLASS);//NORMAL_PRIORITY_CLASS     
for(;;)
  { 
         
    hax.CheckChatBox();              
    hax.CheckBody();
    hax.CheckForHit();
  }; 

}; 

void Hunt2(int* pNum)
{ 
     SetPriorityClass(GetCurrentProcess(),ABOVE_NORMAL_PRIORITY_CLASS);//NORMAL_PRIORITY_CLASS
    for(;;) ////////////// For loop for running hunt mode.
    {  
        
                      hax.PotionBuyer();
                      hax.CheckChatBox();              
                      hax.CheckBody();
                      hax.GreaterHeal();
                      hax.CombatMode();
                      
    };

};

///////////DCFUNC.h ///////////

////////////ALL THE FUNCTIONS I WROTE COMPILED NICE AND NEAT INTO A CLASS///////
class HAK
{
public:
       
       
       
HWND hwndDC;// = FindWindow(0, "MY GAME WINDOW");
HDC hdcDC;// = GetDC(hwndDC);
COLORREF cr;
COLORREF crTargeted;// = RGB(252,244,0); // Target enemies energy bar color
COLORREF crBuy50;// = RGB(252,188,0);
COLORREF crGold;// = RGB(228,208,8);
COLORREF crMouseClose;// = RGB(80,200,56);
COLORREF crMouseClose2;// = RGB(188,0,0);
COLORREF crGetHit;// = RGB(252,252,84);
COLORREF crCheckMark;// = RGB(40,184,28);
COLORREF crBuyPotsCheckMark;// = RGB(56,192,40);
COLORREF crGreaterHeal;// = RGB(172,172,172);
COLORREF crMassScroll;// = RGB(236,124,124);
COLORREF NeedHeal;// = RGB(0,0,0);
COLORREF crChatPoisoned;// = RGB(0,252,0);
COLORREF crPoisoned;// = RGB(184,240,148);
COLORREF crChatDiseased;// = RGB(172,84,0);
COLORREF crDiseased;// = RGB(180,156,104);
COLORREF crMinorCure;// = RGB(240,112,0);
COLORREF Cure;// = RGB(208,192,156);
COLORREF RedDot;// = RGB(255,0,0);

////vars and function prototypes////////             
int CurePot();
int MinorCurePot();
int MassHeal();
int CheckChatBox();
int CheckBody();
int GreaterHeal();
int CheckForHit();
int TurnOffReuse();
int HuntMode();
int CombatMode();
int PotionCount();
int RegisterHotKeys();
int UnRegisterHotKeys();
int PickUpGold();
int AutoFollow();
void Hunt(int* pNum);
void Pk(int* pNum);
int PotionBuyer();
int ProcWindows();
int IsDcOpen();
int KillThreads();

/////////int vars
int OFF;
int tnum;



private:
        
};

/////DFUNC.cpp///////////

#include <windows.h>
#include <stdlib.h>
#include <Winuser.h>
#include <iostream>
#include <sstream>
#include <tlhelp32.h>
#include <tchar.h>
#include <dos.h>
#include <fstream>
#include "DCFUNC.h"
using namespace std;
/**************************************************************************
THESE ARE ALL MEMBER FUNCTIONS AND VARIABLES OF CLASS HAK OF DCFUNC.h
***************************************************************************/


HWND hwndDC = FindWindow(0, "MY GAME WINDOW");
HDC hdcDC = GetDC(hwndDC);
COLORREF cr;
///////////////////////////////////////////////////////////////////////////////
//////////BELOW ARE COLOR REFS FOR NUMEROUS GAME COLORS AS LISTED//////////////
///////////////////////////////////////////////////////////////////////////////
COLORREF crTargeted = RGB(252,244,0); // Target enemies energy bar color
COLORREF crBuy50 = RGB(252,188,0);
COLORREF crGold = RGB(228,208,8);
COLORREF crMouseClose = RGB(80,200,56);
COLORREF crMouseClose2 = RGB(188,0,0);
COLORREF crGetHit = RGB(252,252,84);
COLORREF crCheckMark = RGB(40,184,28);
COLORREF crBuyPotsCheckMark = RGB(56,192,40);
COLORREF crGreaterHeal = RGB(172,172,172);
COLORREF crMassScroll = RGB(236,124,124);
COLORREF NeedHeal = RGB(0,0,0);
COLORREF crChatPoisoned = RGB(0,252,0);
COLORREF crPoisoned = RGB(184,240,148);
COLORREF crChatDiseased = RGB(172,84,0);
COLORREF crDiseased = RGB(180,156,104);
COLORREF crMinorCure = RGB(240,112,0);
COLORREF Cure = RGB(208,192,156);
COLORREF RedDot = RGB(255,0,0);
int OFF = 0;
int tnum = 0;

///////int vars being initialized//////////


///////BELOW IS CLASS MEMBER FUNCTIONS BEING DEFINED//////////////

int HAK::IsDcOpen()
{
      if(HAK::hwndDC == 0)
        {
        MessageBox(HAK::hwndDC,"AUTO CURE\\HEALER note: This runs invisible","v1.2 by: DRAXZ aka MANEGARD", MB_OK|MB_ICONINFORMATION);
        return 86;
        };
      return 0;
};

int HAK::CurePot()
{
      for(int bpy = 150; bpy != 400; bpy++)
                  { 
                     for(int bpx = 350; bpx != 480; bpx++)
                     {
                             cr = GetPixel(hdcDC,bpx,bpy); 
                             if(cr == Cure)
                              {
                                SendMessage(HAK::hwndDC,WM_LBUTTONDBLCLK,0,MAKELPARAM(bpx,bpy));
                                //SendMessage(HAK::hwndDC,WM_LBUTTONDOWN,0,MAKELPARAM(bpx,bpy));
                                //SendMessage(HAK::hwndDC,WM_LBUTTONUP,0,MAKELPARAM(bpx,bpy));
                                 return 0;
                              };
                              
                         SetPixel(hdcDC,bpx,bpy,RedDot);    
                     };
                     
                                                         
                  };
return 0;
};



int HAK::MinorCurePot()
{
      for(int bpy = 150; bpy != 400; bpy++)
                  { 
                     for(int bpx = 350; bpx != 480; bpx++)
                     {
                             cr = GetPixel(hdcDC,bpx,bpy); 
                             if(cr == crMinorCure)
                              {
                                SendMessage(HAK::hwndDC,WM_LBUTTONDBLCLK,0,MAKELPARAM(bpx,bpy));
                                //SendMessage(HAK::hwndDC,WM_LBUTTONDOWN,0,MAKELPARAM(bpx,bpy));
                                //SendMessage(HAK::hwndDC,WM_LBUTTONUP,0,MAKELPARAM(bpx,bpy));
                               
                                return 0;
                              };
                              if(bpy == 399 && bpx == 479 && cr != crMinorCure)
                              {
                                     CurePot();
                                     return 0;
                              };
                              
                         SetPixel(hdcDC,bpx,bpy,RedDot);    
                     };
                                                        
                  };
return 0;
};



int HAK::GreaterHeal()
{
    
cr= GetPixel(hdcDC,347,40);  //Check energy bar for energy level
if(cr == NeedHeal)
{ 
    for(int bpmhy = 150; bpmhy != 400; bpmhy++)
                                  { 
                      
                        for(int bpmhx = 350; bpmhx != 480; bpmhx++)
                         {
                             cr = GetPixel(hdcDC,bpmhx,bpmhy); 
                             if(cr == crGreaterHeal) //Greater Heal potion color
                              { 
                                  SendMessage(HAK::hwndDC,WM_LBUTTONDBLCLK,0,MAKELPARAM(bpmhx,bpmhy));
                                  PostMessage(HAK::hwndDC,WM_KEYDOWN,0x52,0);
                                  PostMessage(HAK::hwndDC,WM_KEYUP,0x52,0);
                                  
                                  //SendMessage(HAK::hwndDC,WM_LBUTTONDOWN,0,MAKELPARAM(bpmhx,bpmhy));
                                  //SendMessage(HAK::hwndDC,WM_LBUTTONUP,0,MAKELPARAM(bpmhx,bpmhy));
                                  return 0;
                              };
                              
                             SetPixel(hdcDC,bpmhx,bpmhy,RedDot);                     
                     
                         }; 
                                
                                  };
};   
 
    
    return 0;
    
};

int HAK::CheckForHit()
{
    /////////////Check to see if dransik is still open and running.
     
    //////////Checks for body flash
                for(int mx = 170; mx <= 180; mx++)
                 {
           cr = GetPixel(hdcDC,mx,176);
           if(cr == crGetHit)
           {
                 //Use Minor Cure Potion
                 GreaterHeal(); 
                 Sleep(500);
                 return 0;
                
           };
           
           SetPixel(hdcDC,mx,176,RedDot);
};
                  
    
    
    
    return 0;
};





int HAK::CheckBody()
{
    //////////Checks for body flash
                for(int mx = 170; mx <= 180; mx++)
                 {
           cr = GetPixel(hdcDC,mx,176); //176 is center of body
           if(cr == crPoisoned) 
           {
                 //Use Minor Cure Potion
                 MinorCurePot();
                 return 0;
                
           };
           if(cr == crDiseased)
           {
                 CurePot();
                 return 0;
           };
           
          SetPixel(hdcDC,mx,176,RedDot);
                  };
                  
    
    
    
    return 0;
};

int HAK::CheckChatBox()
{
    //Check chat box for disease message
    for(int y = 350; y <= 470; y++)
               {
                       for(int x = 10; x<= 150; x++)
                       {
                               cr = GetPixel(hdcDC,x,y);
                               if(cr == crChatPoisoned)
                               {
                                MinorCurePot();
                                return 0;
                                };
                                if(cr == crChatDiseased)
                                {
                                CurePot();
                                return 0;
                               };
                              
                               
                       SetPixel(hdcDC,x,y,RedDot);
                       };
                
                };
    return 0;
};





int HAK::TurnOffReuse()
{   
    SetWindowPos(HAK::hwndDC, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
    Sleep(500);
    SendMessage(HAK::hwndDC,WM_KEYDOWN,0x1B,0); // 0x1B is escape  vk code
    SendMessage(HAK::hwndDC,WM_KEYUP,0x1B,0);
    Sleep(300);
    for(int i=0; i != 500;i++)
               {
                   
    for(int my = 152; my <= 159; my++)
                              {    
    for(int mx = 355; mx <= 370;mx++)
         {
    cr = GetPixel(hdcDC,mx,my);
    if(cr == crCheckMark)
    {
    //Send Click to Uncheckmark the box
    Sleep(500);
    SendMessage(HAK::hwndDC,WM_LBUTTONDOWN,0,MAKELPARAM(mx,my));
    SendMessage(HAK::hwndDC,WM_LBUTTONUP,0,MAKELPARAM(mx,my)); 
    };
    
   //SetPixel(hdcDC,mx,my,RedDot);
        }; 
                                 }; 
   if(i == 500)
    {
         i = 0;
         goto next;
    };
             }; 
             next:
                  
       for(int i=0; i != 500;i++)
               {
                   
    for(int my = 70; my <= 78; my++)
                                  {    
    for(int mx = 520; mx <= 535;mx++)
         {  
    cr = GetPixel(hdcDC,mx,my);
    if(cr == crCheckMark)
    {
    //Send Click to Uncheckmark the box
    Sleep(900);
    SendMessage(HAK::hwndDC,WM_LBUTTONDOWN,0,MAKELPARAM(mx,my));
    SendMessage(HAK::hwndDC,WM_LBUTTONUP,0,MAKELPARAM(mx,my)); 
    };
    
   //SetPixel(hdcDC,mx,my,RedDot);
        }; 
                                 }; 
   if(i == 500)
    {
         i = 0;
         goto next1;
    };
             }; 
             next1:              
  Sleep(800);
  Sleep(400);   
  PostMessage(HAK::hwndDC,WM_KEYDOWN,0x1B,0);
  Sleep(400);
  PostMessage(HAK::hwndDC,WM_KEYUP,0x1B,0);
   
  
return 0;
};


int HAK::HuntMode()  // This is a mode checker for on and off of hunt mode by checking for green
               // arrow at top right of dransik screen.
{
    
        //Runs Check at Top Right
    for(int y = 5; y <= 15; y++)
               {
                       for(int x = 580; x<= 640; x++)
                       {
                               cr = GetPixel(hdcDC,x,y);
                               if(cr == crMouseClose)
                               {
                               SendMessage(HAK::hwndDC,WM_KEYDOWN,0x32,0); 
                               SendMessage(HAK::hwndDC,WM_KEYUP,0x32,0);
                               };
                              
                               
                      SetPixel(hdcDC,x,y,RedDot);
                       };
                
                };
                
                
    return 0;
     
};

int HAK::CombatMode()  // Function to check for green arrow in bottom right screen of dransik
{
      int code = 0;
      //Runs check at bottom right
    for(int y = 460; y <= 480; y++)
               {
                       for(int x = 610; x<= 640; x++)
                       {
                               cr = GetPixel(hdcDC,x,y);
                               if(cr == crMouseClose)
                               {
                               SendMessage(HAK::hwndDC,WM_KEYDOWN,0x31,0); 
                               SendMessage(HAK::hwndDC,WM_KEYUP,0x31,0);
                                };
                              
                               
                      SetPixel(hdcDC,x,y,RedDot);
                       };
                
                };
                
                
    return code;

};

///////// FUNCTION TO REGISTER HOTKEYS /////////////////////////////

int HAK::RegisterHotKeys()
{
    
    MessageBox(HAK::hwndDC,"HOTKEY CLASS IS WORKING GREAT","v1.2 by: DRAXZ aka MANEGARD", MB_OK|MB_ICONINFORMATION);
    
    
    if (RegisterHotKey(NULL,1,MOD_SHIFT,0) == 0)  //0x20 Shift+Space to activate
   {    
      MessageBox(HAK::hwndDC,"HOT KEY SHIFT + SPACE FAILED TO REGISTER","v1.2 by: MANEGARD", MB_OK|MB_ICONINFORMATION);
    
   };
   if (RegisterHotKey(NULL,2,0,0x31) == 0)  //this is number 1 key to activate HUNT MODE
   {    
      MessageBox(HAK::hwndDC,"HUNT MODE HOT KEY FAILED TO REGISTER","v1.2 by: MANEGARD", MB_OK|MB_ICONINFORMATION);
    
   };
     if (RegisterHotKey(NULL,3,0,0x32) == 0)  //this is number 2 key to activate Combat MODE
   {    
      MessageBox(HAK::hwndDC,"COMBAT MODE HOT KEY FAILED TO REGISTER","v1.2 by: MANEGARD", MB_OK|MB_ICONINFORMATION);
    
   };
      if (RegisterHotKey(NULL,4,0,0x33) == 0)  // 3 KEY  hotkey for buying potions at shop fast
   {    
     MessageBox(HAK::hwndDC,"POTION BUYING KEY FAILED TO REGISTER","v1.2 by: MANEGARD", MB_OK|MB_ICONINFORMATION);
    
   };
      if (RegisterHotKey(NULL,5,0,0x34) == 0)  // 4 KEY  hotkey for turning off thread for mouse macro
   {    
     MessageBox(HAK::hwndDC,"COMBAT MOUSE SETUP-OFF FAILED TO INITIALIZE","v1.2 by: MANEGARD", MB_OK|MB_ICONINFORMATION);
    
   };
      if (RegisterHotKey(NULL,6,0,0x35) == 0)  // 5 KEY  hotkey for turning on thread for mouse macro
   {    
     MessageBox(HAK::hwndDC,"COMBAT MOUSE SETUP-ON FAILED TO INITIALIZE","v1.2 by: MANEGARD", MB_OK|MB_ICONINFORMATION);
    
   };
      if (RegisterHotKey(NULL,7,0,0x2E) == 0)  // Delete KEY in keypad to right of keyboard hotkey for terminating programs main.
   {    
     MessageBox(HAK::hwndDC,"PROGRAM TERMINATION HOTKEY COULD NOT BE SET TO + key in NumPad","v1.2 by: MANEGARD", MB_OK|MB_ICONINFORMATION);
    
   };

    return 0;
};


int HAK::PickUpGold()
{             //code for goldpickup hotkey being pressed.
  
  POINT point;
  ScreenToClient(NULL,&point);
  GetCursorPos(&point);
  //RECT rect;
  //GetClientRect(HAK::hwndDC,&rect);
  //ClipCursor(&rect);
  char text[200];
  sprintf(text,"this is the number %i",point.x);
  char text2[200];
  sprintf(text2,"this is the number %i",point.y);
  Sleep(5000);
  MessageBox(HAK::hwndDC,text,"Xcoordinate",MB_OK);
  MessageBox(HAK::hwndDC,text2,"Ycoordinate",MB_OK);
  return 0;
};                 
                 
int HAK::AutoFollow()
{
    //////////Auto Follow looks for targted object and follows it ////////////
       for(int my = 140; my <=220; my++)  
       {
                for(int mx = 150; mx <= 190; mx++)
                 {
                   cr = GetPixel(hdcDC,mx,my);
                   if(cr == crTargeted)
                     {
                     SendMessage(HAK::hwndDC,WM_RBUTTONDOWN,0,MAKELPARAM(mx,my));
                     SendMessage(HAK::hwndDC,WM_RBUTTONUP,0,MAKELPARAM(mx,my));                
                     };
                     SetPixel(hdcDC,mx,my,RedDot);  
                  };
                    
       };             
return 0;
};

int HAK::UnRegisterHotKeys()
{   
    UnregisterHotKey(0,1);//Unregistering Hot Key for clean up
    UnregisterHotKey(0,2);//Unregistering Hot Key for clean up
    UnregisterHotKey(0,3);//Unregistering Hot Key for clean up
    UnregisterHotKey(0,4);//Unregistering Hot Key for clean up
    UnregisterHotKey(0,5);//Unregistering Hot Key for clean up
    UnregisterHotKey(0,6);//Unregistering Hot Key for clean up
    UnregisterHotKey(0,7);//Unregistering Hot Key for clean up   
    return 0;
};


void HAK::Hunt(int* pNum)
{ 
     //SetPriorityClass(HUNT,ABOVE_NORMAL_PRIORITY_CLASS);//NORMAL_PRIORITY_CLASS
    for(;;) ////////////// For loop for running hunt mode.
    {  
        
                      PotionBuyer();
                      CheckChatBox();              
                      CheckBody();
                      GreaterHeal();
                      CombatMode();
                      
    };

};



//////////////////PK MODE FUNCTION //////////////////////////////////

void HAK::Pk(int* pNum)
{
//SetPriorityClass(PK,ABOVE_NORMAL_PRIORITY_CLASS);//NORMAL_PRIORITY_CLASS     
for(;;)
  {   
    CheckChatBox();              
    CheckBody();
    CheckForHit();
  }; 

};

int HAK::PotionBuyer()
   {
    

///////////////////Buys 200 Potions at Pot Shop Quickly//////////////////////
    int my;
    int mx;
////FOR 4 times DO THIS TO BUY TWO HUNDRED POTIONS///////////
for(int i=0; i <= 3;i++)
{    
/////////////Selects and Finds Potion In Buy Menu/////////////////////
    for(my = 30; my <= 300; my++)
            {
 
for(mx = 300; mx <= 310; mx++)
   {
      cr = GetPixel(hdcDC,mx,my);
      if(cr == crGreaterHeal)
      {
      SendMessage(HAK::hwndDC,WM_LBUTTONDBLCLK,0,MAKELPARAM(mx,my));
      
      break;
      };  
   };
         SetPixel(hdcDC,mx,my,RedDot);   
             };
             
 //////////////SELECTS 50/////////////////////
     for(my = 240; my <= 250; my++)
            {
 ///////////////////Buys 200 Potions at Pot Shop Quickly//////////////////////
for(mx = 350; mx <= 380; mx++)
   {
      cr = GetPixel(hdcDC,mx,my);
      if(cr == crBuy50)
      {
      SendMessage(HAK::hwndDC,WM_LBUTTONDOWN,0,MAKELPARAM(mx,my));
      SendMessage(HAK::hwndDC,WM_LBUTTONUP,0,MAKELPARAM(mx,my));      
      break;
      };  
   };
        // SetPixel(hdcDC,mx,my,RedDot);   
             };
            
//////////////////Now Click Check Mark for OK on 50////////////////////////            
      for(my = 250; my <= 265; my++)
            {
 ///////////////////Buys 200 Potions at Pot Shop Quickly//////////////////////
for(mx = 400; mx <= 430; mx++)
   {
      cr = GetPixel(hdcDC,mx,my);
      if(cr == crBuyPotsCheckMark)
      {
      SendMessage(HAK::hwndDC,WM_LBUTTONDOWN,0,MAKELPARAM(mx,my));
      SendMessage(HAK::hwndDC,WM_LBUTTONUP,0,MAKELPARAM(mx,my));      
      break;
      };  
   };
        // SetPixel(hdcDC,mx,my,RedDot);   
             };
}; //////<----- End of for loop to run 4 times 
 //////////////////Now Click CheckMark to Check Out///////////////////////            
      for(my = 290; my <= 300; my++)
            {
 ///////////////////Buys 200 Potions at Pot Shop Quickly//////////////////////
for(mx = 590; mx <= 620; mx++)
   {
      cr = GetPixel(hdcDC,mx,my);
      if(cr == crBuyPotsCheckMark)
      {
      SendMessage(HAK::hwndDC,WM_LBUTTONDOWN,0,MAKELPARAM(mx,my));
      SendMessage(HAK::hwndDC,WM_LBUTTONUP,0,MAKELPARAM(mx,my));      
      break;
      };  
   };
        //SetPixel(hdcDC,mx,my,RedDot);   
             }; 
            Sleep(5000);
    return 0;
};

int HAK::ProcWindows()
{

SetPriorityClass(HAK::hwndDC,HIGH_PRIORITY_CLASS);
SetPriorityClass(GetCurrentProcess(),NORMAL_PRIORITY_CLASS);
SetWindowPos(HAK::hwndDC, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
BringWindowToTop(HAK::hwndDC);
ShowWindow(HAK::hwndDC,SW_SHOW);

  return 0;                
};


///////////CODE TO SET PRIORITY//////////////////////////////////
/*
#include <windows.h>
//include Kernel32.lib in link parameters
//......

SetPriorityClass(GetCurrentProcess(),BELOW_NORMAL_PRIORITY_CLASS);
//......
/*
REALTIME_PRIORITY_CLASS------highest
HIGH_PRIORITY_CLASS
ABOVE_NORMAL_PRIORITY_CLASS
NORMAL_PRIORITY_CLASS
BELOW_NORMAL_PRIORITY_CLASS
IDLE_PRIORITY_CLASS------lowest
*/
 
///////////CODE TO SET PRIORITY ABOVE //////////////////////////////////
// Start understanding how to use ReadProcessmemory WriteProcessmemory

//memory addresses 
/*
DWORD HEALTH = 0x012E1B7C;  //Not correct address

int main(int argc, char *argv[]) 
{ 
    int x; 
    unsigned long IDHealth; 
    
    HWND HAK::hwndDC = FindWindow(0,"q (c)opyright 2010 Iron Will Games, LLC."); 
    // Better use ClassName 
    GetWindowThreadProcessId(hwwndDC, &IDHealth); 
    
    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, IDHealth); PROCESS_ALL_ACCESS
    // Another parameter to process is PROCESS_VM_READ
   // I think PROCESS_VM_READ is enough 
    
    ReadProcessMemory(hProcess, (LPVOID)PLAYER_X, &x, 4, NULL); 
   // I don't know why you took sizeof(x), the 4th parameter is the NumberOfBytesTORead, for example: 4. 
    
    std::cout<< x << "\n"; 
    
    
    return 0; 
}

*/

Try to make another small application which contains the code that doesn't work. I don't feel like going there 600+ lines of code

What compiler are you using? If codeblocks you need to link against libgdi32. Add "gdi32" to Project->Build options->Linker settings->Link libraries

Did you compile it in different compiler last time?

This above code works perfectly fine before I tried to class it.
I am reviewing multiple books to try and see where I might be crossing something. It compiles, but doesnt work.

The original top down style of this program I wrote runs perfectly fine and has no problems what so ever. I just get obsessive sometimes with working with different styles or using different programming features to keep refreshed in their usage. While trying to write neater looking and easier to read and understand code also so that once I master the use and looks at someone elses code who is walking through the same struggle I will have understanding to help them. Quest for understanding and knowledge, but it's got me a bit puzzled.

So far the HWND to the game screen is getting properly initialized. It appears some keys get sent to the scren, but appears the GetPixel() function may not be working, or possible the COLORREF member variables arent properly being declared.

I have stepped away from it to get some refreshment in hope answers my come in my sleep as it's a phenomina how I dreaming code populates working rationality with c++ and me.

Thank you for attempting to read the code I know I posted it as a full I didnt think really it was that large of a program, but I guess it was larger than I had considered.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.