Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1555
  • Last Modified:

Killing EXCEL Process from within Powerbuilder

I am currently launching an asynchronous process from within powerbuilder that is used to generate Excel Reports.  Currently I only allow one report to be ran at a time, however doing it from within an asynchronous process allows the user to continue to use the rest of the application(the main reason I used the asynchronous process was so that the application was not locked up waiting for the report to finish).  I am running into a problem when excel fails to finish the report.  I need to be able to find and kill the exccel process before i can move on.  I am currently pndering creating an entirely new dll written in VB to handle all report generation.  However if anyone could give me some tips as to how i can find and kill the excel process from within powerbuilder that would be a great help, even if i have to create a dll in c++ to do this, that would be acceptable.  thanks for the help in advance.
0
smgillis
Asked:
smgillis
1 Solution
 
KosmoKramerCommented:
tries with this API function:

//to find
FUNCTION ulong FindWindowA (REF string classname, REF string WindowName) LIBRARY "user32.dll"
ls_name="Excel Window name"
null(lul_class)
lul_handle = FindWindowA(lul_class, ls_name)

//to kill
FUNCTION boolean PostMessageA(ulong hwndle,UINT wmsg,ulong wParam,ulong lParam) Library "User32.dll"

UInt lui_quit = 18
PostMessageA(Flul_handle, lui_quit, 0, 0);

0
 
gafoor78Commented:
hi smgillis

this link contains full code in PB to find and terminate a  process with API

http://www.pbdr.com/software/comp/createpr.zip

rgrds
gafoor
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now