I’m getting an UnsupportedFormatException when running this method in a Windows 10 PC with GDI+ enabled. I’ve tried running it on a different PC, also with Windows 10 but It runs ok and I don’t get the exception. I thought maybe GDI+ was missing in my first PC, but after looking it up online, it is supposed to be installed by default on Windows 10, so I cannot understand why I’m receiving the exception in the first place.
Maybe some of you guys can help me? Thanks!
[code]
Dim file As FolderItem = SpecialFolder.ApplicationData.Child(“PASSFORT”).Child(temp.png)
If (file = Nil) Then
// The file could not be created
Return -1
Else
If (pic = Nil) Then
// The PFImage could not be converted
Return -2
Thanks, I just forgot to add them when I pasted the original code and replaced the file name. As I already explained in my original post, there’s no compilation error. It runs OK on a Windows 10 PC and it doesn’t on another machine also with Windows 10.
@Greg O’Lone the message says: “SaveAsPicture doesn’t support format 150 in Windows.”
@Michel Bujardet - I need to use PNG because of the transparency, it is supposed to be supported by Xojo if GDI+ is enabled, which it is.
@Michel Bujardet Let’s assume that PC is at fault. Any Idea about how to get it fixed? I’m afraid this could also happen to some of our customers in the future…
My point was not to give up, but to diagnose which formats appear supported or not for debugging purposes. Since Xojo does nothing but request the system to save and load the picture, chances are that particular PC is at fault. If you get no picture supported, then you can bet the Windows version is corrupted.
In order to work around this bug, which once again maybe limited to that particular system, I see no other options than to use a library like MBS, or save in another format that support transparency, such as Gif, and then convert with some external tool.
I strongly believe this maybe a local artefact, and spending time working around that sole machine system corruption may very well be futile out there in the real world.