Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

4GL Code Questions 2

Status
Not open for further replies.

dsi

Programmer
Mar 13, 2000
964
US
Question 1:
Are there any good sites that have 4GL code samples?

Question 2:
Does anyone have a code snipit for reading information from a text file? For example, say I want to run a search routine on a group of vendors listed in a separate text file.

Question 3:
Can you fire up external applications from a .p file? For example, I may want to fire up Excel or open a text file once a procedure is complete. Any ideas or samples?

Thanks in advance!
 
Q1: Check out these pages: Also I can send you stuff if you email me: paul_fry@speakeasy.net .

Q2:
Here's a little something I wrote once. You can also use "import unformatted" without the delimiter then cut up the imported string with the substring command. (Variable definitions not included.)

input from file123.csv no-echo.
repeat on error undo, leave.
import delimiter "," custnum inv invdate amt.
/* processing... */
end.
input close.

Q3: I do have a sample of firing up Excel from Progress. I'll post it when I find it.
7seven
 
Q3: you can check the progress external interface manual. You can connect from a .p to excel using DDE.
 
Thank you both for your feedback. Well, I'm off to see what kind of damage I can do. I am sure that I'll be back with more questions. Until then...
 
OK, for those that care, I have found a way to open any file from 4GL code.

To run an exe file, check section 6 of the Progress External Program Interfaces manual (available at progress.com) You will use a call to WinExec from kernel32.dll in the Windows API (thanks pankajmehra).

But, if you want to open other types of files, you will need to call the ShellExecuteA function from shell32.dll in the Windows API. This is similar to double-clicking a file from Explorer. It will open any file in its' associated application, assuming it's defined.
Code:
DEF VAR lReturnCode AS INTEGER NO-UNDO.
DEF VAR sNullString AS CHARACTER NO-UNDO.

PROCEDURE ShellExecuteA EXTERNAL "SHELL32.DLL":
    DEF INPUT PARAM hWnd AS LONG.
    DEF INPUT PARAM lpOperation AS CHARACTER.
    DEF INPUT PARAM lpFile AS CHARACTER.
    DEF INPUT PARAM lpParameters AS CHARACTER.
    DEF INPUT PARAM lpDirectory AS CHARACTER.
    DEF INPUT PARAM nShowCmd AS LONG.
    DEF RETURN PARAM lStatusCode AS LONG.
END PROCEDURE.

RUN ShellExecuteA ( INPUT 0,
                    INPUT sNullString,
                    INPUT "D:\4GL Files\Tests\Test.xls",
                    INPUT sNullString,
                    INPUT sNullString,
                    INPUT 1,
                    OUTPUT lReturnCode).

IF lReturnCode <= 32 THEN
    MESSAGE &quot;Application Failed: &quot; lReturnCode VIEW-AS ALERT-BOX.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top