Imports System.Runtime.InteropServices Imports System.Text Imports TestEIn.EgtInterface Imports System.Globalization Public Module GenInterface '-------------------------------- IniFile : Get -------------------------------------------------- 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) Dim nPos As Integer = sValue.IndexOf(";") If nPos >= 0 Then sValue = sValue.Remove(nPos) End If Dim dValue As Double If Not Double.TryParse(sValue, NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, dValue) Then dValue = dDefault End If Return dValue End Function 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 ------------------------------------------------ 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 ---------------------------------------------------- Public Function GetSystemMenu(ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr End Function 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 -------------------------------------------------------- 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 '-------------------------------- File Path ------------------------------------------------------ ' Truncates a path to fit within a certain number of characters by replacing path components with ellipses. ' pszOut = The address of the string that has been altered. ' pszSrc = A pointer to a null-terminated string of length MAX_PATH that contains the path to be altered. ' cchMax = The maximum number of characters to be contained in the new string, including the terminating null. ' reserved = Reserved ' Returns TRUE if successful, or FALSE otherwise. Public Function PathCompactPathEx( pszOut As System.Text.StringBuilder, pszSrc As String, cchMax As UInteger, reserved As Integer ) As Boolean End Function End Module