okovongo.$
okovongo.

05/16/2007 :: 11:31

Anonyme

Hi,

I am using CreateImageFromFile to load an image. I also want to delete the file after the image was loaded but the file seem to be locked by the library.

Do you know how I can release the file lock without dropping my image object? I am using the OCX in Centura.

Thanks in advance,
Peter
Loïc$2006306
Loïc

05/16/2007 » 11:41

Registered

Hi,

I give you 2 solutions:


1 - Using DrawImage into new memory image

Dim oGdPicture As New GdpicturePro.cGdPicture
Dim nInputImageID As Long, nMemoryImageID As Long


nInputImageID = oGdPicture.CreateImageFromFile("c:\test.jpg")
nMemoryImageID = oGdPicture.CreateNewImage(oGdPicture.GetWidth, oGdPicture.GetHeight, oGdPicture.GetIntPixelFormat)
Call oGdPicture.DrawImage(nInputImageID, 1, 1, oGdPicture.GetWidth, oGdPicture.GetHeight)
Call oGdPicture.CloseImage(nInputImageID)


2 - Using string image data buffer

Dim oGdPicture As New GdpicturePro.cGdPicture
Dim sImageString As String


Call oGdPicture.CreateImageFromFile("c:\test3.jpg")
sImageString = oGdPicture.SaveAsString("bmp")
Call oGdPicture.CloseNativeImage
Call oGdPicture.CreateImageFromString(sImageString)


PS: There is other solutions...


Best regards,

Loïc Carrère

Edited by @lcarrere  
okovongo$2007135
okovongo

05/17/2007 :: 01:31

Registered

Thanks Loïc. I used your first option and it worked.

The SaveAsString function does not seem to work in Centura, neither does CreateImageFromString. Any ideas?

Something else, do you have documentation with examples? It will help a lot to see how all the methods are implemented.

Thanks for your help so far.

Peter
Loïc$2006306
Loïc

11/09/2007 » 19:24

Registered

Hi, the SaveAsString() method returns unicode char. (wchar in c++).

I think you have to convert unicode to ascii with Centura...

For the documentation you can get various samples and the full documentation here: http://www.gdpicture.com/documentation.php


Best regards,

Loïc Carrère

Edited by @lcarrere  
back to forum