mIRC Home    About    Download    Register    News    Help

Print Thread
How does mIRC do /drawsave ? #8438 26/01/03 06:01 PM
Joined: Dec 2002
Posts: 56
G
Gon_ Offline OP
Babel fish
OP Offline
Babel fish
G
Joined: Dec 2002
Posts: 56
I wondering this because mirc can do /drawsave very fast on hidden windows. Using normal screenshot methods, it's not possible to save images of invisible windows, as there is no Paint messages to it (so there is no image for you to save).

Im wondering if anyone has any insight on how mIRC can seemingly take shots of any window it likes visible or not?

Re: How does mIRC do /drawsave ? #8439 27/01/03 04:26 PM
Joined: Dec 2002
Posts: 87
V
vcv Offline
Babel fish
Offline
Babel fish
V
Joined: Dec 2002
Posts: 87
If you know the handle to a window, visible or not..you CAN take a snapshot of it... or rather, what is in the client area. i assume /drawsave uses the BitBlt API

Re: How does mIRC do /drawsave ? #8440 27/01/03 04:43 PM
Joined: Dec 2002
Posts: 89
N
Necroman Offline
Babel fish
Offline
Babel fish
N
Joined: Dec 2002
Posts: 89
No, you cannot. BitBlt only copies what's on the screen. If the window is hidden (or overlapped by another window), you will get nothing.

But that's not a problem for mIRC as it draws its graphics on the hidden memory DC (CreateCompatibleDC(), CreateCompatibleBitmap(), etc.), blitting it onto the screen when necessary. Therefore, saving the contents of the window becomes trivial.


Sincerely,
Necroman, #mIRC @ Undernet
Re: How does mIRC do /drawsave ? #8441 27/01/03 04:57 PM
Joined: Dec 2002
Posts: 87
V
vcv Offline
Babel fish
Offline
Babel fish
V
Joined: Dec 2002
Posts: 87
BitBlt only copies what is on screen?

Ok then.. tell me this. If you create an off-screen DC (CreateCompatibleDC, CreateCompatibleBitmap as you said), how do you copy what is on that DC to something on screen? What's that? Speak up! Yes.. it's BitBlt.

However, you are right in the aspect that you cannot BitBlt something that is off-screen from a window.. which is an on-screen DC.

However, if a DC was created sing CreateCompatibleDC, and you know the handle to it, BitBlt works just great.

Re: How does mIRC do /drawsave ? #8442 28/01/03 07:21 AM
Joined: Dec 2002
Posts: 89
N
Necroman Offline
Babel fish
Offline
Babel fish
N
Joined: Dec 2002
Posts: 89
Quote:
"If you know the handle to a window, visible or not..you CAN take a snapshot of it... or rather, what is in the client area"

Knowing the handle does not guarantee that you can take a shapshot of it, or what is in the client area, and BitBlt won't help you. That's all I meant.

As for what function Khaled uses to copy information from a memory DC - we don't know, and it doesn't matter. He could use StretchBlt as well.


Sincerely,
Necroman, #mIRC @ Undernet
Re: How does mIRC do /drawsave ? #8443 28/01/03 08:09 AM
Joined: Dec 2002
Posts: 56
G
Gon_ Offline OP
Babel fish
OP Offline
Babel fish
G
Joined: Dec 2002
Posts: 56
Thanks for the answers. I was interested in the method used so that I can add a drawsave like command to a DLL (The ability to save any window given a HWND would be cool). I realize now this is not possible. I have read there are some more complex methods, by playing with the window messages, but I don't want to do that.

Re: How does mIRC do /drawsave ? #8444 28/01/03 02:37 PM
Joined: Dec 2002
Posts: 87
V
vcv Offline
Babel fish
Offline
Babel fish
V
Joined: Dec 2002
Posts: 87
Actually it is possible if you try hard enough.

Re: How does mIRC do /drawsave ? #8445 28/01/03 04:51 PM
Joined: Dec 2002
Posts: 56
G
Gon_ Offline OP
Babel fish
OP Offline
Babel fish
G
Joined: Dec 2002
Posts: 56
I said, I know there are complex methods of doing it. However, there is no easy way of taking a 'snapshot' given a HWND, as you suggested. That is the kind of solution I was looking for. After reading the article i mentioned, and Necroman's posts, I realise that no such solution exists.

The article i mentioned in my post was written by the author of what I believe to be a well respected book on Windows Graphics Programming I'm sure if there was another method he would of mentioned it.

Re: How does mIRC do /drawsave ? #8446 02/02/03 04:42 AM
Joined: Jan 2003
Posts: 64
M
MegaZeroX Offline
Babel fish
Offline
Babel fish
M
Joined: Jan 2003
Posts: 64
I admit that I know very little about the subject matter, but isn't it possible that mIRC simply keeps a log of all of the draw routines that have been used on it and basically reproduces those to create a bitmap file?

Again, I know very little about the subject matter so this might've been the first thing you guys thought of *shrugs*

Re: How does mIRC do /drawsave ? #8447 02/02/03 11:50 AM
Joined: Dec 2002
Posts: 19
R
RG_ Offline
Pikka bird
Offline
Pikka bird
R
Joined: Dec 2002
Posts: 19
This would be slow.
gdi.dll is full of functions that could do that so there is no reason to use an other way.

Re: How does mIRC do /drawsave ? #8448 05/02/03 10:54 AM
Joined: Dec 2002
Posts: 56
G
Gon_ Offline OP
Babel fish
OP Offline
Babel fish
G
Joined: Dec 2002
Posts: 56
mIRC draws on canvas (DC) in memory , and copies this to the @window canvas. This is how /drawsave doesn't have a problem with hidden windows, it merely saves the contents of it's memory DC.


Last edited by Gon_; 05/02/03 10:57 AM.