________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
This program, using API calls, stores and retrieves the form size parameters in the windows registry under your name (DEK25) as registry key and "your program" (DEK25sProgram) as sub string, upon closing and running the program, respectively.
Copy and paste this code on a form and add the 8 or nine labels as indicated.
Remove the msgbox calls if you don't want to see them.
Run the program, resize the form dramatically (dragging the edges) and end by clicking the X box in the top right corner -- this action WRITES (input) to the registry.
When you run it again, the form appears the same size it was last by obtaining those values stored in the registry upon last closing -- this is a READ (Get) from the registry.
This will serve as a tutorial and you be able to adapt it to
your uses.
Evangelos Petroutsos's "Mastering Visual Basic 6" deserves credit for most of this bit.
Hope this helps,
Ortho
Option Explicit
Private Declare Function RegCreateKey Lib "advapi32.dll" _
Alias "RegCreateKeyA" (ByVal hKey As Long, _
ByVal lpSubKey As String, phkResult _
As Long) As Long
Private Declare Function RegDeleteKey Lib "advapi32.dll" _
Alias "RegDeleteKeyA" (ByVal hKey As Long, _
ByVal lpSubKey As String) As Long
Private Declare Function RegDeleteValue Lib "advapi32.dll" _
Alias "RegDeleteValueA" (ByVal hKey As Long, _
ByVal lpValueName As String) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" _
Alias "RegQueryValueExA" (ByVal hKey As Long, _
ByVal lpValueName As String, ByVal lpReserved As Long, _
lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" _
Alias "RegSetValueExA" (ByVal hKey As Long, _
ByVal lpValueName As String, ByVal Reserved As Long, _
ByVal dwType As Long, lpData As Any, _
ByVal cbData As Long) As Long
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.