ACCESS设置应用程序标题和图标的源码

来源:百度文库 编辑:神马文学网 时间:2024/04/29 19:01:46

ACCESS设置应用程序标题和图标的源码

 


正 文:

  1. Function AddAppProperty(strName As String, _
  2.                         varType As Variant, varvalue As VariantAs Integer
  3.     '应用程序标题和图标
  4.     Dim dbs As Object, prp As Variant
  5.     Const conPropNotFoundError = 3270
  6.     Set dbs = CurrentDb
  7.     On Error GoTo AddProp_Err
  8.     dbs.Properties(strName) = varvalue
  9.     AddAppProperty = True
  10. AddProp_Bye:
  11.     Exit Function
  12. AddProp_Err:
  13.     If Err = conPropNotFoundError Then
  14.         Set prp = dbs.CreateProperty(strName, varType, varvalue)
  15.         dbs.Properties.Append prp
  16.         Resume
  17.     Else
  18.         AddAppProperty = False
  19.         Resume AddProp_Bye
  20.     End If
  21. End Function
  22. ----------------------------------------------------------------------------------------
  23. Private Sub Form_Current()
  24.      Dim intX   As Integer
  25.     Const DB_Text As Long = 25
  26.     '设置应用程序标题
  27.     intX = AddAppProperty("apptitle", DB_Text, xtmc)
  28.     '设置图标
  29.     intX = AddAppProperty("AppIcon", DB_Text, CurrentProject.Path & "\" & "30346.ico")
  30.     CurrentDb.Properties("UseAppIconForFrmRpt") = 1
  31.     Application.RefreshTitleBar
  32.     '回答问题2:这里请注意,如果你同时定义了 AppIcon 和 AppTitle,只要其中有一项是错误的,
  33.     '比如 AppIcon 的文件名或者路径错误,那么 RefreshTitleBar 就不会刷新标题。