473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Screenshot

Hi!

I'm a programmer in Delphi (and not good in English).
But a friend asked me for a proceure in C++
for a part of then Screen.

In Delphi is the proceure: show button.
I'm seraching for the aequivalent in C++.

THx Joachim

- - - - Procedure in Delphi - - -
function ScreenShot(x, y ,Width, Height: integer; bm: TBitMap):boolean;
var
dc: HDC;
lpPal : PLOGPALETTE;
begin
{Höhe und Breite testen}
result := false;
if ((Width <= 0) OR
(Height <= 0)) then begin
result := true;
exit;
end;
bm.Width := Width;
bm.Height := Height;
{ScreenDC holen}
dc := GetDc(0);
if (dc = 0) then begin
result := true;
exit;
end;
if (GetDeviceCaps(dc, RASTERCAPS) AND
RC_PALETTE = RC_PALETTE) then begin
GetMem(lpPal, sizeof(TLOGPALETTE) +
(255 * sizeof(TPALETTEENTRY)));
FillChar(lpPal^, sizeof(TLOGPALETTE) +
(255 * sizeof(TPALETTEENTRY)), #0);
lpPal^.palVersion := $300;
lpPal^.palNumEntries :=GetSystemPaletteEntries(dc,
0, 256, lpPal^.palPalEntry);
if (lpPal^.PalNumEntries <0) then begin
bm.Palette := CreatePalette(lpPal^);
end;
FreeMem(lpPal, sizeof(TLOGPALETTE) +
(255 * sizeof(TPALETTEENTRY)));
end;
BitBlt(bm.Canvas.Handle, 0, 0, Width, Height, Dc,
x, y, SRCCOPY);
ReleaseDc(0, dc);
end;
--
Joachim Mohr Tübingen
http://www.joachimmohr.de/neu.html
Nov 27 '07 #1
12 1907
Joachim Mohr wrote:
I'm a programmer in Delphi (and not good in English).
But a friend asked me for a proceure in C++
for a part of then Screen.

In Delphi is the proceure: show button.
I'm seraching for the aequivalent in C++.

THx Joachim

- - - - Procedure in Delphi - - -
function ScreenShot(x, y ,Width, Height: integer; bm:
TBitMap):boolean; var
bool ScreenShot(int x, int y, int Width, int Height,
TBitMap& bm)

{
dc: HDC;
lpPal : PLOGPALETTE;
begin
{Höhe und Breite testen}
// Höhe und Breite testen
result := false;
bool result = false;
if ((Width <= 0) OR
if (Width <= 0 or
(Height <= 0)) then begin
Height <= 0) {
result := true;
exit;
return true;
end;
}
bm.Width := Width;
bm.Height := Height;
bm.Width = Width;
bm.Height = Height;
{ScreenDC holen}
// ScreenDC holen
dc := GetDc(0);
HDC dc = GetDC(0);
if (dc = 0) then begin
if (dc == 0) {
result := true;
exit;
return true;
end;
}
if (GetDeviceCaps(dc, RASTERCAPS) AND
if (GetDeviceCaps(dc, RASTERCAPS) and
RC_PALETTE = RC_PALETTE) then begin
RC_PALETTE == RC_PALETTE) { // WHAT??? A==A?
GetMem(lpPal, sizeof(TLOGPALETTE) +
(255 * sizeof(TPALETTEENTRY)));
FillChar(lpPal^, sizeof(TLOGPALETTE) +
(255 * sizeof(TPALETTEENTRY)), #0);
lpPal = GlobalAlloc(sizeof(TLOGPALETTE) + 255 *
sizeof(TPALETTEENTRY), GMEM);

(or something like that, ask in a Windows newsgroup)
lpPal^.palVersion := $300;
lpPal->palVersion = 0x300;
lpPal^.palNumEntries :=GetSystemPaletteEntries(dc,
0, 256, lpPal^.palPalEntry);
lpPal->palNumEntries = GetSystemPaletteEntries(dc, 0, 256,
lpPal->palPalEntry);
if (lpPal^.PalNumEntries <0) then begin
if (lpPal->PalNumEntries != 0) {
bm.Palette := CreatePalette(lpPal^);
bm.Palette = CreatePalette(lpPal);
end;
}
FreeMem(lpPal, sizeof(TLOGPALETTE) +
(255 * sizeof(TPALETTEENTRY)));
GlobalFree(lpPal);
end;
}
BitBlt(bm.Canvas.Handle, 0, 0, Width, Height, Dc,
x, y, SRCCOPY);
BitBlt(bm.Canvas.Handle, 0, 0, Width, Height, dc, x, y, SRCCOPY);
ReleaseDc(0, dc);
ReleaseDC(dc, 0);
end;
}

I am sure it won't work the first time, you'll need to tweak it.
I charge $200/hr, although my availability is limited.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Nov 27 '07 #2
On Tue, 27 Nov 2007 12:42:40 -0500, Victor Bazarov wrote:
I am sure it won't work the first time, you'll need to tweak it. I
charge $200/hr, although my availability is limited.
Aren't you supposed to charge first?

--
Sohail Somani
http://uint32t.blogspot.com
Nov 27 '07 #3
Sohail Somani wrote:
On Tue, 27 Nov 2007 12:42:40 -0500, Victor Bazarov wrote:
>I am sure it won't work the first time, you'll need to tweak it. I
charge $200/hr, although my availability is limited.

Aren't you supposed to charge first?
Not sure what you mean.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Nov 27 '07 #4
On Tue, 27 Nov 2007 13:21:55 -0500, Victor Bazarov wrote:
Sohail Somani wrote:
>On Tue, 27 Nov 2007 12:42:40 -0500, Victor Bazarov wrote:
>>I am sure it won't work the first time, you'll need to tweak it. I
charge $200/hr, although my availability is limited.

Aren't you supposed to charge first?

Not sure what you mean.

V
Me either.

--
Sohail Somani
http://uint32t.blogspot.com
Nov 27 '07 #5
Sohail Somani wrote:
On Tue, 27 Nov 2007 13:21:55 -0500, Victor Bazarov wrote:
>Sohail Somani wrote:
>>On Tue, 27 Nov 2007 12:42:40 -0500, Victor Bazarov wrote:

I am sure it won't work the first time, you'll need to tweak it. I
charge $200/hr, although my availability is limited.

Aren't you supposed to charge first?

Not sure what you mean.

V

Me either.
Then why did you post if you're unsure what you mean?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Nov 27 '07 #6
Victor Bazarov schrieb:
if (Width <= 0 or
Is there any reason why C++ introduces "and", "or" and "not" keywords
instead of the beautful &&, || and ! ones?

Greetings,
Johannes

--
"Viele der Theorien der Mathematiker sind falsch und klar
Gotteslästerlich. Ich vermute, dass diese falschen Theorien genau
deshalb so geliebt werden." -- Prophet und Visionär Hans Joss aka
HJP in de.sci.mathematik <47**********************@news.sunrise.ch>
Nov 27 '07 #7
Johannes Bauer wrote:
Victor Bazarov schrieb:
> if (Width <= 0 or

Is there any reason why C++ introduces "and", "or" and "not" keywords
instead of the beautful &&, || and ! ones?
Not "instead", "along". And the answer is, convenience, I guess.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Nov 27 '07 #8
On 2007-11-27 21:20, Johannes Bauer wrote:
Victor Bazarov schrieb:
> if (Width <= 0 or

Is there any reason why C++ introduces "and", "or" and "not" keywords
instead of the beautful &&, || and ! ones?
You can use || if you want, I believe that Victor used or simply to make
the code more similar to the original.

--
Erik Wikström
Nov 27 '07 #9
"Erik Wikström" <Er***********@telia.comwrote in message
news:Xe***************@newsb.telia.net...
On 2007-11-27 21:20, Johannes Bauer wrote:
>Victor Bazarov schrieb:
>> if (Width <= 0 or

Is there any reason why C++ introduces "and", "or" and "not" keywords
instead of the beautful &&, || and ! ones?

You can use || if you want, I believe that Victor used or simply to make
the code more similar to the original.
Yes, that was my feeling too. That and would be more familiar to someone
used to Pascal than &&. You can use either in C++.
Nov 27 '07 #10
Victor Bazarov wrote:
Sohail Somani wrote:
On Tue, 27 Nov 2007 12:42:40 -0500, Victor Bazarov wrote:
I am sure it won't work the first time, you'll need to tweak it. I
charge $200/hr, although my availability is limited.
Aren't you supposed to charge first?

Not sure what you mean.
I think he meant, "why post your rates after you've given the answer."
Naturally, your initial one was a free intro, and the "tweaks" are what
will cost.

Brian
Nov 27 '07 #11
Default User wrote:
Victor Bazarov wrote:
>Sohail Somani wrote:
>>On Tue, 27 Nov 2007 12:42:40 -0500, Victor Bazarov wrote:

I am sure it won't work the first time, you'll need to tweak it. I
charge $200/hr, although my availability is limited.

Aren't you supposed to charge first?

Not sure what you mean.

I think he meant, "why post your rates after you've given the answer."
Naturally, your initial one was a free intro, and the "tweaks" are
what will cost.
Yes, that's how I intended it. Imagine if we charged for every answer
we give here... What's that saying, "if I had a nickel every time I
heard that"?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Nov 27 '07 #12
Tank Youe very much. I think: it's useful

Greetungs from Tübingen, Germany
--
Joachim Mohr Tübingen
http://www.joachimmohr.de/neu.html
Nov 28 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Saqib Ali | last post by:
Hello All, A while back I ran into a site which enabled to the users to get a ScreenShot of a specified webpage as viewed in Mac OS X's web browser (safari). I lost my bookmark in a machine...
4
by: Aaron | last post by:
can i use asp.net to capture a screen shot of a webpage? something like this? http://img.nameintel.com/Thumbnails/tn.html?domain=cnn.com Is there a script that does this? Aaron
1
by: jani | last post by:
Hi all, does anyone know how to take a screenshot of a winform using c#? I have an Add-In program for MS Word in c#, and want to render the WinForm to a gif image, then insert the screenshot into...
6
by: Geert M | last post by:
Hello, I'm busy working on a "small" sms application. I'm able to access all remote pc's (for which I am Local Admin) information using WMI and API calls for some things. But I can't figure out...
3
by: Dean Slindee | last post by:
I would like to capture a picture of the active window on the screen to use in an error routine. Like the following, which captures the entire desktop: Dim objRectangle As Rectangle =...
1
by: Yosh | last post by:
I want to be able to capture a screenshot of a windows form that is hidden. My goal here is to create a form of any particular size (the size could be larger than the screen), get a screenshot, and...
2
by: Java Boy | last post by:
Is it possible to fetch a webpage and take screenshot of it like it displays in browser and then store it in jpg/gif thanks -- Geeks Home www.fahimzahid.com
19
by: mareeus | last post by:
Hi, Are there any ways I could get a screenshot of a web-page at a specific address in jpeg via php script? Regards, Marius.
5
by: sharkbate24 | last post by:
Hello, I need some help please. I already know how to capture the full screen, because the .NET framework simplifies it a lot. Anyway, I was wondering, is it possible to capture a Window /...
13
by: epid | last post by:
I have a problem that I'm not sure there is a solution for... I have a lookup field in a table that allows multiple values and the display control is set to be a List Box. The list box looks fine on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.