Consultor Eletrônico



Kbase P101662: Error code = 5 or 2 with a picture located on the internet
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/3/2008
Status: Unverified

SYMPTOM(s):

Cannot use a picture located on the Internet with a Progress widget

Unable to create temporary file name for downloading image from internet. Error code = 5

Unable to create temporary file name for downloading image from internet. Error code = 2

The file (http://) for LOAD-IMAGE on the IMAGE imageName is invalid on the current system. (206)

No write privilege to the working directory

FACT(s) (Environment):

Windows
Progress 9.x
OpenEdge 10.x

CAUSE:

A picture coming from the HTTP has to be written in the disk before it is used. Therefore Progress has to have write privilege in the working directory.

FIX:

Change the temporarily the working directory to a location where it is possible to write. For example, assumed that you can write in C: you may use this code:
DO:
DEFINE VARIABLE tempWD AS CHARACTER NO-UNDO.
DEFINE VARIABLE SetCurrentDirectoryAResult AS INT NO-UNDO.

FILE-INFO:FILE-NAME = ".".
tempWD = FILE-INFO:FULL-PATHNAME. /*saving the current working dir*/

/*changing the working dir to a location where it can be written*/
RUN SetCurrentDirectoryA (INPUT "c:", OUTPUT SetCurrentDirectoryAResult).
IF SetCurrentDirectoryAResult <> 1 THEN
MESSAGE "Problem to set the CurrentDirectory of the process".
SELF:LOAD-IMAGE("http://www.google.nl/intl
l_nl/images/logo.gif").
/*changing back the working dir*/
RUN SetCurrentDirectoryA (INPUT tempWD, OUTPUT SetCurrentDirectoryAResult).
END.
DEFINE VARIABLE SetCurrentDirectoryAResult AS INTEGER NO-UNDO.
PROCEDURE SetCurrentDirectoryA EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER chrCurDir AS CHARACTER.
DEFINE RETURN PARAMETER SetCurrentDirectoryAResult AS LONG.
END PROCEDURE.