Programalama > VISUAL BASIC


Ort. 5
Puan ver:
[ApplicationName]
Key=Value 
***** 16-bit Örnek *****
Project’inize 1 adet commandbutton ekleyin ve aşağıdaki kodu yazınız:
Declare Function GetPrivateProfileString Lib "kernel" (ByVal lpApplicationName _
As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal _
lpReturnedString As String, ByVal nSize As integer, ByVal lpFileName As String) _
As integer
Declare Function WritePrivateProfileString Lib "kernel" (ByVal _
lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As _
String, ByVal lpFileName As String) As integer
Sub Command1_Click()
Dim sData As String
Dim iDataLen As integer
' WIN.INI ‘den okur.
' [Desktop]
' Wallpaper={path\filename.bmp}
sData = Space$(255) ' string’lerin yerlerini ayırır.
iDataLen = GetPrivateProfileString("Desktop", "Wallpaper", "", sData, _
Len(sData), "win.ini")
sData = Left$(sData, iDataLen)
'Debug penceresine yazılır. 
Debug.Print sData
' WIN.INI şimdi yazılır.
' [Desktop]
sData = "here is some text"
WritePrivateProfileString "Desktop", "Test", sData, "win.ini"
End Sub
***** 32-bit Örnek *****
Project’inize 1 adet commandbutton ekleyin ve aşağıdaki kodu yazınız:
Option Explicit
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias _
"GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal _
lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As _
String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias _
"WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal _
lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As _
Long
Private Sub Command1_Click()
Dim sData As String
Dim lDataLen As Long
' WIN.INI’den okur.
' [Desktop]
' Wallpaper={path\filename.bmp}
sData = Space$(255) ' stringlerin yerini ayırır.
lDataLen = GetPrivateProfileString("Desktop", "Wallpaper", "", sData, _
Len(sData), "win.ini")
sData = Left$(sData, lDataLen)
' Debug penceresini yazılır. 
Debug.Print sData
' WIN.INI şimdi yazılır.
' [Desktop]
sData = "here is some text"
WritePrivateProfileString "Desktop", "Test", sData, "win.ini"
End Sub


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2024 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.