Modify

Opened 12 years ago

Closed 12 years ago

#2748 closed Bug (Fixed)

_WinAPI_SaveHBITMAPToFile in WinAPIGdi.au3 is bugged

Reported by: anonymous Owned by: guinness
Milestone: 3.3.13.0 Component: AutoIt
Version: 3.3.12.0 Severity: None
Keywords: bitmap file Cc:

Description

_WinAPI_SaveHBITMAPToFile may break as reported by SciTE's console:

"C:\Program Files (x86)\AutoIt3\Include\WinAPIGdi.au3" (3702) : ==> Variable used without being declared.:
_WinAPI_CloseHandle($hFile)
_WinAPI_CloseHandle( ERROR

That is because the declaration of variable $hFile is now within a loop (line 3683), which may or may not be executed, while the variable is still being used outside that loop.

Furthermore, it is not saving the bitmap in many situations, failing at line 3616 (_WinAPI_DrawBitmap). Apparently, a false report, because if one forces the assignment "$hBitmap = $hSource", regardless of the status returned by _WinAPI_DrawBitmap, the bitmap is saved correctly.

As a last consideration, the example found at the help file page for _WinAPI_SaveHBITMAPToFile fails when run, saving a bitmap which turns out to be just a block painted in black.

Attachments (0)

Change History (2)

comment:1 by lcofresi, 12 years ago

The problem with the second part of the complaint (or at least with part of it) is in the _WinAPI_DrawBitmap() function.

The line 1431, at the end of the function reads

If Not $iError Then Return SetError(10, 0, 0)

It should be of course

If $iError Then Return SetError(10, 0, 0)

comment:2 by guinness, 12 years ago

Milestone: 3.3.13.0
Owner: set to guinness
Resolution: Fixed
Status: newclosed

Fixed by revision [10211] in version: 3.3.13.0

Modify Ticket

Action
as closed The owner will remain guinness.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.