Why BitBlt (screen capture) can't work on Win 98 & ME?

G

Guest

Hi,

Below source code I have try on Win 2k, XP & 2003 is work, but I try on
win 98 & ME the screen is capture black screen.

Dim dInt_dwRop As Integer = &HCC0020
Dim dImg As New
System.Drawing.Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height,
System.Drawing.Imaging.PixelFormat.Format16bppRgb565)
Dim g As System.Drawing.Graphics =
System.Drawing.Graphics.FromImage(dImg)
Dim dc2 As IntPtr = g.GetHdc()
Dim hdcSrc As IntPtr =
User32.GetWindowDC(User32.GetDesktopWindow())

Gdi32.BitBlt(dc2, 0, 0, Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height, hdcSrc, 0, 0, dInt_dwRop)

g.ReleaseHdc(dc2)

thk,

Fong
 
H

Herfried K. Wagner [MVP]

* =?Utf-8?B?Zm9uZzAx?= said:
Below source code I have try on Win 2k, XP & 2003 is work, but I try on
win 98 & ME the screen is capture black screen.

Dim dInt_dwRop As Integer = &HCC0020
Dim dImg As New
System.Drawing.Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height,
System.Drawing.Imaging.PixelFormat.Format16bppRgb565)

What color depth is selected on the Windows 98/Me machine?
 
H

Herfried K. Wagner [MVP]

* =?Utf-8?B?Zm9uZzAx?= said:
what you mean "Color depth"?

- Color quality?

I am referring to the screen's color depth that is selected in the
system's display options.
 
G

Guest

Hi Herfried K. Wagner,

System display color quality for win 98 & ME is 16 & 24 bits...
and screen resolution 1024 x 768


For the dwRop code is use &HCC0020
--------------------------------------------------------------------------------------
Gdi32.BitBlt(dc2, 0, 0, Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height, hdcSrc, 0, 0, dwRop)
--------------------------------------------------------------------------------------



thk,

Fong
 
H

Herfried K. Wagner [MVP]

* =?Utf-8?B?Zm9uZzAx?= said:
System display color quality for win 98 & ME is 16 & 24 bits...
and screen resolution 1024 x 768

I am not sure, but I would look that the color quality of the
destination bitmap and the desktop match.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top