Solved

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

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 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