Hi Guys
Our application has a procedure using the following code to do file printing. Before we call this procedure, we output the file to html format. This routine has been working for years. But lately, our main application hangs when our users try to print the document. It doesn't happen all the time though, once it happens, we have to kill and restart the entire application and the printing works again.
I have checked that there is no software changed in terms of IE version, it's always IE 6. What I did realise is that the iexplorer.exe process stays alive and memory usage grows everytime when the printing occurs. I am not sure if that is the case, but even though the memory usage is low, the app still freezes. I did try to add webPrint:QUIT() and RELEASE OBJECT webPrint NO-ERROR two statements after webPrint:ExecWB(), it didn't seem to be useful, iexplorer.exe is still alive and grows in memory.
Any advice? (btw, our progress version is 91E)
Thanks
Our application has a procedure using the following code to do file printing. Before we call this procedure, we output the file to html format. This routine has been working for years. But lately, our main application hangs when our users try to print the document. It doesn't happen all the time though, once it happens, we have to kill and restart the entire application and the printing works again.
I have checked that there is no software changed in terms of IE version, it's always IE 6. What I did realise is that the iexplorer.exe process stays alive and memory usage grows everytime when the printing occurs. I am not sure if that is the case, but even though the memory usage is low, the app still freezes. I did try to add webPrint:QUIT() and RELEASE OBJECT webPrint NO-ERROR two statements after webPrint:ExecWB(), it didn't seem to be useful, iexplorer.exe is still alive and grows in memory.
Any advice? (btw, our progress version is 91E)
Thanks
Code:
[FONT=courier new,courier]&SCOPED-DEFINE HWND_BROADCAST 65535[/FONT]
[FONT=courier new,courier]&SCOPED-DEFINE WM_WININICHANGE 26[/FONT]
[FONT=courier new,courier]DEF VAR webPrint AS COM-HANDLE NO-UNDO.[/FONT]
[FONT=courier new,courier]DEF VAR printPrompt AS INT NO-UNDO INITIAL 2. /* Use default printer */[/FONT]
[FONT=courier new,courier]DEF VAR appAction AS INT NO-UNDO INITIAL 6. /* Print the thing */[/FONT]
[FONT=courier new,courier]DEF VAR spoolFile AS CHAR NO-UNDO.[/FONT]
[FONT=courier new,courier]DEF VAR winConParam AS CHAR NO-UNDO.[/FONT]
[FONT=courier new,courier]DEF VAR iReturn AS INT NO-UNDO.[/FONT]
[FONT=courier new,courier]PROCEDURE WriteProfileStringA EXTERNAL "KERNEL32.DLL":[/FONT]
[FONT=courier new,courier] DEF INPUT PARAMETER lpszSection AS CHAR.[/FONT]
[FONT=courier new,courier] DEF INPUT PARAMETER lpszKeyName AS CHAR.[/FONT]
[FONT=courier new,courier] DEF INPUT PARAMETER lpszString AS CHAR.[/FONT]
[FONT=courier new,courier] DEF RETURN PARAMETER iReturn AS LONG.[/FONT]
[FONT=courier new,courier]END.[/FONT]
[FONT=courier new,courier]PROCEDURE SendMessageA EXTERNAL "USER32.DLL":[/FONT]
[FONT=courier new,courier] DEF INPUT PARAMETER p1 AS LONG.[/FONT]
[FONT=courier new,courier] DEF INPUT PARAMETER p2 AS LONG.[/FONT]
[FONT=courier new,courier] DEF INPUT PARAMETER p3 AS LONG.[/FONT]
[FONT=courier new,courier] DEF INPUT PARAMETER p4 AS CHAR.[/FONT]
[FONT=courier new,courier] DEF RETURN PARAMETER result AS LONG.[/FONT]
[FONT=courier new,courier]END.[/FONT]
[FONT=courier new,courier]ASSIGN[/FONT]
[FONT=courier new,courier]spoolFile = "c:\temp\docket.html"[/FONT]
[FONT=courier new,courier]winConParam = "[/FONT][FONT=courier new,courier]\\fs-01\toshiba-bw-printer,winspool,Ne04:". /* at run time, this value is retrieved by reading the regitry key value [/FONT]
[FONT=courier new,courier]in HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\device*/[/FONT]
[FONT=courier new,courier]CREATE "InternetExplorer.Application" webPrint.[/FONT]
[FONT=courier new,courier]/* get the file */[/FONT]
[FONT=courier new,courier]NO-RETURN-VALUE webPrint:Navigate (spoolFile, , , , ).[/FONT]
[FONT=courier new,courier]SESSION:PRINTER-CONTROL-HANDLE = 0.[/FONT]
[FONT=courier new,courier]RUN WriteProfileStringA("windows", [/FONT]
[FONT=courier new,courier] "device",[/FONT]
[FONT=courier new,courier] winConParam,[/FONT]
[FONT=courier new,courier] OUTPUT iReturn).[/FONT]
[FONT=courier new,courier]RUN SendMessageA( {&HWND_BROADCAST},[/FONT]
[FONT=courier new,courier] {&WM_WININICHANGE},0,"WINDOWS",[/FONT]
[FONT=courier new,courier] OUTPUT iReturn).[/FONT]
[FONT=courier new,courier]NO-RETURN-VALUE webPrint:ExecWB ( appAction, printPrompt, , ). [/FONT]