DLL passing value between programs
DLL passing value between programs
DLL passing value between programs
DLL passing value between programs
DLL passing value between programs
DLL passing value between programs DLL passing value between programs DLL passing value between programs DLL passing value between programs DLL passing value between programs DLL passing value between programs DLL passing value between programs DLL passing value between programs
DLL passing value between programs DLL passing value between programs
DLL passing value between programs
Go Back  Xtreme Visual Basic Talk > > > DLL passing value between programs


Reply
 
Thread Tools Display Modes
  #1  
Old 11-19-2014, 06:19 PM
teg teg is offline
Newcomer
 
Join Date: Jan 2004
Posts: 21
Default DLL passing value between programs


This is the VB Code to pass a vale back and forth between a DLL and a program. Button one send a integer to the DLL and Button two read the integer from the DLL' It works as a stand alone but will not pass the integer between two programs. I know I've done it a long time ago (around 20 years ago) but can't think of how I got it to work and I'm sure I did it with a DLL. Each program will only pass or read one integer. I haven't posted in seven years and I can't remember ho to highlight the code. I'm sure it's something simple but I can't see what I'm doing wrong.

Code:
Imports Data_DLL.MyInteger

Public Class Form1
    Dim newclass As Data_DLL.MyInteger

    Private Sub Button1_Click(sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Data_DLL.MyInteger.WriteRuntimeData(TextBox1.Text)
    End Sub

    Private Sub Button2_Click(sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim Add As New Data_DLL.MyInteger
        Label1.Text = Add.ReadRuntimeData
    End Sub
End Class

'This is the DLL code

Public Class MyInteger
    Shared myRunData As Integer
    Public Shared Sub WriteRuntimeData(ByVal a As Integer)
        myRunData = a
    End Sub

    Public Function ReadRuntimeData()
        Return myRunData
    End Function
End Class

Last edited by Flyguy; 11-20-2014 at 01:49 AM. Reason: Added [code][/code] tags
Reply With Quote
  #2  
Old 11-20-2014, 04:25 AM
PlausiblyDamp's Avatar
PlausiblyDampDLL passing value between programs PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Since windows stopped being 16bit you can't simply use a .dll this way to share information between two running applications, each instance of the application effectively gets it's own copy of the dll loaded into memory.

A MemoryMappedFile is probably the best option these days (http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx )
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
DLL passing value between programs
DLL passing value between programs
DLL passing value between programs DLL passing value between programs
DLL passing value between programs
DLL passing value between programs
DLL passing value between programs DLL passing value between programs DLL passing value between programs DLL passing value between programs DLL passing value between programs DLL passing value between programs DLL passing value between programs
DLL passing value between programs
DLL passing value between programs
 
DLL passing value between programs
DLL passing value between programs
 
-->