Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Delphi] GetDC problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Sat Oct 20, 2007 1:17 pm    Post subject: [Delphi] GetDC problem Reply with quote

hello guYsSssS,

I got a problem with GetDC, I wanna check some colors, here's an example:
Code:
procedure TForm1.Timer1Timer(Sender: TObject);
var
 DCanvas: TCanvas;
 DHandle: HDC;
begin
 DHandle:=GetDC(0);
 if DHandle<>0 then
 begin
   try
     DCanvas:=TCanvas.Create;
     try
     DCanvas.Handle:=DHandle;
     if DCanvas.Pixels[293, 335] = RGB(239, 239, 239 )
       then
       begin
       Timer1.Enabled := false;
       Timer2.Enabled := false;

       Label4.Caption := inicurrent;
       Label4.Visible := true;
       Label5.Visible := true;


       if Checkbox1.Checked = true then
       PlaySound(PChar('sound_001.wav'),0,SND_ASYNC or SND_LOOP);
       
       ShowMessage (inicurrent);
       PlaySound(nil,0,0);
        end
     finally
       DCanvas.Free;
     end;
    finally
      if ReleaseDc(0, DHandle)<>1 then
        RaiseLastOSError;
    end;
 end
 else
   RaiseLastOSError;
end;


[For those who don't understand what this does: it can check colors on the entire screen.]

Well it does it on the entire screen cuz I seted GetDc's value to NULL/0.
But for example I wanna do that it's just checking in MapleStory. So:
Code:
procedure TForm1.Timer1Timer(Sender: TObject);
var
 DCanvas: TCanvas;
 DHandle: HDC;
 damn: HWND;
begin
 damn := FindWindow(NIL, 'MapleStory');
 DHandle:=GetDC(damn);
 if DHandle<>0 then
 begin
   try
     DCanvas:=TCanvas.Create;
     try
     DCanvas.Handle:=DHandle;
     if DCanvas.Pixels[293, 335] = RGB(239, 239, 239 )
       then
       begin
       Timer1.Enabled := false;
       Timer2.Enabled := false;

       Label4.Caption := inicurrent;
       Label4.Visible := true;
       Label5.Visible := true;


       if Checkbox1.Checked = true then
       PlaySound(PChar('sound_001.wav'),0,SND_ASYNC or SND_LOOP);
       
       ShowMessage (inicurrent);
       PlaySound(nil,0,0);
        end
     finally
       DCanvas.Free;
     end;
    finally
      if ReleaseDc(0, DHandle)<>1 then
        RaiseLastOSError;
    end;
 end
 else
   RaiseLastOSError;
end;


But why does it still dedect (the color) on my DESKTOP ?
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sat Oct 20, 2007 1:39 pm    Post subject: Reply with quote

gameguard block you
Back to top
View user's profile Send private message
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Sat Oct 20, 2007 1:41 pm    Post subject: Reply with quote

no, thats not the problem, if I use GetDc with maplestorys window so it should't check the colors on the desktop, but it does still.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites