|
-
Nov 30th, 2005, 02:49 PM
#1
Thread Starter
Hyperactive Member
Hidden Applications Grabber
Does anyone know how to grab invisible applicaitons in code and make them visible again? I have an application that makes Excel invisible but if I crash then I will lose all information in that Excel file because I need to kill the process. I want to write a little application that will grab all instances of Excel that are running and make them visible.
I have tried this with getobject but I get errors trying to grab it. I have rooted through Process and cannot find anything that manipulates anything but the thread process.
Anyonme know anything that can help?!
Thanks,
Taco
-
Nov 30th, 2005, 02:53 PM
#2
Re: Hidden Applications Grabber
What error are you getting?
I would think this would work:
MyXL = GetObject(, "Excel.Application")
-
Nov 30th, 2005, 02:58 PM
#3
Thread Starter
Hyperactive Member
Re: Hidden Applications Grabber
You see, I have tried that but I get the error that I cannot get an activeX component. The same error you get if there are no instances of it open. I'm sure yo know this but GetObject(,"Excel.Application") will get an object but not create one automatically if there isn't one open, GetObject("","Excel.Application") will create one automatically if there isn't one open already. I get this same problem with Visio as well. Are these items treated differently when they are invisible?
-
Nov 30th, 2005, 03:41 PM
#4
Re: Hidden Applications Grabber
This works for me:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As Object
x = CreateObject("Excel.Application")
'x.visible = True
x = Nothing
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim x As Object
x = GetObject(, "Excel.Application")
x.Workbooks.Add()
x.visible = True
x = Nothing
End Sub
Clicking button 1, then button 2 does exactly as expected.
-
Nov 30th, 2005, 03:45 PM
#5
Thread Starter
Hyperactive Member
Re: Hidden Applications Grabber
Now take that after clicking button 1 and kill the program. This is after making Excel invisible. Then start the application again and click button 2 to make it visible. Does that work? I couldnot get that to work. I think it still works when the program that created it is still active, as if there is still an invisible link to the thread. If you kill the program, then you sever the link permanently and I cannot seem to get it to getobject anymore. However, process.getprocessbyname still grabs all instances no problem.
-
Nov 30th, 2005, 04:02 PM
#6
Thread Starter
Hyperactive Member
Re: Hidden Applications Grabber
Ok, I pressed thebutton 4 times for a visio application and 4 hidden instances are out. then i crashed my program to sever the link. Then I started up and grabbed one and made it visible. I closed it and tried again but none of the remaining 3 will get grabbed. Anyone got ideas?! Those 3 had to end proccessed. I want to try to recover the work that will be lost if a senario like this happens again.
Thanks all!
-
Nov 30th, 2005, 05:07 PM
#7
Re: Hidden Applications Grabber
Why must you run excel in the background while your application runs?
-
Nov 30th, 2005, 05:17 PM
#8
Thread Starter
Hyperactive Member
Re: Hidden Applications Grabber
Some of my clients have old, slow machines. If I hide excel it generates reports MUCH faster then if it is visible. Many programs do this in my field but if my application crashes then Excel is lost because you cannot make it visible again. That is why I need this helper application to save whatever has been lost.
It is really complicated to explain when I cannot say much. 
Thanks for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|