' save form positions and restore then. I hope you
' like this and if you have any new idea please
' write me at NOlazabal@AOL.com or Nolazabal@MSN.com
'API Declarations
Declare Function GetPrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, 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 Any, ByVal lpString As Any, ByVal lplFileName As String) As Integer
'Variable Declarations
Global r% 'Result Code from WritePrivateProfileString
Global inipath$ 'Path to .ini file
Global Lft$, Top$, hei$, wid$
Global glft
Sub centerme (frm As Form)
Dim x, y 'New directions for the form
x = (Screen.Width - frm.Width) / 2
y = (Screen.Height - frm.Height) / 2
frm.Move x, y 'Change the location of the form
End Sub
Sub Get_Position (frm As Form, formname$)
Dim glft, gtop, ghei, gwid
inipath$ = app.Path + "\positi.ini"
glft = GetFromINI(formname$, "Left", inipath$)
gtop = GetFromINI(formname$, "Top", inipath$)
ghei = GetFromINI(formname$, "Height", inipath$)
gwid = GetFromINI(formname$, "Width", inipath$)
If glft <> "" Then
frm.Left = glft
End If
If gtop <> "" Then
frm.Top = gtop
End If
If ghei <> "" Then
frm.Height = ghei
End If
If gwid <> "" Then
frm.Width = gwid
End If
End Sub
Function GetFromINI (AppName$, KeyName$, FileName$) As String