Consultor Eletrônico



Kbase P3105: Errors 293 or 3258 when invoking the WinExec API function
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Verified

FACT(s) (Environment):

Windows 32 Intel

SYMPTOM(s):

** "winexec" was not found. (293)

Could not load DLL procedure <procedure>. (3258)

CAUSE:

The application source code did not properly define the external procedure call for the WinExec function

FIX:

Modify your code as per this sample:

DEFINE VARIABLE ReturnCode AS INTEGER NO-UNDO.

PROCEDURE WinExec EXTERNAL "KERNEL32.DLL":
   DEFINE INPUT  PARAMETER ProgramName AS CHARACTER.
   DEFINE INPUT  PARAMETER VisualStyle AS LONG.
   DEFINE RETURN PARAMETER StatusCode  AS LONG.
END PROCEDURE.

/**************************************************/
/*  NOTE: VisualStyle parameters are as follows:  */
/*        1 = Normal                              */
/*        2 = Minimized                           */
/**************************************************/

RUN WinExec (INPUT "NOTEPAD", INPUT 1, OUTPUT ReturnCode).

IF ReturnCode GE 32 THEN
   MESSAGE "Application was Started" VIEW-AS ALERT-BOX.
ELSE
   MESSAGE "Application Failed" VIEW-AS ALERT-BOX.

/****************************************************/
/* RETURN CODE DESCRIPTION                          */
/* If the function is successful, the return value  */
/* from WinExec identifies the instance of the      */
/* loaded module. Otherwise, the return value is an */
/* error value between 0 and 32.                    */
/*                                                  */
/*     0       System was out of memory, executable */
/*             file was corrupt, or relocations     */
/*             were invalid.                        */
/*     2       File was not found.                  */
/*     3       Path was not found.                  */
/*     5       Attempt was made to dynamically link */
/*             to a task, or there was a sharing or */
/*             network protection error.            */
/*     6       Library required separate data       */
/*             segments for each task.              */
/*     8       There was insufficient memory to     */
/*             start the application.               */
/*    10       Windows version was incorrect.       */
/*    11       Executable file was invalid.  Either */
/*             it was not a Windows application or  */
/*             there was an error in the .EXE image.*/
/*    12       Application was designed for a       */
/*             different operating system.          */
/*    13       Application was designed for         */
/*             MS-DOS 4.0.                          */
/*    14       Type of executable file was unknown. */
/*    15       Attempt was made to load a real-mode */
/*             application (developed for an earlier*/
/*             version of Windows).                 */
/*    16       Attempt was made to load a second    */
/*             instance of an executable file       */
/*             containing multiple data segments    */
/*             that were not marked read-only.      */
/*    19       Attempt was made to load a compressed*/
/*             executable file.  The file must be   */
/*             decompressed before it can be loaded.*/
/*    20       Dynamic link library (DLL) file was  */
/*             invalid.  One of the DLLs required to*/
/*             run this application was corrupt.    */
/*    21       Application requires Microsoft       */
/*             Windows 32-Bit extensions.           */
/****************************************************/