Solved

Storing image useing hDC

Posted on 1998-11-17
4
245 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
Comment Utility
hDC means 'Handle' to a 'Device Context'
0
 
LVL 4

Accepted Solution

by:
BoRiS earned 30 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now