Results 1 to 4 of 4

Thread: Console and handle

  1. #1

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Arrow Console and handle

    If I need to get an hWnd and I am using a console app, how can I set it?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  2. #2
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: Console and handle

    Start 1 or 2 notepad processes and then try this code

    Code:
    Sub Main()
    
            Console.Title = "Playing with Handle in Console"
            Dim counter As Integer = 0
    
            For Each p As Process In Process.GetProcessesByName("notepad")
                counter += 1
                Console.WriteLine(counter & " p window Handle: " &   p.MainWindowHandle.ToString)
            Next
    
            Console.ReadLine()
    
        End Sub
    Last edited by talkro; Mar 18th, 2007 at 08:38 AM.

  3. #3

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Console and handle

    Never mind, I'll just integrate a form into my console app and call ShellExecute from there....
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Console and handle

    Of perhaps better if I'll use the handle returned by GetDesktopWindow api...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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