5ce2c38baa
- primo rilascio dopo prove su macchina
77 lines
3.0 KiB
VB.net
77 lines
3.0 KiB
VB.net
Imports System.Globalization
|
|
Imports System.Runtime.InteropServices
|
|
Imports System.Text
|
|
|
|
Public Module GenInterface
|
|
|
|
'-------------------------------- IniFile : Get --------------------------------------------------
|
|
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
Public Function GetPrivateProfileInt(
|
|
lpAppName As String,
|
|
lpKeyName As String,
|
|
nDefault As Integer,
|
|
lpFileName As String) As Integer
|
|
End Function
|
|
|
|
Public Function GetPrivateProfileDouble(
|
|
lpAppName As String,
|
|
lpKeyName As String,
|
|
dDefault As Double,
|
|
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
|
|
|
|
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
Private Function GetPrivateProfileString(
|
|
lpAppName As String,
|
|
lpKeyName As String,
|
|
lpDefault As String,
|
|
lpReturnedString As StringBuilder,
|
|
nSize As Integer,
|
|
lpFileName As String) As Integer
|
|
End Function
|
|
Public Function GetPrivateProfileString(
|
|
lpAppName As String,
|
|
lpKeyName As String,
|
|
lpDefault As String,
|
|
ByRef lpString As String,
|
|
lpFileName As String) As Integer
|
|
Dim sb As New StringBuilder(1024)
|
|
Dim nRet As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, sb, sb.Capacity, lpFileName)
|
|
lpString = sb.ToString
|
|
Return nRet
|
|
End Function
|
|
|
|
'-------------------------------- IniFile : Write ------------------------------------------------
|
|
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
|
Public Function WritePrivateProfileString(
|
|
lpAppName As String,
|
|
lpKeyName As String,
|
|
lpString As String,
|
|
lpFileName As String) As Boolean
|
|
End Function
|
|
|
|
'-------------------------------- Windows --------------------------------------------------------
|
|
Public Enum SW As Integer
|
|
HIDE = 0
|
|
SHOWMAXIMIZED = 3
|
|
RESTORE = 9
|
|
End Enum
|
|
|
|
<DllImport("user32.dll")>
|
|
Public Function ShowWindow(hWnd As IntPtr, nCmdShow As Integer) As Boolean
|
|
End Function
|
|
|
|
|
|
End Module
|