Hello,
I have created a DLL using VC++ 6.0 with one entry point: CString test(CString string,BOOL mode).
As you can see in the code below I know how to access and use the Windows API...and in this brief test project it works. However, when I click the button and the program comes to the function from my custom DLL, it gives me this error:
An unhandled exception of type 'System.NullReferenceException' occurred in testdc.exe
Additional information: Object reference not set to an instance of an object.
Could this error be related to a problem in my DLL function? I am under the impression that this error is a coding error, and not related to the DLL function, but what reference is it talking about?
Here is the code:
Public Class Form1
Inherits System.Windows.Forms.Form
Declare Function test Lib "database.dll" (ByVal str As String, ByVal mode As Boolean) As String
Declare Function GetKeyState Lib "user32.dll" ( _
ByVal nVirtKey As Long) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
Label1.Text = ""
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim a As Integer = GetKeyState(72)
Label2.Text = String.Format("{0}", a)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text += test("Hello World", True)
End Sub
End Class
Thank you for your time.
I have created a DLL using VC++ 6.0 with one entry point: CString test(CString string,BOOL mode).
As you can see in the code below I know how to access and use the Windows API...and in this brief test project it works. However, when I click the button and the program comes to the function from my custom DLL, it gives me this error:
An unhandled exception of type 'System.NullReferenceException' occurred in testdc.exe
Additional information: Object reference not set to an instance of an object.
Could this error be related to a problem in my DLL function? I am under the impression that this error is a coding error, and not related to the DLL function, but what reference is it talking about?
Here is the code:
Public Class Form1
Inherits System.Windows.Forms.Form
Declare Function test Lib "database.dll" (ByVal str As String, ByVal mode As Boolean) As String
Declare Function GetKeyState Lib "user32.dll" ( _
ByVal nVirtKey As Long) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
Label1.Text = ""
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim a As Integer = GetKeyState(72)
Label2.Text = String.Format("{0}", a)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text += test("Hello World", True)
End Sub
End Class
Thank you for your time.