Solved

Copy a not visible From into a Bitmap

Posted on 2001-06-12
28
282 Views
Last Modified: 2010-04-06
Hi,

Yesterdy I downloaded the Billenium Effects (just for fun )from
http://www.billeniumsoft.com/download.htm

I like to know how they copy the Form in the TFormTransitions in Bitmap to make the Transsion

Well with TFormGetFormImage it not possible to display some TWinControl Components like BitBtn or Radiobtn.

I will enjoy this discussion :-)))

Cesario
0
Comment
Question by:Cesario
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 7
  • 5
  • +5
28 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6181038
listening ;-)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 6181912
And paintTo doesnt't work either?

Haven't tried it, just thought I'd ask...

Tim.
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6181926
I even save it to JPEF and sent it through socket :)

procedure frmCapture.SaveForm(FName: string; nQuality: integer);
Var
  JP  : TJpegImage;
  BMP : TBitmap;
  SCHandle : THandle;
begin
  SCHandle := GetWindowDC(frmCapture.Handle);
  if SCHandle<>0 then
  begin
    BMP:= TBitmap.Create;
    BMP.Width :=frmCapture.Width;
    BMP.Height:=frmCapture.Height;
    JP := TJpegImage.Create;
    if BitBlt(BMP.Canvas.Handle, 0, 0, frmCapture.Width, frmCapture.Height, SCHandle, 0, 0, SRCCOPY) then
    try
      JP.Assign(BMP);
      JP.CompressionQuality:=nQuality;
      JP.SaveToFile(FName);
    finally
      JP.Free;
      BMP.Free;
    end;
  end;
end;
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Author Comment

by:Cesario
ID: 6181948
Hello FrodoBeggins,


get a Canvas from an invisible Form ?
You Code will not work.

I dont need a JPEG cause I need the Bitmap to make some transsion effect ;-)

Cesario
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6181954
That (BitBlt(...)) is very quick method to capture the whole form. You even can capture the screen (if you use SCHandle:=windows.GetDC(0);)
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6181971
That (BitBlt(...)) is very quick method to capture the whole form. You even can capture the screen (if you use SCHandle:=windows.GetDC(0);)
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6181977
Uh. You have canvas, but nothing in it...
0
 
LVL 8

Author Comment

by:Cesario
ID: 6181981
Hi TimYates

Paintto does not work with all Components like BitBtn....
0
 
LVL 35

Expert Comment

by:TimYates
ID: 6182007
Ahhh...
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6182021
There is a walkarround. Make the form visible outside the monitor, capture it, make it invisivle again and move it back ;)
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6182165
Here is the solution for NT/2000, but the code posted there doesn't work in win9x. The trick is basically to hook the BeginPaint API, then post a WM_PAINT. The hook must be established in the context of the process, which owns the to-be-snapshoted window, of course (-> dll).

http://www.fengyuan.com/article/wmprint.html

If you combine Feng Yuan's idea with my code hooking package "madCodeHook", you can make this solution work for all systems.

Regards, Madshi.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6182170
0
 
LVL 8

Author Comment

by:Cesario
ID: 6182253
Thanx Madshi for this good article.

Well I need some time to code it in Delphi.

do you have a fiqure about Billenium Effects.
How they draw the Forms ?

Have a nice day ;-)

Cesario
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6182303
Hi Cesario,

I'm sorry, I don't know "Billenium Effects"...

Regards, Madshi.
0
 
LVL 8

Author Comment

by:Cesario
ID: 6182312
Hi Madshi,
see the linke in my question
0
 
LVL 8

Author Comment

by:Cesario
ID: 6182313
Hi Madshi,
see the linke in my question
0
 
LVL 5

Expert Comment

by:Gwena
ID: 6182913
listening :-)
0
 
LVL 4

Expert Comment

by:jeurk
ID: 6183070
Hello Madshi,
This is the link I was searching a while ago :)

Everybody,
Is someone willing to translate that sample to delphi ?
How much points would you ask :) ?
I want a working sample of course...

Let me know...
Thanks
John.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6183311
Hi John!

Perhaps (if I find a bit time during the next weekend) I'll write a(nother) little demo for my API hooking package. This demo would do exactly what is asked in this question. Of course this demo would then need (and ship with) "madCodeHook"...   :-)

Regards, Madshi.
0
 
LVL 8

Author Comment

by:Cesario
ID: 6184937
Madshi,

good idea.....

Best Regards

Cesario
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6197999
I'm not sure how these transition effects are made. Perhaps they're calling the "Paint" methods of all child windows, I'm not sure. Anyway, if I understand it correctly, then it is limited to Delphi forms of your own process, right?

Well, that is in fact something different then what I was thinking about (and what is described in FengYuan's article). Because they "only" handle Delphi forms of their own process, they have it much easier!

Anyway, my demo is ready, you can download the zip file here:

http://www.madshi.net/Snapshot.zip

It contains both binaries and sources. However, in order to compile the sources, you need D4 or D5, and you must have "madCodeHook" installed.

I've tested the demo under win9x only, but I guess it will work in winNT, too (perhaps someone of you with a running winNT system can check that?).

Known limitations:
(1) Be careful when snapshotting invisible/minimized windows. Most of the time it works without any problems, but sometimes strange effects or even crashes can happen, because the window get called with WM_PAINT, even though they're invisible. That *might* confuse some windows. E.g. Delphi's main window makes problems when being snapshotted with my demo while being minimized...   :-/
(2) Not all windows/controls (including some of my own :-) behave totally correctly. When they get a WM_PAINT message, they don't call BeginPaint, nor do they use the device context that is sent with WM_PAINT. Instead they simply use an already opened device context. Such controls are not included in the snapshots. E.g. the clock of the taskbar is not included, the rest is.

Regards, Madshi.
0
 
LVL 8

Author Comment

by:Cesario
ID: 6220604
Hi Madshi,

you demo doesent work on (WinNt4 SP6).
I will try tommorow to test it on Win98...


Thanx ;-)

Cesario
0
 
LVL 20

Accepted Solution

by:
Madshi earned 300 total points
ID: 6221143
How does it behave in WinNt4? Does it produce exceptions? Or do you get empty screenshots only? Or... ? Thnx...
0
 
LVL 8

Author Comment

by:Cesario
ID: 6221228
Hi Madshi,

No Exceptions but MSPAINT show me an empty sheet ( Screenshots ).

Regards

Cesario
0
 
LVL 8

Author Comment

by:Cesario
ID: 6227212
Ok....
The Points are for Madshi...

Best Regards

Cesario
0
 
LVL 20

Expert Comment

by:Madshi
ID: 6227344
Thank you, did it work in win9x? I'll try winNT later, after I found the time to install it first...   :-)

Regards, Madshi.
0
 
LVL 8

Author Comment

by:Cesario
ID: 6227357
Win Win9x yes but WinNt no :-(

ciao

Cesario
0
 

Expert Comment

by:kbb2
ID: 7588798
The link you provided Madshi is no longer valid! Where can I find it?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi and Access based Enumeration 9 85
Installshield for Embarcadero EX 10.1 Berlin 4 86
Delphi: sending SMS on android platform 1 94
Get weeknumber and year from date 4 53
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question