i made vb coded DLL .
i made Two Programs
The first changes variable value in the DLL
The Second Read This variable
So:
Two programs that use one DLL.
it dont works
ty :P
6 replies to this topic
#1
Posted 25 November 2011 - 10:33 AM
|
|
|
#2
Posted 29 November 2011 - 02:45 PM
Umm do you have some code we can look at, to try and find the error? Or the problem your getting?
~ Committed.
~ Committed.
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.
Science is only an educated theory, which we cannot disprove.
#3
Posted 30 November 2011 - 08:20 AM
here is the simplest Code:
abd ther is one App that use the SetD
and other use the GetD
after i use the SetD and change the value of Num
when i call the GetD Function the number is still 6
ty :P
Imports System.IO Public Class GetSetData Dim Num As Integer = 6 Function GetD() Dim Ans As Integer Ans = Num Return Ans End Function Public Sub SetD(ByVal Num1 As Integer) Num = Num1 End Sub End Class
abd ther is one App that use the SetD
and other use the GetD
after i use the SetD and change the value of Num
when i call the GetD Function the number is still 6
ty :P
#4
Posted 06 December 2011 - 08:30 PM
BUMP
#5
Posted 06 December 2011 - 10:06 PM
PogBender said:
BUMP
From an outside perspective (it has been somewhat a decade since I had touched visual basic) it looks like you will need to use the property statement, and not the sub for a function:
Class Class1 ' Define a local variable to store the property value.
Private propertyValue As String
' Define the property.
Public Property prop1() As String
Get
' The Get property procedure is called when the value
' of a property is retrieved.
Return propertyValue
End Get
Set(ByVal value As String)
' The Set property procedure is called when the value
' of a property is modified. The value to be assigned
' is passed in the argument to Set.
propertyValue = value
End Set
End Property
End Class
This can allow prop1() to return "propertyValue" and prop1("something") to set "propertyValue" (from what I gather)
Resource from: http://msdn.microsof...y/zzh9ha57.aspx
----
As a side note, you should decide on the scope of the variable created. "dim" may be public, when you wish for "private" (only available to the class)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#6
Posted 06 December 2011 - 11:19 PM
Without special treatment, no matter what programming language is, you will always get this problem. And this is actually by design. Any memory allocated by a dll will be done in the memory space allocated to the application that load the dll. So your dll variable for application #1 will be different with dll variable for application #1. Yes, each application get their own copy of dll variable.
One of the solution for your problem is by using memory mapped files. With this, each application can share the same variable. See example of how the memory mapping is done in this tutorial (see under Dynamic-Link Library). It was in Delphi, but I hope you can see how it's done, and to implement it in vb.
One of the solution for your problem is by using memory mapped files. With this, each application can share the same variable. See example of how the memory mapping is done in this tutorial (see under Dynamic-Link Library). It was in Delphi, but I hope you can see how it's done, and to implement it in vb.
#7
Posted 07 December 2011 - 09:52 AM
TY very much,both of you.
i'll try it.
:P
i'll try it.
:P
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









