9e22b7870e
- notevoli miglioramenti a disegno e gestione pezzi/layer.
139 lines
5.8 KiB
VB.net
139 lines
5.8 KiB
VB.net
Imports System.Runtime.InteropServices
|
|
Imports System.Text
|
|
Imports TestEIn.EgtInterface
|
|
|
|
Public Class GenInterface
|
|
|
|
'-------------------------------- IniFile : Get --------------------------------------------------
|
|
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
Public Shared Function GetPrivateProfileInt(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByVal nDefault As Integer,
|
|
ByVal lpFileName As String) As Integer
|
|
End Function
|
|
|
|
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
Private Shared 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 Shared 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 Shared 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 Shared 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 Shared 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 Shared Function WritePrivateProfileString(
|
|
ByVal lpAppName As String,
|
|
ByVal lpKeyName As String,
|
|
ByVal lpString As String,
|
|
ByVal lpFileName As String) As Boolean
|
|
End Function
|
|
|
|
Public Shared 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 Shared Function GetSystemMenu(ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr
|
|
End Function
|
|
<DllImport("user32.dll", CharSet:=CharSet.Auto)>
|
|
Public Shared 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
|
|
|
|
End Class
|