1 Attachment(s)
How to kill Excel process?
Hi,
I'm doing an action in first debug like this:
1, Create excel instance.
2, During debugging, turn it off suddenly.
In some case, this processes still run in background,
so when i use getobject code get the instance but now they are no longer valid.
I used the following code in second debug but it doesn't work?
//check [getobject] if catch error then terminate process and create new one:
::PostMessage(hWnd, WM_CLOSE, 0, 0);
How do I kill this process?
Attachment 35997
Thanks you!
Re: How to kill Excel process?
How do you obtain the window handle (hWnd)?
If this handle is not valid or the window does not exist then the only way "to kill" is to call TerminateProcess. However, you need to know the process handle of the Excel process.
Re: How to kill Excel process?
Thanks Sir,
I'm trying your suggestion.
Re: How to kill Excel process?
Quote:
1, Create excel instance.
How do you create the Excel instance? Do you use CreateProcess? Are you loading it as a COM server using COM?
Re: How to kill Excel process?
Quote:
Originally Posted by
Arjay
How do you create the Excel instance? Do you use CreateProcess? Are you loading it as a COM server using COM?
Hi Sir,
I'm using CreateInstance function from automate.
I'm still investigating it. for the time being, I will monitor taskmanager and end this task manually if I get this case.
Re: How to kill Excel process?
Quote:
Originally Posted by
Dang.D.Khanh
Hi Sir,
I'm using CreateInstance function from automate.
I'm still investigating it. for the time being, I will monitor taskmanager and end this task manually if I get this case.
Could you provide some code snippets with "using CreateInstance" and so on?
And the same - for your "close procedure".
Re: How to kill Excel process?
Quote:
Originally Posted by
VictorN
Could you provide some code snippets with "using CreateInstance" and so on?
And the same - for your "close procedure".
I'm using the code from this post,
From old posts I see it's name is CreateDispatch but when I use it I see only name CreateInstance.
I'm trying this answer, it might help me
Re: How to kill Excel process?
Quote:
Originally Posted by
Dang.D.Khanh
I'm using the code from this
post,
From old
posts I see it's name is CreateDispatch but when I use it I see only name CreateInstance.
I'm trying this
answer, it might help me
Try calling Quit.
Re: How to kill Excel process?
Quote:
Originally Posted by
Arjay
Try calling Quit.
Thanks sir, I think it is a solution that works in most cases.
my problem is solved .