Hi,
i'm triying to make a VB.net application, that can be controlled by a DBP programm... and because exeat couldn't get the dlls working, i'm trying to control the VB app by another way....
First i wanted to control it by writing a file, and read it, but this was much too slow
Now I`m trying to write the data i want to transfer to the VB app into a memblock, write the memblock adress into a file, read this file once at the start, and the access the memblock by pointers...
But it doesnt work... heres the code:
sync on:sync rate 10
make memblock 1, 2
write memblock byte 1, 1, 7
do
set cursor 0, 0
print get memblock ptr(1)
print get memblock size(1)
print memblock byte(1, 0)
sync
loop
You have to create a new DB project, and set it to windowed(200*100 should be enough...
VB.net code:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim marshal As System.Runtime.InteropServices.Marshal
Dim pointer As IntPtr
#Region " Vom Windows Form Designer generierter Code "
Public Sub New()
MyBase.New()
' Dieser Aufruf ist für den Windows Form-Designer erforderlich.
InitializeComponent()
' Initialisierungen nach dem Aufruf InitializeComponent() hinzufügen
End Sub
' Die Form überschreibt den Löschvorgang der Basisklasse, um Komponenten zu bereinigen.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
' Für Windows Form-Designer erforderlich
Private components As System.ComponentModel.IContainer
'HINWEIS: Die folgende Prozedur ist für den Windows Form-Designer erforderlich
'Sie kann mit dem Windows Form-Designer modifiziert werden.
'Verwenden Sie nicht den Code-Editor zur Bearbeitung.
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(88, 72)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 128)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 265)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim var As Byte
rem remove the 578800 with the memblock ptr(1)
REM marshal.WriteByte(578800, 5, 15)
MessageBox.Show(marshal.ReadByte(578800, 2))
End Sub
End Class
Create a new Windows Application and copy this code into it...
Now, heres the problem: I cant access the right memory, i can write a byte into the memory (remove the rem to see it) and read it, but i cant read the DarkBasic memblock?
Plz help me
Kojo