Opening Windows application Slow return

franklin1232

New Member
I have finally found a way in our ERP system to run windows programs on the client machines, but I have a small problem. What I have done is write a small .p

{v:\vantage\vbp\vb.i}
Define Variable RMARowid as Rowid no-undo.
Define Variable strWRR1000 as char no-undo.
set RMARowid = getcurrentRowID().
FIND RMARcpt WHERE ROWID(RMARcpt) = RMARowid No-lock.
DOS SILENT VALUE("v:\vantage\VBP\wrr1000.exe -" + String(RMARcpt.RMANum)).
return.

When I click a button on the ERP screen this program runs and opens the wrr1000.exe. Problem is after closing the WRR1000 I want to return to the ERP screen, but everything is hung. It does comes back eventually depending on the machine speed.

Is there a better way to run this. I am guessing some wierd memory space issue or handle thing, but I don't know 4GL and Prowin that well yet so any help would be appreciated.

Thanks
 

franklin1232

New Member
Got some errors

Well I tried the everything.zip file with all the Windows API includes. I got a some errors finding the files even though I put full paths in the include. Also had some unable to understand error in the windows.p file. Maybe I will call the API function directly instead of through the .i files

Thanks
 

franklin1232

New Member
Errors

Well I put the Windows.i and winfunc.i in a folder called v:\vantage\vbp\ That's were a different include already was and where My .p is. I get the error that the winfunc.i can not be found. I edited the windows.i and fixed that problem, but now I am down to the last few lines in my code.

hProcess = CreateProcess("v:\vantage\vbp\wrr1000.exe -" + strWRR1000,"",1).
IF hProcess=0 THEN
ShowLastError().
Run CloseHandle IN hpApi (hProcess, OUTPUT ReturnValue).

It can figure out the ReturnValue. I get "unknown field or variable name error". What is hpApi, and what is the ReturnValue.

Thanks Much.
 

bendaluz2

Member
Ok, firstly the files come in pairs, so to go with windows.i, there is a windows.p and to go with winfunc.i, there is a winfunc.p. These need to go into the same dir as windows.i and winfunc.i.

hpApi is defined in windows.i and when this is included, it checks to see if it is a valid handle. If not, it runs windows.p persistently and stores the handle in hpApi. Thus, when you do a run in hpApi, you are running a procedure in windows.p

You need to define ReturnValue yourself within your program, just consider the call to CloseHandle a normal internal procedure call (so you need to define a variable for your output parameter), and by looking at the definition of CloseHandle in windows.p, you can determine that it should be an integer or decimal (probably an integer in this case, as the name ReturnValue suggests it will return a code value rather than a number)

<pre>
PROCEDURE CloseHandle EXTERNAL {&KERNEL} :
DEFINE INPUT PARAMETER hObject AS LONG.
DEFINE RETURN PARAMETER ReturnValue AS LONG.
END PROCEDURE.
</pre>
 
Top