do external

Greig Morrison greig.morrison at sympatico.ca
Fri Apr 25 11:13:56 CDT 2008


Hi Gerry,

I get the list summary and the piece of sample code seems to get
mangled, so I am attaching an ascii file with the code sample. Not sure
if this will be any use but hopefully it demonstrates the PASCAL
parameter passing method and use of NULL terminators when necessary.

If you have any questions, please let me know.

Greig


Date: Thu, 24 Apr 2008 17:18:19 -0400
From: "Greig Morrison" <greig.morrison at sympatico.ca>
Subject: RE: do external
To: <powerh-l at lists.sowder.com>
Message-ID:
	<6736162D4F88CC458FCED98237BBB7EF0B7C88 at ssbs0001.morrison.local>
Content-Type: text/plain;	charset="us-ascii"


I have not used Acucobol however the attached is a example using the
Windows KERNEL32 API.

;Data Access Section
TEMPORARY T_hwnd INTEGER*2 RESET AT STARTUP TEMPORARY T_lpOperation
CHARACTER*5 RESET AT STARTUP TEMPORARY T_lpFile CHARACTER*255 RESET AT
STARTUP TEMPORARY T_lpDirectory CHARACTER*255 RESET AT STARTUP TEMPORARY
T_nShowCmd INTEGER*2 RESET AT STARTUP TEMPORARY iNULL INTEGER*2 RESET AT
STARTUP TEMPORARY szNull CHARACTER*1 INITIAL char(iNull) RESET AT
STARTUP TEMPORARY t_filename CHARACTER*50 TEMPORARY t_source_dir
CHARACTER*50 TEMPORARY t_target_dir CHARACTER*50
 

......


PROCEDURE DESIGNER test
BEGIN
;Windows API Function (CopyFile) located in the KERNEL32.DLL.
;
;	The CopyFile function copies an existing file to a new file.
;
;
;	CopyFile (Val(hwnd), Ref(lpOperation), Ref(lpFile),
Ref(lpParameters), Ref(lpDirectory), Val(nShowCmd)) ;
;		Parameter		Type		Description
;     where:	hwnd 			Interger	A handle to a
window. Sometimes it is necessary for a Windows application
;							to show a
message box before it has created its own main window. If this
;							occurs, the
window spedified by this parameter will be used as the parent
;							window of the
message bax. You would usually use the window handle of the
;							form for this
parameter.
;		lpOperation		Char.		The string
"Open" to open the lpFile document or "Print" to print it.
;							This may be a
Nullstring to default to "Open".
;		lpFile			Char.		A program name
or the name of a file to print or open using the associated
;							program.
;		lpParameters		Char.		A String
containing parameters to pass to the executable file if lpFile is
;							is an executable
file. Use NullString if lpFile refers to a document file
;							or if no
parameters are used.
;		lpDirectory		Char.		The full path of
default directory to use.
;		nShowCmd		Integer		A constant value
spcifying how to show the launched program. see below for
;							values and their
result.
;
;

; nShowCmd values:
;				Values	Description
; (SW_HIDE)	 		= 0	Hides the window. Activation
passes to another window.
; (SW_SHOWNORMAL) 	= 1	Displays a window at its original size
and location and activates it.
; (SW_SHOWMINIMIZED) 	= 2	Minimizes a window and activates it.
; (SW_SHOWMAXIMIZED) 	= 3	Maximizes a window and activates it.
; (SW_SHOWNOACTIVATE) 	= 4	Displays a window at its most recent
size and location. Does not change the active window.
; (SW_SHOW) 		= 5	Displays a window at its current size
and loaction, and activates it.
; (SW_MINIMIZE) 		= 6	Minimizes the window. Activation
passes to another window.
; (SW_SHOWMINNOACTIVE)	= 7	Minimizes a window without changing the
active window.
; (SW_SHOWNA) 		= 8	Displays a window at its current size
and location.
; (SW_RESTORE)   		= 9	Displays a window at its
original size and location and activates it.
			

	LET T_hwnd         = 1
; Boolean
;	LET T_lpOperation  = "Open" + szNull
	LET T_lpFile       = truncate(t_source_dir) + "\" +
truncate(t_filename + szNull)
;	LET T_lpDirectory  = "\\ServerName\ShareName" + szNull
;UNC path
	LET T_lpDirectory  = truncate(t_target_dir) + "\" +
truncate(t_filename + szNull)
;	LET T_nShowCmd     = 5

	DO EXTERNAL Pascal "KERNEL32 at CopyFileA" (REF(T_lpFile),
REF(T_lpDirectory), VALUE(T_hwnd)) END



From: powerh-l-bounces+ken.langendock=rogers.com at lists.sowder.com
[mailto:powerh-l-bounces+ken.langendock=rogers.com at lists.sowder.com] On
Behalf Of GJohnson
Sent: April 23, 2008 2:58 PM
To: powerh-l at lists.sowder.com
Subject: do external
 
Has anyone had success using DO EXTERNAL in Quick to execute an Acucobol

program
 
Gerry Johnson
M B Foster 
 



------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: KERNEL32_CopyFile.qks
Type: application/octet-stream
Size: 3311 bytes
Desc: KERNEL32_CopyFile.qks
Url : http://lists.sowder.com/pipermail/powerh-l/attachments/20080425/88691475/KERNEL32_CopyFile.obj


More information about the powerh-l mailing list