Støv, fibre og metalliske partikler kan påvirke både uptime, levetid og driftssikkerhed. Derfor arbejder flere datacentre systematisk med contamination control.
Start med et lat lav en modul fil som indeholder flg.:
Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal sSection As String, ByVal sKey As String, ByVal sDefault As String, ByVal sReturn As String, ByVal lReturnSize As Long, ByVal sFilename As String) As Long Declare Function WritePrivateProfileString Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal sSection As String, ByVal sKey As String, ByVal sSetting As String, ByVal sFilename As String) As Long
Public Function CallINI(txtSection As String, txtKey As String, txtPath As String) As String ' Funktionen henter værdier fra inifil. Dim sValue As String Dim lSize As Long Dim lTemp As Long Dim sDefault As String sValue = String(256, " ") lSize = Len(sValue) lTemp = GetPrivateProfileString(txtSection, txtKey, sDefault, sValue, lSize, txtPath) If lTemp <> 0 Then CallINI = sValue Else CallINI = sDefault End If End Function
Public Function WriteINI(txtSection As String, txtKey As String, sSetting As String, txtPath As String) As String ' Funktionen indsætter værdier fra Indstillinger. Dim sValue As String Dim lSize As Long Dim lTemp As Long sValue = String(256, " ") lSize = Len(sValue) lTemp = WritePrivateProfileString(txtSection, txtKey, " " & sSetting, txtPath) If lTemp <> 0 Then WriteINI = sValue Else WriteINI = sDefault End If End Function
Nå så du vil kalde din INI fil, skriver du flg. CallINI("LastOrdre", "OrdreNo", App.Path & "\FilNavn.ini")
hej medions, jeg kan ikke få din kode til at virke når jeg copy og paste den jeg har lavet en knap i en form, og når jeg skriver kodeen under knappen, bliver den rød med det samme, og når der trykkes på knappen skriver vb syntax error. her er koden Private Sub Command1_Click() CallINI("Gruppe", "type", App.Path & "\setup.ini")''denne er rød Label1.Caption = ini End Sub
Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal sSection As String, ByVal sKey As String, ByVal sDefault As String, ByVal sReturn As String, ByVal lReturnSize As Long, ByVal sFilename As String) As Long Declare Function WritePrivateProfileString Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal sSection As String, ByVal sKey As String, ByVal sSetting As String, ByVal sFilename As String) As Long
Public Function CallINI(txtSection As String, txtKey As String, txtPath As String) As String ' Funktionen henter værdier fra inifil. Dim sValue As String Dim lSize As Long Dim lTemp As Long Dim sDefault As String sValue = String(256, " ") lSize = Len(sValue) lTemp = GetPrivateProfileString(txtSection, txtKey, sDefault, sValue, lSize, txtPath) If lTemp <> 0 Then CallINI = sValue Else CallINI = sDefault End If End Function
Public Function WriteINI(txtSection As String, txtKey As String, sSetting As String, txtPath As String) As String ' Funktionen indsætter værdier fra Indstillinger. Dim sValue As String Dim lSize As Long Dim lTemp As Long sValue = String(256, " ") lSize = Len(sValue) lTemp = WritePrivateProfileString(txtSection, txtKey, " " & sSetting, txtPath) If lTemp <> 0 Then WriteINI = sValue Else WriteINI = sDefault End If End Function
jeg tror jeg har fået det til at virke, CallINI("Gruppe", "type", App.Path & "\setup.ini")''denne er rød skal det ikke være: call CallINI("Gruppe", "type", App.Path & "\setup.ini")'' så bliver den da ikke rød. men hvis jeg gerne vil vide hvad der står i type5, hvordan gør jeg det
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.