Aaron3569 Posted October 14, 2022 Share Posted October 14, 2022 (edited) Hello! i have a question regarding GDIPlus Images & Bitmaps. is it possible to check if an image / bitmap handle is valid? because in my case its possible that the handle is disposed and autoit will crash as soon its used in a function so i am not able to do an error test or something like this since it just crashes. i found out i could check an image handle with _GDIPlus_ImageGetPropertyIdList , this will not crash if the image is not valid, but this dosnt work for bitmaps. Edit: i found a solution which works for images and bitmaps, sure it's not the "right way", but its the only way for me which does not result in a crash. Func _GDIPlus_IsValid($hImage) __GDIPlus_ImageGetPropertyCount($hImage) If @error Then Return False Else Return True EndIf EndFunc if you have a better solution for this, please let me know! it seems like the solution above still give me random crashes. Edited October 14, 2022 by Aaron3569 solution Link to comment Share on other sites More sharing options...
Solution funkey Posted October 15, 2022 Solution Share Posted October 15, 2022 When you dispose the image, then set the handle in variable to 0. Aaron3569 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now