Solved

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

Posted on 2006-06-23
3
786 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now