Solved

Storing image useing hDC

Posted on 1998-11-17
4
254 Views
Last Modified: 2010-04-04
 How to use hDC(and what is hDC) to store big image?
I'm doing graphics editor.
0
Comment
Question by:jack_p50
  • 2
4 Comments
 
LVL 2

Expert Comment

by:Thaddy
ID: 1347110
hDC means 'Handle' to a 'Device Context'
0
 
LVL 4

Accepted Solution

by:
BoRiS earned 30 total points
ID: 1347111
jack_p50

Thaddy is totally right on the meaning and here is an example on how to use it this does a simple screen capture and dumps it on to the forms canvas..

unit scrcap;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Buttons, ExtCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    SpeedButton1: TSpeedButton;
    procedure SpeedButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.SpeedButton1Click(Sender: TObject);
var
  ScreenDC : HDC;
begin
  ScreenDC:=CreateDC('DISPLAY',nil,nil,nil);
  BitBlt(Image1.Canvas.Handle, 0,0, Image1.Width, Image1.Height,
  ScreenDC, 0,0, SRCCOPY);
  Image1.Refresh;
  DeleteDC(ScreenDC);
end;

end.

Later
BoRiS
0
 
LVL 4

Author Comment

by:jack_p50
ID: 1347112
Please give me syntax of all hDC-related funtions and procs (i.e. createDC).
Btw, I don't want to use TImage or TBitmap. I need ability to get memory and access
any byte of it.
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1347113
jack_p50

I would give you all the syntax etc that go with HDC but we will be here forever, the best thing to do is open the win32.hlp (API help file) and search for CreateDC it will explain the whole thing to you, as well as give you the procedures that go with CreateDC etc...

Later
BoRiS
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

810 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