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 


Proper window class for a Disassembler in C++
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Mon Jan 11, 2010 10:11 am    Post subject: Proper window class for a Disassembler in C++ Reply with quote

I'm currently in development of a simple disassembler made in C++ (i believe i'm about 1/3 - 1/2 finished), but atm i am just using a simple console window. But since i really wish to get a proper gui for it as well (something like CE's) i was wondering which type of window i should print it to.

CE's Memory View is awesome, since it doesen't "flash/blink" when updating the addresses, though when you scroll fast, it seems to take up quite a lot of CPU usage compared to OllyDbg. I know that CE uses a TPaintBox, which obviously doesen't exist when i wish to use pure Win API (i'd love to avoid using dialogs)

So, what would be a proper class, with the possibility to change all the text very fast, without taking up too much CPU or flashing?, Win32 only please, no Dialogs

Best regards, and thank you Anden100
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Mon Jan 11, 2010 12:56 pm    Post subject: Reply with quote

I think TPaintBox is a class 'made' by Delphi. It is no Win32 thing, its a custom control and delphi creates code that will manually draw the control instead of having windows do it. (Not 100% sure on this though)
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Mon Jan 11, 2010 1:22 pm    Post subject: Re: Proper window class for a Disassembler in C++ Reply with quote

tombana wrote:
I think TPaintBox is a class 'made' by Delphi. It is no Win32 thing, its a custom control and delphi creates code that will manually draw the control instead of having windows do it. (Not 100% sure on this though)


i'd like to quote myself:

Anden100 wrote:
I know that CE uses a TPaintBox, which obviously doesen't exist when i wish to use pure Win API (i'd love to avoid using dialogs)
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Mon Jan 11, 2010 2:08 pm    Post subject: Reply with quote

Sorry, didn't read properly... but what I kinda meant to say was that you will probably need to create your own custom control as well, and do all the drawing and so on.
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Mon Jan 11, 2010 2:21 pm    Post subject: Reply with quote

tombana wrote:
Sorry, didn't read properly... but what I kinda meant to say was that you will probably need to create your own custom control as well, and do all the drawing and so on.


That is pretty much what i feared, since i never really looked into custom controls Sad
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25796
Location: The netherlands

PostPosted: Mon Jan 11, 2010 3:14 pm    Post subject: Reply with quote

a paintbox is just a wrapper for a window that sends of an event when something needs to be redrawn
the way ce does it is render everything to an off-screen bitmap, and when a part of the window becomes invalidated, just bitblt the offscreen bitmap into that location (don't do a full repaint, that's what causes the white flicker)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Jan 11, 2010 9:11 pm    Post subject: Reply with quote

you can send WM_SETREDRAW to the control to ensure that it doesn't redraw anything until you're 100% done doing whatever it is you're doing.

maybe a listbox or a listview control would be a good base for custom stuff.

with a list box, you can use LB_INITSTORAGE to speed things up as well.
http://msdn.microsoft.com/en-us/library/bb761319%28VS.85%29.aspx
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Jan 11, 2010 9:32 pm    Post subject: Reply with quote

slovach wrote:
you can send WM_SETREDRAW to the control to ensure that it doesn't redraw anything until you're 100% done doing whatever it is you're doing.

maybe a listbox or a listview control would be a good base for custom stuff.

with a list box, you can use LB_INITSTORAGE to speed things up as well.
http://msdn.microsoft.com/en-us/library/bb761319%28VS.85%29.aspx


how do you prevent that in java? I've been trying to figure out for awhile

_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Jan 11, 2010 9:49 pm    Post subject: Reply with quote

prevent what, redraw? flicker?

i have no idea, looking up java double buffering would probably be a good start.
maybe the control has a redraw method or property you could take advantage of?


never really used java, can't help past that.
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Tue Jan 12, 2010 2:05 am    Post subject: Reply with quote

@DB, i pretty much knew that, just a bit confused around how the line highlighting is done?

@slovach, What you are actually saying is, that i can use a ListBox, and then WM_SETREDRAW to FALSE, and then only update the window when needed, and avoid the flickering?
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jan 12, 2010 4:03 am    Post subject: Reply with quote

maybe

you could subclass it and implement double buffering like DB

have it do all its drawing on an offscreen buffer first, then blit that
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Tue Jan 12, 2010 4:42 am    Post subject: Reply with quote

slovach wrote:
maybe

you could subclass it and implement double buffering like DB

have it do all its drawing on an offscreen buffer first, then blit that


That was my idea at first, i think ill just go with that, except that i would just need to figure out how to do it first O.o, could you just create some sort of picture, and then show that?
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Jan 12, 2010 5:36 am    Post subject: Reply with quote

Anden100 wrote:
could you just create some sort of picture, and then show that?


this is basically the gist of it, the idea behind double buffering is simple.

basically you're handling all your drawing in an offscreen buffer so the user never sees an incomplete image. you're only presenting a finished picture. instead of drawing directly to the DC, do something like:

get a DC for the control, GetDC()
create a memory DC (your offscreen surface), CreateCompatibleDC()
create a bitmap, CreateCompatibleBitmap()
SelectObject() the bitmap into the memory DC

when you draw something now (text, whatever), draw to the memory DC.

when you're done and ready, bitblt the memory dc to the dc, bam.
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Tue Jan 12, 2010 10:04 am    Post subject: Reply with quote

slovach wrote:
Anden100 wrote:
could you just create some sort of picture, and then show that?


this is basically the gist of it, the idea behind double buffering is simple.

basically you're handling all your drawing in an offscreen buffer so the user never sees an incomplete image. you're only presenting a finished picture. instead of drawing directly to the DC, do something like:

get a DC for the control, GetDC()
create a memory DC (your offscreen surface), CreateCompatibleDC()
create a bitmap, CreateCompatibleBitmap()
SelectObject() the bitmap into the memory DC

when you draw something now (text, whatever), draw to the memory DC.

when you're done and ready, bitblt the memory dc to the dc, bam.


omg -.-, how simple can it possibly be?, i feel embarrassed for such a question -.-, but tyvm for the list of api's, sure saves alot of googl'ing Razz
Back to top
View user's profile Send private message
igoticecream
Grandmaster Cheater Supreme
Reputation: 0

Joined: 23 Apr 2006
Posts: 1807
Location: 0x00400000

PostPosted: Tue Jan 12, 2010 7:36 pm    Post subject: Reply with quote

Dark Byte wrote:
a paintbox is just a wrapper for a window that sends of an event when something needs to be redrawn
the way ce does it is render everything to an off-screen bitmap, and when a part of the window becomes invalidated, just bitblt the offscreen bitmap into that location (don't do a full repaint, that's what causes the white flicker)


yea called "double buffer", avoid flicker

_________________
+~
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
Goto page 1, 2  Next
Page 1 of 2

 
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