Click here to Skip to main content
16,017,707 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Limitations of Custom Controls... Pin
nick.ueda2-May-05 15:33
nick.ueda2-May-05 15:33 
GeneralRe: Limitations of Custom Controls... Pin
Christian Graus2-May-05 15:36
protectorChristian Graus2-May-05 15:36 
GeneralRe: Limitations of Custom Controls... Pin
Dave Kreskowiak3-May-05 2:17
mveDave Kreskowiak3-May-05 2:17 
GeneralUsing a C++ dll in VB.net Pin
Reanalyse2-May-05 13:45
Reanalyse2-May-05 13:45 
GeneralRe: Using a C++ dll in VB.net Pin
Christian Graus2-May-05 13:59
protectorChristian Graus2-May-05 13:59 
GeneralRe: Using a C++ dll in VB.net Pin
Reanalyse2-May-05 14:50
Reanalyse2-May-05 14:50 
GeneralRe: Using a C++ dll in VB.net Pin
Christian Graus2-May-05 14:54
protectorChristian Graus2-May-05 14:54 
GeneralRe: Using a C++ dll in VB.net Pin
Reanalyse3-May-05 14:37
Reanalyse3-May-05 14:37 
Thanks Christian
I have got a long way down the track thanks to your help
I have got this far
Am I passing the correct way to a VC++ DLL from VB.NET ?
------------------------------------------------------------------------------
Structure PVIEW
'// View Structure **********************************************
'typedef struct tag_VIEW
'{
'BOOL Viewable; // TRUE = Drawing can be viewed
'int WindowLeft; // Drawing Window Boundary Properties (In Pixels)
'int WindowTop; // Drawing Window Boundary Properties (In Pixels)
'int WindowRight; // Drawing Window Boundary Properties (In Pixels)
'int WindowBottom; // Drawing Window Boundary Properties (In Pixels)
'double ViewLeft; // Drawing View Properties (In Units)
'double ViewBottom; // Drawing View Properties (In Units)
'double ViewRight; // Drawing View Properties (In Units)
'double ViewTop; // Drawing View Properties (In Units)
'double PPU; // Pixels Per Unit
'double ZoomLevel; // Zoom Level
'} VIEW, *PVIEW;

Public Viewable As Boolean
Public WindowLeft As Integer
Public WindowTop As Integer
Public WindowRight As Integer
Public WindowBottom As Integer
Public ViewLeft As Double
Public ViewBottom As Double
Public ViewRight As Double
Public ViewTop As Double
Public PPU As Double
Public ZoomLevel As Double
End Structure

Public Class Form1
Inherits System.Windows.Forms.Form

Public Declare Function drwCreate Lib "CADIO" () As Long
'Exported Function drwCreate
'BOOL Create( );

Private Declare Function drwLoadDataFromFile Lib "CADIO" (ByVal Handle As Long, ByVal Handle1 As Long, ByVal Res0 As Integer, ByVal Filename As String, ByVal Handle2 As Long) As Boolean
'Exported Function drwLoadDataFromFile
'BOOL (*drwLoadDataFromFile)( HDRAWING hDrawing, OBJHANDLE BlockObjhandle, DWORD Reserved, LPCTSTR strFileName, HWND hWndProgress );


Public Declare Function drwInitView Lib "CADIO" (ByVal Handle As Long, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal Nheight As Integer) As Boolean
'Exported Function form DLL =drwInitView
'Public BOOL InitView( int x, int y, int nWidth, int nHeight );

Private Declare Function drwPaint Lib "CADIO" (ByVal drwhandle As Long) As Boolean

Private Declare Function dxfSetCurrentColor Lib "CADIO" (ByVal drwhandle As Long, ByVal Color As Integer) As Boolean

Private Declare Function drwGetViewProperties Lib "CADIO" (ByVal drwhandle As Long, ByVal Thisview As PVIEW) As Boolean
Private Declare Function drwAddBlock Lib "CADIO" (ByVal drwhandle As Long) As Boolean


#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
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

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
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(128, 72)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
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 drwhandle1 As Long
Dim Blockhandle As Long
Dim RetVal As Boolean
Dim CurrentView As PVIEW





drwhandle1 = drwCreate()
RetVal = drwInitView(drwhandle1, 1, 1, 300, 300) 'returns true
RetVal = dxfSetCurrentColor(drwhandle1, 1) 'returns true
RetVal = drwPaint(drwhandle1) 'returns true
RetVal = drwAddBlock(drwhandle1) 'returns true

'Here is where trouble occurs

RetVal = drwGetViewProperties(drwhandle1, CurrentView) 'Does not work
RetVal = drwLoadDataFromFile(drwhandle1, Nothing, 0, "H:\test.dxf", Nothing) 'does not work

____________________________________________________________________________
The last two calls did not work at all
Regards
GeneralRe: Using a C++ dll in VB.net Pin
Christian Graus3-May-05 14:48
protectorChristian Graus3-May-05 14:48 
GeneralRe: Using a C++ dll in VB.net Pin
Reanalyse3-May-05 16:01
Reanalyse3-May-05 16:01 
GeneralRe: Using a C++ dll in VB.net Pin
Christian Graus3-May-05 16:11
protectorChristian Graus3-May-05 16:11 
GeneralApp config help Pin
Joey Picerno2-May-05 10:23
Joey Picerno2-May-05 10:23 
GeneralRe: App config help Pin
mike2k52-May-05 11:58
mike2k52-May-05 11:58 
GeneralRe: App config help Pin
Joey Picerno2-May-05 12:51
Joey Picerno2-May-05 12:51 
GeneralRe: App config help Pin
Het21092-May-05 18:43
Het21092-May-05 18:43 
GeneralKilling child processes Pin
Sam Marrocco2-May-05 8:29
Sam Marrocco2-May-05 8:29 
GeneralGet variables set in a SUB Pin
mike2k52-May-05 8:19
mike2k52-May-05 8:19 
GeneralRe: Get variables set in a SUB Pin
Het21092-May-05 18:48
Het21092-May-05 18:48 
GeneralSeperate decimal from whole number Pin
vertig07302-May-05 7:19
vertig07302-May-05 7:19 
GeneralRe: Seperate decimal from whole number Pin
chrismerrill2-May-05 7:49
chrismerrill2-May-05 7:49 
GeneralMortgage calulator loop question vb.net Pin
vb.net challenged2-May-05 6:16
vb.net challenged2-May-05 6:16 
GeneralHTML to IMAGE Pin
woklet2-May-05 5:02
woklet2-May-05 5:02 
GeneralStream problems Pin
CrazyEd161-May-05 23:35
CrazyEd161-May-05 23:35 
GeneralRe: Stream problems Pin
GeneralDisorder2-May-05 0:37
GeneralDisorder2-May-05 0:37 
GeneralProb in transferring ASP.NET Web Application Pin
vishalmishra1-May-05 23:15
vishalmishra1-May-05 23:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.