b8e0266559
- modifiche per gestione max numero istanze - modufiche per superfici di regioni piane con buchi e per estrusioni con buchi e chiusure.
160 lines
6.5 KiB
VB.net
160 lines
6.5 KiB
VB.net
Imports System.Runtime.InteropServices
|
|
Imports System.Text
|
|
Imports TestEIn.EgtInterface
|
|
|
|
Public Module GenInterface
|
|
|
|
'-------------------------------- IniFile : Get --------------------------------------------------
|
|
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
Public Function GetPrivateProfileInt(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByVal nDefault As Integer,
|
|
ByVal lpFileName As String) As Integer
|
|
End Function
|
|
|
|
Public Function GetPrivateProfileDouble(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByVal dDefault As Double,
|
|
ByVal lpFileName As String) As Double
|
|
Dim sValue As String = String.Empty
|
|
GetPrivateProfileString(lpAppName, lpKeyName, dDefault.ToString(), sValue, lpFileName)
|
|
Return Double.Parse(sValue, System.Globalization.CultureInfo.InvariantCulture)
|
|
End Function
|
|
|
|
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
Private Function GetPrivateProfileString(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByVal lpDefault As String,
|
|
ByVal lpReturnedString As StringBuilder,
|
|
ByVal nSize As Integer,
|
|
ByVal lpFileName As String) As Integer
|
|
End Function
|
|
Public Function GetPrivateProfileString(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByVal lpDefault As String,
|
|
ByRef lpString As String,
|
|
ByVal lpFileName As String) As Integer
|
|
Dim sb As New StringBuilder(512)
|
|
Dim nRet As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, sb, sb.Capacity, lpFileName)
|
|
lpString = sb.ToString
|
|
Return nRet
|
|
End Function
|
|
|
|
Public Function GetPrivateProfileColor(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByRef Col As Color3d,
|
|
ByVal lpFileName As String) As Boolean
|
|
Dim sVal As String = String.Empty
|
|
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
|
|
Dim sItems() As String = sVal.Split(",".ToCharArray)
|
|
If sItems.Count() >= 3 Then
|
|
Col.R = Int(sItems(0))
|
|
Col.G = Int(sItems(1))
|
|
Col.B = Int(sItems(2))
|
|
If sItems.Count() >= 4 Then
|
|
Col.A = Int(sItems(3))
|
|
End If
|
|
Return True
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
Public Function GetPrivateProfileZoomWin(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByRef bOutline As Boolean,
|
|
ByRef Col As Color3d,
|
|
ByVal lpFileName As String) As Boolean
|
|
Dim sVal As String = String.Empty
|
|
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
|
|
Dim sItems() As String = sVal.Split(",".ToCharArray)
|
|
If sItems.Count() >= 5 Then
|
|
bOutline = (Int(sItems(0)) <> 0)
|
|
Col.R = Int(sItems(1))
|
|
Col.G = Int(sItems(2))
|
|
Col.B = Int(sItems(3))
|
|
Col.A = Int(sItems(4))
|
|
Return True
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
Public Function GetPrivateProfileWinPos(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByRef nFlag As Integer,
|
|
ByRef nLeft As Integer,
|
|
ByRef nTop As Integer,
|
|
ByRef nWidth As Integer,
|
|
ByRef nHeight As Integer,
|
|
ByVal lpFileName As String) As Boolean
|
|
Dim sVal As String = String.Empty
|
|
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
|
|
Dim sItems() As String = sVal.Split(",".ToCharArray)
|
|
If sItems.Count() >= 5 Then
|
|
nFlag = Int(sItems(0))
|
|
nLeft = Int(sItems(1))
|
|
nTop = Int(sItems(2))
|
|
nWidth = Int(sItems(3))
|
|
nHeight = Int(sItems(4))
|
|
Return True
|
|
End If
|
|
Return False
|
|
End Function
|
|
|
|
|
|
'-------------------------------- IniFile : Write ------------------------------------------------
|
|
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
Public Function WritePrivateProfileString(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByVal lpString As String,
|
|
ByVal lpFileName As String) As Boolean
|
|
End Function
|
|
|
|
Public Function WritePrivateProfileWinPos(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByVal nFlag As Integer,
|
|
ByVal nLeft As Integer,
|
|
ByVal nTop As Integer,
|
|
ByVal nWidth As Integer,
|
|
ByVal nHeight As Integer,
|
|
ByVal lpFileName As String) As Boolean
|
|
Dim sVal As String
|
|
sVal = nFlag.ToString & "," & nLeft.ToString & "," & nTop.ToString & "," & nWidth.ToString & "," & nHeight.ToString
|
|
Return WritePrivateProfileString(lpAppName, lpKeyName, sVal, lpFileName)
|
|
End Function
|
|
|
|
|
|
'-------------------------------- System Menu ----------------------------------------------------
|
|
<DllImport("user32.dll")>
|
|
Public Function GetSystemMenu(ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr
|
|
End Function
|
|
<DllImport("user32.dll", CharSet:=CharSet.Auto)>
|
|
Public Function AppendMenu(ByVal hMenu As IntPtr, ByVal uFlags As Integer,
|
|
ByVal uIDNewItem As Integer, ByVal lpNewItem As String) As Boolean
|
|
End Function
|
|
Public Const MF_STRING As UInt32 = &H0
|
|
Public Const MF_SEPARATOR As UInt32 = &H800
|
|
Public Const WM_SYSCOMMAND As UInt32 = &H112
|
|
Public Const IDM_ABOUTBOX As UInt32 = &H10
|
|
|
|
'-------------------------------- Windows --------------------------------------------------------
|
|
<DllImport("user32.dll")>
|
|
Public Function ShowWindow(ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Boolean
|
|
End Function
|
|
Public Enum SW As Integer
|
|
HIDE = 0
|
|
SHOWMAXIMIZED = 3
|
|
RESTORE = 9
|
|
End Enum
|
|
|
|
|
|
End Module
|