Results 1 to 4 of 4

Thread: [RESOLVED] Starting VB6 Application from C# ????

  1. #1

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Resolved [RESOLVED] Starting VB6 Application from C# ????

    Hi all,

    I have a VB 6.0 application which i am calling from my C# application,
    using
    Code:
    Process startProcess = null;
    startProcess = Process.Start("ApplicationPath to start");
    this will run the application, next after minimizing the VB 6.0 application I need to display it again, so I used
    Code:
    ShowWindow(startProcess.MainWindowHandle, SW_SHOWNORMAL);
    Here the problem begins that VB6 application do not get displayed back from minimized state.
    This code works well if we try it for any other windows application like Notepad.exe, but not with a VB6 exe created with single form without any code.

    Need to know about this that why this is not happening in C# to display VB6 application.

    Thanks,

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Starting VB6 Application from C# ????

    Have you used any tools to check the value of the MainWindowHandle and the actual handle of your window? Are they the same or different?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member amolt's Avatar
    Join Date
    Aug 2006
    Location
    INDIA
    Posts
    80

    Resolved Re: Starting VB6 Application from C# ????

    Hi jmcilhinney

    I haven't used any tools to check that, but I guessed it is different so I tried a way to get the handle from Process ID and It works.

    I suppose that the handle is to be different but the MainWindowHandle work for other applications. Anyway for now my problem is solved.
    But I'm confused about why this happens to VB6 exe and not with any other application. Going to check this out later and will get back to you.

    Thanks anyway

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [RESOLVED] Starting VB6 Application from C# ????

    I helped someone with a similar issue a while back.

    Look specifically at post 9. The problem seems to be the way windows are created for vb6 applications with the ThunderRT6Main window and the ThunderRT6Form window.

    The solution I provided does not guarantee that you will get back the correct window though, as someone posted on my blog

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