View previous topic :: View next topic |
Author |
Message |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Mon Jan 11, 2010 10:11 am Post subject: Proper window class for a Disassembler in C++ |
|
|
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 |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Mon Jan 11, 2010 12:56 pm Post subject: |
|
|
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 |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Mon Jan 11, 2010 1:22 pm Post subject: Re: Proper window class for a Disassembler in C++ |
|
|
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 |
|
 |
tombana Master Cheater
Reputation: 2
Joined: 14 Jun 2007 Posts: 456 Location: The Netherlands
|
Posted: Mon Jan 11, 2010 2:08 pm Post subject: |
|
|
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 |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Mon Jan 11, 2010 2:21 pm Post subject: |
|
|
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
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
|
Posted: Mon Jan 11, 2010 3:14 pm Post subject: |
|
|
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 |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Jan 11, 2010 9:11 pm Post subject: |
|
|
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 |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Mon Jan 11, 2010 9:32 pm Post subject: |
|
|
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 |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Mon Jan 11, 2010 9:49 pm Post subject: |
|
|
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 |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Tue Jan 12, 2010 2:05 am Post subject: |
|
|
@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 |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Jan 12, 2010 4:03 am Post subject: |
|
|
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 |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Tue Jan 12, 2010 4:42 am Post subject: |
|
|
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 |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Jan 12, 2010 5:36 am Post subject: |
|
|
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 |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Tue Jan 12, 2010 10:04 am Post subject: |
|
|
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
|
|
Back to top |
|
 |
igoticecream Grandmaster Cheater Supreme
Reputation: 0
Joined: 23 Apr 2006 Posts: 1807 Location: 0x00400000
|
Posted: Tue Jan 12, 2010 7:36 pm Post subject: |
|
|
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 |
|
 |
|