I have a bitmap in a resource file and want to show it, streched,
in a secondary dialog. Okay, so I take the easy route and use
DDT's IMAGEX statement, but no matter how I try, I get a memory
leak each time I create/end the dialog window. The same goes for
the IMAGE statement.
I have found a solution that works fine, by using a LABEL and
CONTROL SET IMAGEX instead, but it still would be fun to know
how to release a bitmap loaded into DDT's IMAGEX "control".
Is it even possible? I use numbered bitmaps in the resource file
and in this case, the bitmap number is 3. The following leaks
when I create/end the secondary dialog repeatedly:
CONTROL ADD IMAGEX, hDlg, %IDABOUT_CAPT, "#3", 0, 0, 270, 50
..but this one works fine = does not leave any leaks:
CONTROL ADD LABEL, hDlg, %IDABOUT_CAPT, "", 0, 0, 270, 50, %SS_BITMAP
CONTROL SET IMAGEX hDlg, %IDABOUT_CAPT, "#3"
Both with the following to remove the loaded bitmap in %WM_DESTROY:
LOCAL hBmp AS LONG
CONTROL SEND CBHNDL, %IDABOUT_CAPT, %STM_GETIMAGE, %IMAGE_BITMAP, 0 TO hBmp
IF hBmp THEN DeleteObject hBmp
in a secondary dialog. Okay, so I take the easy route and use
DDT's IMAGEX statement, but no matter how I try, I get a memory
leak each time I create/end the dialog window. The same goes for
the IMAGE statement.
I have found a solution that works fine, by using a LABEL and
CONTROL SET IMAGEX instead, but it still would be fun to know
how to release a bitmap loaded into DDT's IMAGEX "control".
Is it even possible? I use numbered bitmaps in the resource file
and in this case, the bitmap number is 3. The following leaks
when I create/end the secondary dialog repeatedly:
CONTROL ADD IMAGEX, hDlg, %IDABOUT_CAPT, "#3", 0, 0, 270, 50
..but this one works fine = does not leave any leaks:
CONTROL ADD LABEL, hDlg, %IDABOUT_CAPT, "", 0, 0, 270, 50, %SS_BITMAP
CONTROL SET IMAGEX hDlg, %IDABOUT_CAPT, "#3"
Both with the following to remove the loaded bitmap in %WM_DESTROY:
LOCAL hBmp AS LONG
CONTROL SEND CBHNDL, %IDABOUT_CAPT, %STM_GETIMAGE, %IMAGE_BITMAP, 0 TO hBmp
IF hBmp THEN DeleteObject hBmp
Comment