[RESOLVED] Get ProgressBar Info from ghostsrv.exe in VB.NET
I need to pull the remaining time or percent done or progressbar info from a ghost server. ghostsrv.exe.
I'm running the program from a system.diagnostics.process.
Code:
dim myP as System.Diagnostics.Process
myP = new process
myP.startinfo.filename("ghostsrv.exe")
myP.start
I want to pull everything I can from its windows form. Ive used sendkeys before to other applications but im not sure if i can pull from the window. Any help would be great. Thanks.
Re: Get ProgressBar Info from ghostsrv.exe in VB.NET
Thanks RobDog,
But i dont think that helped me much. If you've used spy++ im sure youve seen the messages it can get from a window. I have a progress bar that i want to grab its progress and put into a form that manages/watches 20-40 progress bars at one time.
What i really need is something that can watch the messages from the window or something that can just get the value of the forms textbox/progressbar/label/etc...
like
Code:
sub function getchildvalue(hwnd,childhwnd) as string
do the fancy stuff :)
end sub
Re: Get ProgressBar Info from ghostsrv.exe in VB.NET
Okay ive searched some more and im getting closer. For some reason the FindWindow and FindWindowEx were not returning the correct handles. It looks as though you need to declare them different in .net 2005 then you do in vb 6.0. I found some code while i was at work today that got me closer. At least i was getting the same handle each time. Before i would get random handles back each time i tried to get a window. When i find it i will post it here.......
.....Anyone have simple code to get text from notepad using sendmessage. And not just the sendmessage command. Unless of course you show the value of the constants passed to it. like WM_GETTEXT = &HD Then i think i can move on. Thanks
Public Function SendMessage(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
End Function
End Module
So here is a MODule that i added with my API calls. Somewhere someone has done all the API calls for windows and created a module, i just haven't found it yet.
Anyways, after i added the callingconvention my returned handles stayed the same! before i added that my number just grew and grew. But i get "FindWindowEx' has unbalanced the stack"
here is my call to findwindowex.
vb Code:
Public Class Form1
Dim ParenthWnd As Long
Dim ChildhWnd As Long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
if i comment out the findwindowex i get the handle of the parent. I must be missing something.....help please!!!!
edit: okay after reading this post i dont sound clear as to my problem. When i click on the forms button to call findwindow and findwindowex i get an pinvoke error and my program crashes. It seems to be the findwindowex call. It is possible my handle to the parent is bad.
How do i match the returned long hwnd to what i see in SPY++ ?
Re: Get ProgressBar Info from ghostsrv.exe in VB.NET
Okay a couple changes to the findwindow calls in my module. now im getting the same handle that spy++ is getting I will post full code zipped once i have a working 2005 vb.net API call to notepad so that hopefully someone else wont spend days trying to figuire this part of it out.
Re: Get ProgressBar Info from ghostsrv.exe in VB.NET
Okay done. Thanks pRoFiT for searching the internet for everything needed, plus trial and error. Here is a quick simple VB.NET 2005 getting text from notepad with API calls.
Damn 3 day weekend. All my good code is at work!!! I wish it was MONDAY so i could get back to work!