Results 1 to 8 of 8

Thread: [RESOLVED] Get ProgressBar Info from ghostsrv.exe in VB.NET

  1. #1

    Thread Starter
    Junior Member pRoFiT's Avatar
    Join Date
    Mar 2007
    Posts
    25

    [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.
    Last edited by pRoFiT; Apr 6th, 2007 at 02:22 AM.
    mov ax,13h
    int 10h

  2. #2

    Thread Starter
    Junior Member pRoFiT's Avatar
    Join Date
    Mar 2007
    Posts
    25

    Re: Get ProgressBar Info from ghostsrv.exe in VB.NET

    bump....nothing. I can see it in SPY++. What would i do from there. messages show percent 19..20..21 etc. Can i pull this info into my program?
    mov ax,13h
    int 10h

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get ProgressBar Info from ghostsrv.exe in VB.NET

    This will get everything that is available.

    http://vbforums.com/showthread.php?t=347552
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Junior Member pRoFiT's Avatar
    Join Date
    Mar 2007
    Posts
    25

    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
    mov ax,13h
    int 10h

  5. #5

    Thread Starter
    Junior Member pRoFiT's Avatar
    Join Date
    Mar 2007
    Posts
    25

    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
    mov ax,13h
    int 10h

  6. #6

    Thread Starter
    Junior Member pRoFiT's Avatar
    Join Date
    Mar 2007
    Posts
    25

    Re: Get ProgressBar Info from ghostsrv.exe in VB.NET

    hahah i found them. But there giving me errors where at work it wasn't!!!! damn .net

    vb Code:
    1. Imports System
    2. Imports System.Runtime.InteropServices
    3. Module API_Calls
    4.  
    5.     <DllImport("user32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
    6.     Public Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    7.     End Function
    8.  
    9.     <DllImport("user32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
    10.     Public Function FindWindowEx(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    11.     End Function
    12.  
    13.     <DllImport("user32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
    14.     Public Function SendMessage(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
    15.     End Function
    16.  
    17. 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:
    1. Public Class Form1
    2.     Dim ParenthWnd As Long
    3.     Dim ChildhWnd As Long
    4.  
    5.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    6.  
    7.         ParenthWnd = FindWindow(vbNullString, "Untitled - Notepad")
    8.         ChildhWnd = FindWindowEx(ParenthWnd, 0&, "Edit", vbNullString)
    9.         MsgBox("phwnd = " & ParenthWnd & " chwnd = " & ChildhWnd, MsgBoxStyle.OkOnly, "handles")
    10.  
    11.     End Sub
    12.  
    13. End Class

    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++ ?
    Last edited by pRoFiT; Apr 6th, 2007 at 01:33 AM.
    mov ax,13h
    int 10h

  7. #7

    Thread Starter
    Junior Member pRoFiT's Avatar
    Join Date
    Mar 2007
    Posts
    25

    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.

    vb Code:
    1. <DllImport("user32.dll", CallingConvention:=CallingConvention.Winapi, CharSet:=CharSet.Auto)> _
    2.     Public Function FindWindow(ByVal lpClassName As String, ByVal IpWindowName As String) As Integer
    3.     End Function
    4.  
    5.     <DllImport("user32.dll", CallingConvention:=CallingConvention.Winapi, CharSet:=CharSet.Auto)> _
    6.     Public Function FindWindowEx(ByVal hWnd1 As Integer, ByVal hWnd2 As Integer, ByVal lpsz1 As String, ByVal lpsz2 As String) As Integer
    7.     End Function
    mov ax,13h
    int 10h

  8. #8

    Thread Starter
    Junior Member pRoFiT's Avatar
    Join Date
    Mar 2007
    Posts
    25

    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!

    Enjoy
    Attached Files Attached Files
    mov ax,13h
    int 10h

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width