Jump to content

_GDIPlus_BitmapCreateFromHBITMAP Failing On Windows Server 2003


Recommended Posts

I have a program that takes a screenshot (Part of the Tesseract AutoIT project). The trouble is in the CaptureToTIFF function BUT ONLY on Windows Server 2003. Everything works great on XP or 7.

I've put the function in its entirety below but I know where, in particular, the problem lies.

To start:

I can get the handle to the screenshot with either of these commands...

$hBitmap2 = _ScreenCapture_CaptureWnd("", $hwnd2, 0, 0, -1, -1, False)

$hBitmap3 = _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\GDIPlus_Image.jpg", $hwnd2,0, 0, -1, -1, False)

The problem occurs here:

$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap3)

On Windows Server 2003, the function fails to return a handle to the Bitmap object. It returns "0" every time.

Can anyone tell me why this would be? Our server does have this patch installed but I don't know if it's related to the problem or not:

http://support.microsoft.com/kb/958911

Thanks!

Func CaptureToTIFF($win_title = "", $win_text = "", $ctrl_id = "", $sOutImage = "", $scale = 1, $left_indent = 0, $top_indent = 0, $right_indent = 0, $bottom_indent = 0)
;MsgBox(0,"","TIFF Scale: " & $scale)
Local $hWnd, $hwnd2, $hDC, $hBMP, $hImage1, $hGraphic, $CLSID, $tParams, $pParams, $tData, $i = 0, $hImage2, $pos[4]
Local $Ext = StringUpper(StringMid($sOutImage, StringInStr($sOutImage, ".", 0, -1) + 1))
;Local $giTIFColorDepth = 24
Local $giTIFColorDepth = 24
Local $giTIFCompression = $GDIP_EVTCOMPRESSIONNONE
;MsgBox(0,"Looking for this window title1",$win_title)
; If capturing a control
if StringCompare($ctrl_id, "") <> 0 Then

$hwnd2 = ControlGetHandle($win_title, $win_text, $ctrl_id)
$pos = ControlGetPos($win_title, $win_text, $ctrl_id)
Else

; If capturing a window
;MsgBox(0,"Looking for this window title2",$win_title)

if StringCompare($win_title, "") <> 0 Then

$hwnd2 = WinGetHandle($win_title, $win_text)
MsgBox(0,"","window handle is " & $hwnd2)
$pos = WinGetPos($win_title, $win_text)
Else

; If capturing the desktop
$hwnd2 = ""
$pos[0] = 0
$pos[1] = 0
$pos[2] = @DesktopWidth
$pos[3] = @DesktopHeight
EndIf
EndIf

; Capture an image of the window / control
if IsHWnd($hwnd2) Then

$winactval = WinActivate($win_title, $win_text)
MsgBox(0,"$winactval",$winactval)
MsgBox(0,"winhan",$hwnd2)
;THE TROUBLE IS HERE!
$hBitmap2 = _ScreenCapture_CaptureWnd("", $hwnd2, 0, 0, -1, -1, False)
$hBitmap3 = _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\GDIPlus_Image.jpg", $hwnd2,0, 0, -1, -1, False)
msgbox(0,"$hBitmap2",$hBitmap2)
msgbox(0,"$hBitmap3",$hBitmap3)

Else

$hBitmap2 = _ScreenCapture_Capture("", 0, 0, -1, -1, False)
EndIf

_GDIPlus_Startup ()

; Convert the image to a bitmap
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap3)
MsgBox(0,"","$hImage2 value -Failed if 0- : " & $hImage2)

$hWnd = _WinAPI_GetDesktopWindow()
$hDC = _WinAPI_GetDC($hWnd)
$hBMP = _WinAPI_CreateCompatibleBitmap($hDC, ($pos[2] * $scale) - ($right_indent * $scale), ($pos[3] * $scale) - ($bottom_indent * $scale))

_WinAPI_ReleaseDC($hWnd, $hDC)
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)
_GDIPLus_GraphicsDrawImageRect($hGraphic, $hImage2, 0 - ($left_indent * $scale), 0 - ($top_indent * $scale), ($pos[2] * $scale) + $left_indent, ($pos[3] * $scale) + $top_indent)
$CLSID = _GDIPlus_EncodersGetCLSID($Ext)

; Set TIFF parameters
$tParams = _GDIPlus_ParamInit(2)
$tData = DllStructCreate("int ColorDepth;int Compression")
DllStructSetData($tData, "ColorDepth", $giTIFColorDepth)
DllStructSetData($tData, "Compression", $giTIFCompression)
_GDIPlus_ParamAdd($tParams, $GDIP_EPGCOLORDEPTH, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "ColorDepth"))
_GDIPlus_ParamAdd($tParams, $GDIP_EPGCOMPRESSION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Compression"))
If IsDllStruct($tParams) Then $pParams = DllStructGetPtr($tParams)

; Save TIFF and cleanup
_GDIPlus_ImageSaveToFileEx($hImage1, $sOutImage, $CLSID, $pParams)
if FileExists($debugdir&"debug.txt") then
Msgbox(0,"",$hImage1&"====="&$sOutImage&"====="&$CLSID&"====="&$pParams)
EndIf
_GDIPlus_ImageDispose($hImage1)
_GDIPlus_ImageDispose($hImage2)
_GDIPlus_GraphicsDispose ($hGraphic)
_WinAPI_DeleteObject($hBMP)
;added this.
_WinAPI_DeleteObject($hBitmap2)
_WinAPI_DeleteObject($hBitmap3)
_GDIPlus_Shutdown()
EndFunc
Link to comment
Share on other sites

$hBitmap3 is set when $hwnd2 is a handle therefore you should place a check

if ishwnd($hwnd2) then $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap3)

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Thank you for your input. However, I know that $hwnd2 is a valid handle because I can see its value when I echo it out with a MsgBox.

$hBitmap3 is set when $hwnd2 is a handle therefore you should place a check

if ishwnd($hwnd2) then $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap3)

Link to comment
Share on other sites

Link to comment
Share on other sites

Thanks for your help. Turns out I was wrong about where the problem lies. I started echoing out all of the values and determined that "CreateCompatibleBitmap" is the command that's failing and preventing my function from completing its mission.

A little googling reveals that this is a problem related to Windows Terminal Server 2003:

http://us.generation-nt.com/strange-case-createcompatiblebitmap-mr-hyde-help-6753132.html

The solution offered by Microsoft is here:

http://support.microsoft.com/default.aspx?scid=kb;en-us;247904

But... I am WAY over my head in understanding the KB article.

On my Windows 7 computer "SystemPages" is a REG-DWORD set to Hex value 183000.

On my Terminal Server that value isn't even set at all.

Has anyone else run into this before?

I've found that if I reduce the "scale" of the function that the command completes successfully. This problem is definitely due to insufficient memory being available to complete the request. I'd like to understand how to determine that limit and how to increase it, if possible.

Edited by inm101
Link to comment
Share on other sites

From reading just a few lines... don't go that way, seems more like open-heart surgery to me. If it works with reduced scale, better look for a way to split your requests into smaller portions and iterate them.

Link to comment
Share on other sites

What is the purpose of the lines using _WinAPI_CreateCompatibleBitmap() function? As far as I can see is that you create a bitmap with this method which you convert afterwards to a GDI+ bitmap.

You can try to create an empty bitmap using GDI+ instead:

; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_BitmapCreateFromScan0
; Description ...: Creates a Bitmap object based on an array of bytes along with size and format information
; Syntax.........: _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight[, $iStride = 0[, $iPixelFormat = 0x0026200A[, $pScan0 = 0]]])
; Parameters ....: $iWidth         - The bitmap width, in pixels
;                  $iHeight     - The bitmap height, in pixels
;                  $iStride     - Integer that specifies the byte offset between the beginning of one scan line and the next. This
;                  +is usually (but not necessarily) the number of bytes in the pixel format (for example, 2 for 16 bits per pixel)
;                  +multiplied by the width of the bitmap. The value passed to this parameter must be a multiple of four
;                  $iPixelFormat - Specifies the format of the pixel data. Can be one of the following:
;                  |$GDIP_PXF01INDEXED   - 1 bpp, indexed
;                  |$GDIP_PXF04INDEXED   - 4 bpp, indexed
;                  |$GDIP_PXF08INDEXED   - 8 bpp, indexed
;                  |$GDIP_PXF16GRAYSCALE - 16 bpp, grayscale
;                  |$GDIP_PXF16RGB555    - 16 bpp; 5 bits for each RGB
;                  |$GDIP_PXF16RGB565    - 16 bpp; 5 bits red, 6 bits green, and 5 bits blue
;                  |$GDIP_PXF16ARGB1555  - 16 bpp; 1 bit for alpha and 5 bits for each RGB component
;                  |$GDIP_PXF24RGB       - 24 bpp; 8 bits for each RGB
;                  |$GDIP_PXF32RGB       - 32 bpp; 8 bits for each RGB. No alpha.
;                  |$GDIP_PXF32ARGB      - 32 bpp; 8 bits for each RGB and alpha
;                  |$GDIP_PXF32PARGB     - 32 bpp; 8 bits for each RGB and alpha, pre-mulitiplied
;                  $pScan0        - Pointer to an array of bytes that contains the pixel data. The caller is responsible for
;                  +allocating and freeing the block of memory pointed to by this parameter.
; Return values .: Success      - Returns a handle to a new Bitmap object
;                  Failure      - 0 and either:
;                  |@error and @extended are set if DllCall failed
;                  |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: After you are done with the object, call _GDIPlus_ImageDispose to release the object resources
; Related .......: _GDIPlus_ImageDispose
; Link ..........; @@MsdnLink@@ GdipCreateBitmapFromScan0
; Example .......; Yes
; ===============================================================================================================================
Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0)

    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[6]
EndFunc   ;==>_GDIPlus_BitmapCreateFromScan0

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I'm not clear on the purpose of this step. It's part of the Tesseract AutoIT project and it (seems like) it's required to work to make this thing go.

I took your advice, Kafu, and reduced my screen shot area. Doing it this way seems to allow me to increase my "scale" and also reduce the file size.

Great suggestion!

Link to comment
Share on other sites

Can you test this whether it is working on Win2k3?

Func CaptureToTIFF($win_title = "", $win_text = "", $ctrl_id = "", $sOutImage = "", $scale = 1, $left_indent = 0, $top_indent = 0, $right_indent = 0, $bottom_indent = 0)
    ;MsgBox(0,"","TIFF Scale: " & $scale)
    Local $hWnd, $hwnd2, $hDC, $hBMP, $hImage1, $hGraphic, $CLSID, $tParams, $pParams, $tData, $i = 0, $hImage2, $pos[4]
    Local $Ext = StringUpper(StringMid($sOutImage, StringInStr($sOutImage, ".", 0, -1) + 1))
    ;Local $giTIFColorDepth = 24
    Local $giTIFColorDepth = 24
    Local $giTIFCompression = $GDIP_EVTCOMPRESSIONNONE
    ;MsgBox(0,"Looking for this window title1",$win_title)
    ; If capturing a control
    If StringCompare($ctrl_id, "") <> 0 Then

        $hwnd2 = ControlGetHandle($win_title, $win_text, $ctrl_id)
        $pos = ControlGetPos($win_title, $win_text, $ctrl_id)
    Else

        ; If capturing a window
        ;MsgBox(0,"Looking for this window title2",$win_title)

        If StringCompare($win_title, "") <> 0 Then

            $hwnd2 = WinGetHandle($win_title, $win_text)
            MsgBox(0, "", "window handle is " & $hwnd2)
            $pos = WinGetPos($win_title, $win_text)
        Else

            ; If capturing the desktop
            $hwnd2 = ""
            $pos[0] = 0
            $pos[1] = 0
            $pos[2] = @DesktopWidth
            $pos[3] = @DesktopHeight
        EndIf
    EndIf

    ; Capture an image of the window / control
    If IsHWnd($hwnd2) Then

        $winactval = WinActivate($win_title, $win_text)
        MsgBox(0, "$winactval", $winactval)
        MsgBox(0, "winhan", $hwnd2)
        ;THE TROUBLE IS HERE!
        $hBitmap2 = _ScreenCapture_CaptureWnd("", $hwnd2, 0, 0, -1, -1, False)
        $hBitmap3 = _ScreenCapture_CaptureWnd(@MyDocumentsDir & "\GDIPlus_Image.jpg", $hwnd2, 0, 0, -1, -1, False)
        MsgBox(0, "$hBitmap2", $hBitmap2)
        MsgBox(0, "$hBitmap3", $hBitmap3)

    Else

        $hBitmap2 = _ScreenCapture_Capture("", 0, 0, -1, -1, False)
    EndIf

    _GDIPlus_Startup()

    ; Convert the image to a bitmap
    $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap3)
    MsgBox(0, "", "$hImage2 value -Failed if 0- : " & $hImage2)

;~  $hWnd = _WinAPI_GetDesktopWindow()
;~  $hDC = _WinAPI_GetDC($hWnd)
;~  $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, ($pos[2] * $scale) - ($right_indent * $scale), ($pos[3] * $scale) - ($bottom_indent * $scale))

;~  _WinAPI_ReleaseDC($hWnd, $hDC)
;~  $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
    $hImage1 = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", _
                                    "int", ($pos[2] * $scale) - ($right_indent * $scale), _
                                    "int", ($pos[3] * $scale) - ($bottom_indent * $scale), _
                                    "int", 0, "int", $GDIP_PXF24RGB, "ptr", 0, "int*", 0)
    $hImage1 = $hImage1[6]
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage2, 0 - ($left_indent * $scale), 0 - ($top_indent * $scale), ($pos[2] * $scale) + $left_indent, ($pos[3] * $scale) + $top_indent)
    $CLSID = _GDIPlus_EncodersGetCLSID($Ext)

    ; Set TIFF parameters
    $tParams = _GDIPlus_ParamInit(2)
    $tData = DllStructCreate("int ColorDepth;int Compression")
    DllStructSetData($tData, "ColorDepth", $giTIFColorDepth)
    DllStructSetData($tData, "Compression", $giTIFCompression)
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOLORDEPTH, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "ColorDepth"))
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGCOMPRESSION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Compression"))
    If IsDllStruct($tParams) Then $pParams = DllStructGetPtr($tParams)

    ; Save TIFF and cleanup
    _GDIPlus_ImageSaveToFileEx($hImage1, $sOutImage, $CLSID, $pParams)
    If FileExists($debugdir & "debug.txt") Then
        MsgBox(0, "", $hImage1 & "=====" & $sOutImage & "=====" & $CLSID & "=====" & $pParams)
    EndIf
    _GDIPlus_BitmapDispose($hImage1)
    _GDIPlus_ImageDispose($hImage2)
    _GDIPlus_GraphicsDispose($hGraphic)
;~  _WinAPI_DeleteObject($hBMP)
    ;added this.
    _WinAPI_DeleteObject($hBitmap2)
    _WinAPI_DeleteObject($hBitmap3)
    _GDIPlus_Shutdown()
EndFunc   ;==>CaptureToTIFF

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

UEZ,

I did what you suggested and was actually able to accomplish my original mission on Server 2003 (capture the entire window).

Are you able to tell me why "GdipCreateBitmapFromScan0" works but "CreateCompatibleBitmap" does not? Should I just go with Gdip... rather than Create...?

Thanks so much!

Func CaptureToTIFF($win_title = "", $win_text = "", $ctrl_id = "", $sOutImage = "", $scale = 1, $left_indent = 0, $top_indent = 0, $right_indent = 0, $bottom_indent = 0)

Local $hWnd, $hwnd2, $hDC, $hBMP, $hImage1, $hGraphic, $CLSID, $tParams, $pParams, $tData, $i = 0, $hImage2, $pos[4], $tar_leftx, $tar_lefty, $tar_rightx, $tar_righty, $winsize[4]
Local $Ext = StringUpper(StringMid($sOutImage, StringInStr($sOutImage, ".", 0, -1) + 1))
Local $giTIFColorDepth = 24
Local $giTIFCompression = $GDIP_EVTCOMPRESSIONNONE

; If capturing a control
if StringCompare($ctrl_id, "") <> 0 Then

$hwnd2 = ControlGetHandle($win_title, $win_text, $ctrl_id)
$pos = ControlGetPos($win_title, $win_text, $ctrl_id)
Else

; If capturing a window
if StringCompare($win_title, "") <> 0 Then

$hwnd2 = WinGetHandle($win_title, $win_text)
$pos = WinGetPos($win_title, $win_text)
Else

; If capturing the desktop
$hwnd2 = ""
$pos[0] = 0
$pos[1] = 0
$pos[2] = @DesktopWidth
$pos[3] = @DesktopHeight
EndIf
EndIf




; Capture an image of the window / control
if IsHWnd($hwnd2) Then

WinActivate($win_title, $win_text)
;added to calculate missing variables from function call needed to control the screen shot ProcessClose
$winsize = WinGetPos ( $win_title, $win_text )
$tar_leftx = $left_indent
$tar_lefty = $top_indent
$tar_rightx = $winsize[2] - $right_indent
$tar_righty = $winsize[3] - $bottom_indent
;msgbox(0,"Bottom_Indent",$bottom_indent)
$hBitmap2 = _ScreenCapture_CaptureWnd("", $hwnd2, $tar_leftx, $tar_lefty, $tar_rightx, $tar_righty, False)
Else
;added to calculate missing variables from function call needed to control the screen shot ProcessClose
$winsize = $pos
$tar_leftx = $left_indent
$tar_lefty = $top_indent
$tar_rightx = $winsize[2] - $right_indent
$tar_righty = $winsize[3] - $bottom_indent
$hBitmap2 = _ScreenCapture_Capture("", $tar_leftx, $tar_lefty, $tar_rightx, $tar_righty, False)
EndIf
;old version of if statement - correction to function
;if IsHWnd($hwnd2) Then
;
; WinActivate($win_title, $win_text)
; $hBitmap2 = _ScreenCapture_CaptureWnd("", $hwnd2, 0, 0, -1, -1, False)
;Else
;
; $hBitmap2 = _ScreenCapture_Capture("", 0, 0, -1, -1, False)
;EndIf

_GDIPlus_Startup ()

; Convert the image to a bitmap
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap2)
;Commenting out what I had before
#cs
$hWnd = _WinAPI_GetDesktopWindow()
$hDC = _WinAPI_GetDC($hWnd)
;Old version of this function call
;$hBMP = _WinAPI_CreateCompatibleBitmap($hDC, ($pos[2] * $scale) - ($right_indent * $scale), ($pos[3] * $scale) - ($bottom_indent * $scale))
$hBMP = _WinAPI_CreateCompatibleBitmap($hDC, ($tar_rightx - $tar_leftx) * $scale, ($tar_righty - $tar_lefty) * $scale)
_WinAPI_ReleaseDC($hWnd, $hDC)
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP)
#ce
;Implementing UEZ's suggestion
$hImage1 = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", _
"int", ($pos[2] * $scale) - ($right_indent * $scale), _
"int", ($pos[3] * $scale) - ($bottom_indent * $scale), _
"int", 0, "int", $GDIP_PXF24RGB, "ptr", 0, "int*", 0)
$hImage1 = $hImage1[6]
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)
;Modified from orginal to support corrected screen captures
;_GDIPLus_GraphicsDrawImageRect($hGraphic, $hImage2, 0 - ($left_indent * $scale), 0 - ($top_indent * $scale), ($pos[2] * $scale) + $left_indent, ($pos[3] * $scale) + $top_indent)
_GDIPLus_GraphicsDrawImageRect($hGraphic, $hImage2, 0, 0, ($tar_rightx - $tar_leftx) * $scale, ($tar_righty - $tar_lefty) * $scale)
$CLSID = _GDIPlus_EncodersGetCLSID($Ext)

; Set TIFF parameters
$tParams = _GDIPlus_ParamInit(2)
$tData = DllStructCreate("int ColorDepth;int Compression")
DllStructSetData($tData, "ColorDepth", $giTIFColorDepth)
DllStructSetData($tData, "Compression", $giTIFCompression)
_GDIPlus_ParamAdd($tParams, $GDIP_EPGCOLORDEPTH, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "ColorDepth"))
_GDIPlus_ParamAdd($tParams, $GDIP_EPGCOMPRESSION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Compression"))
If IsDllStruct($tParams) Then $pParams = DllStructGetPtr($tParams)

; Save TIFF and cleanup
_GDIPlus_ImageSaveToFileEx($hImage1, $sOutImage, $CLSID, $pParams)
_GDIPlus_ImageDispose($hImage1)
_GDIPlus_ImageDispose($hImage2)
_GDIPlus_GraphicsDispose ($hGraphic)
_WinAPI_DeleteObject($hBMP)
_WinAPI_DeleteObject ($hBitmap2)
_GDIPlus_Shutdown()
EndFunc
Edited by inm101
Link to comment
Share on other sites

I cannot tell you why _WinAPI_CreateCompatibleBitmap() doesn't work which is from gdi32.dll and GdipCreateBitmapFromScan0 from gdiplus.dll is working. That can only be answered by MS.

I assume that the way how the bitmap is created in memory is different which causes the issue with Win2k3.

I don't know why some elements (GDI / GDI+) in the function are mixed. I would continue using GDI+ functions as much as possible.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I'm going to run with your suggestion. Thank you so much for your help.

I cannot tell you why _WinAPI_CreateCompatibleBitmap() doesn't work which is from gdi32.dll and GdipCreateBitmapFromScan0 from gdiplus.dll is working. That can only be answered by MS.

I assume that the way how the bitmap is created in memory is different which causes the issue with Win2k3.

Br,

UEZ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...