Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Send message from VB6, VBA, and VB.NET to VB.NET

Posted on 2006-06-23
3
797 Views
Last Modified: 2012-05-05
We have a hand full of applications written in VB6, Access2003, and VB.NET.  I have written an application (App1) that launches these applications.  When the user clicks on the application button the application starts loading in the background but I want to have a status bar on App1 that runs until the selected application (App2) completes loading.  To do this I need to have App2 send back a message to App1 stating that it has finished laoding.  I have been testing having App2 send a message with SENDMESSAGE and having App1 catch that message with WndProc.  This has not worked and I'm not sure which or if both ends of the communication are not working.  Any help toward getting this to work or suggestions of better ways to do this would be greatly appriciated.


''''''''''''''''''''''''''''''''''''''''''''''''''''''
App1
''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

        If m.ToString = "End" Then
            MsgBox("here!!!")
            StopLoad()
        End If
        MyBase.WndProc(m)
    End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''
App2
''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Declare Function SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Const WM_GETTEXT = &HD
Private Const WM_SETTEXT = &HC
Private Const EM_GETLINECOUNT = &HBA

....and once the program has loaded I have this line

SendMessageSTRING 3332, WM_SETTEXT, 256, "End"                          ' 3332 is from App1 System.Diagnostics.Process.GetCurrentProcess().Handle

I don't get any error messages....just don't get any result at all.
0
Comment
Question by:Ennovations
3 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 16972792
Not exactly what you asked for...

How about a different approach?

        Label1.Text = "Loading"
        Dim p As Process = Process.Start("c:\test.exe")
        While Not p.WaitForInputIdle(50)
            Label1.Text &= "."
            Application.DoEvents()
        End While
        Label1.Text &= "Done"

WaitForInputIdle():
http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.waitforinputidle.aspx
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with error in Query 2 31
How to limit User Input 2 27
run a stored procedure from vb.net 1 27
VB.NET - Refactor Class per SOLID principles 2 16
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question