[AccessD] OT: Need an example

Gustav Brock Gustav at cactus.dk
Thu Dec 1 11:45:17 CST 2005


Hi Susan

Why should this be OT?
How about the good old ShowProgressDialog when converting pictures?

Main code below.

/gustav

Public Sub ShowJpegProgressDialog()

' Retrieves or resets registry setting of JPEG value for ShowProgressDialog.

' The initial call will retrieve the value from the registry.
' Subsequent calls will write the value back.

' Usage:
'   At opening of application (main form):
'     Call ShowJpegProgressDialog
'
'   Do stuff like changing the setting to False:
'     Call ShowJpegProgressDialog_Set(False)
'
'   At closing of application (main form):
'     Call ShowJpegProgressDialog

' 2002-01-12. Cactus Data ApS, CPH
' 2004-08-02. Adjusted with check for WinXP.

  Static booRegValue  As Boolean
  Static booRetrieved As Boolean
  
  If booRetrieved = False Then
    ' Retrieve value.
    Call ShowJpegProgressDialog_Get(booRegValue)
    booRetrieved = True
  Else
    ' Rewrite previously retrieved value.
    Call ShowJpegProgressDialog_Set(booRegValue)
  End If

End Sub


Public Function GetShowJpegProgressDialogStatus() As Boolean

' Demo.
  
  Call ShowJpegProgressDialog_Get(GetShowJpegProgressDialogStatus)
  
End Function

Public Sub ShowJpegProgressDialog_Get(ByRef booShow As Boolean)

  Dim hKeyVar   As Long
  Dim PathVar   As String
  Dim ValueVar  As String
  Dim DataVar   As String
  
  If IsWinXP = True Then
    hKeyVar = HKEY_CURRENT_USER
  Else
    hKeyVar = HKEY_LOCAL_MACHINE
  End If
  PathVar = "Software\Microsoft\Shared Tools\Graphics Filters\Import\JPEG\Options"
  ValueVar = "ShowProgressDialog"
  
  Call ReadRegistry(hKeyVar, PathVar, ValueVar, DataVar)
  booShow = (StrComp(DataVar, "Yes", vbTextCompare) = 0)

End Sub

Public Sub ShowJpegProgressDialog_Set(ByVal booShow As Boolean)

  Dim hKeyVar   As Long
  Dim PathVar   As String
  Dim ValueVar  As String
  Dim DataVar   As String
  
  If IsWinXP = True Then
    hKeyVar = HKEY_CURRENT_USER
  Else
    hKeyVar = HKEY_LOCAL_MACHINE
  End If
  PathVar = "Software\Microsoft\Shared Tools\Graphics Filters\Import\JPEG\Options"
  ValueVar = "ShowProgressDialog"
  DataVar = IIf(booShow = True, "Yes", "No")
  
  Call WriteRegistry(hKeyVar, PathVar, ValueVar, DataVar)

End Sub


>>> harkinsss at bellsouth.net 01-12-2005 18:30 >>>
I'm writing about maintaining settings using the Registry -- I know how to
do it, but would like suggestions on an example that would allow the reader
to experience the process without endangering anything. Needs to be an
Access setting. 





More information about the AccessD mailing list