I'm trying to load a bitmap to an editor I made with AHK but I can't save it after editing because it seems the file is still in use from Gdip_CreateBitmapFromFile and I can't use Gdip_DisposeImage yet because I can't save it yet.
I was copying the file first and then using Gdip_CreateBitmapFromFile on it instead but I feel like its too "unprofessional" and would like to keep it in memory.
Any help is greatly appreciated!
How to Gdip_CreateBitmapFromFile without it keeping the file in use?
Re: How to Gdip_CreateBitmapFromFile without it keeping the file in use?
Well I found a work around to turn it into an Hbitmap and then back to a bitmap and now the original file isn't in use although i'm not quite sure why it works or if it will cause an issue I haven't seen yet.
[Mod edit: [code][/code] tags added.]
Code: Select all
pBitmaptemp := Gdip_CreateBitmapFromFileSimplified(filespecial)
hBitmaptemp:= Gdip_CreateargbHBITMAPFromBitmap(pBitmaptemp)
pBitmap:= Gdip_CreateargbBITMAPFromhBitmap(hBitmaptemp)
Gdip_DisposeImage(pBitmaptemp)
DeleteObject(hBitmaptemp)