惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - James Wong

QQ在线代码生成器 - James Wong - 博客园 試試Cashfiesta CreateProcess&Shellexecute - James Wong - 博客园 XP系統下顯示窗體陰影 GDI+的用處 Domino學習筆記(11) Domino學習筆記(10) ERP推行實踐(10) Domino學習筆記(09) Domino學習筆記(08) ERP推行實踐(09) VB2005學習筆記(01) VB2005之全局鼠標鍵盤鉤子 ERP推行實踐(08) Domino學習筆記(07) ERP推行實踐(07) ERP推行實踐(06) ACCESS開發數據應用程序體會 從范例創建首個Lotus應用程序
ACCESS自動更新模式
James Wong · 2005-02-24 · via 博客园 - James Wong

一、定義創建快捷方式過程:
Sub CreateTSCut(AppFullName As String)
Dim lnkPath As String, lnkName As String, ExePath As String, Ts As String
Dim i As Integer
 
  lnkName = "TSAPP"
  lnkPath = GetDirs("desktop") & "\"
  ExePath = CStr(SysCmd(acSysCmdAccessDir)) & "MSAccess.EXE"
 
  Open lnkPath & "tmp.vbs" For Output As #1
      Print #1, "Dim WSHShell,oShellLink"
      Print #1, "Set WSHShell = WScript.CreateObject(" & Chr(34) & "WScript.Shell" & Chr(34) & ")"
      Print #1, "Set oShellLink = WSHShell.CreateShortCut(" & Chr(34) & lnkPath & lnkName & ".lnk" & Chr(34) & ")"
      Print #1, "oShellLink.TargetPath =" & Chr(34) & ExePath & Chr(34)
      Print #1, "oShellLink.Arguments=""""""" & AppFullName & """"""""
      Print #1, "oShellLink.WorkingDirectory=" & Chr(34) & CStr(SysCmd(acSysCmdAccessDir)) & Chr(34)
      Print #1, "oShellLink.Save"
  Close #1
  If Shell("wscript """ & lnkPath & "tmp.vbs""") <> 0 Then
  Call SleepEx(3000, 0)
  FileSystem.Kill lnkPath & "tmp.vbs"
  End If
  MsgBox "您已成功創建了一個快捷方式在桌面,您可以使用它更快速的打開應用程式!", vbInformation
End Sub


二、文件拷貝更新:

  If TEMPS <> rs("VersionNO") Then
     If MsgBox("當前專案已有新版本,您需要更新以使用新功能..." + vbNewLine + "按 [是] 進行更新,按 [否] 將繼續使用舊版本! 本次更新內容:" & vbNewLine & vbNewLine & rs("UpdateContent"), vbInformation + vbYesNo, "Update information...") = vbYes Then
         TargetPath = rs("UpdatePath")
         '更新模式
         Select Case rs("UpdateType")
            Case 0:                      '主程式更新
                If CopyTFile(TargetPath & rs("UpdateName"), CurDir & rs("UpdateName")) Then
                  DoCmd.SetWarnings False
                  MsgBox "Upgrade successed,the system will restart now.", vbInformation
                  WriteINI "AllI", "Version", rs("VersionNO"), CurDir & "Dlls\mscini.dll"
                  TEMPS = CurDir & rs("UpdateName")
                  Call CreateTSCut(TEMPS)
                  Shell CStr(SysCmd(acSysCmdAccessDir)) & "MSAccess.EXE """ & TEMPS & """", vbMaximizedFocus
                  DoCmd.Quit acQuitSaveNone
                Else  '---------------------更新失敗
                  MsgBox "Upgrade failer,please ask for the soft engineer!", vbExclamation
                  DoCmd.Quit
                End If
            Case 1:    '完全更新
                If CopyTFile(TargetPath & Left(CurrentProject.Name, Len(CurrentProject.Name) - 14) & rs("VersionNO") & ".ade", CurDir & Left(CurrentProject.Name, Len(CurrentProject.Name) - 14) & rs("VersionNO") & ".ade") Then
                    DeleteFld CurDir & "Dlls", True, False
                    CopyFld TargetPath & "DLLS", CurDir & "Dlls", True, True
                    DeleteFld CurDir & "Res", True, False
                    CopyFld TargetPath & "Res", CurDir & "Res", True, True
                    MsgBox "Upgrade successed,the system will restart now.", vbInformation
                    WriteINI "AllI", "Version", rs("VersionNO"), CurDir & "Dlls\mscini.dll"
                    TEMPS = CurDir & rs("UpdateName")
                    Shell CStr(SysCmd(acSysCmdAccessDir)) & "MSAccess.EXE """ & TEMPS & """", vbMaximizedFocus
                    DoCmd.Quit acQuitSaveNone
                Else  '---------------------更新失敗
                  MsgBox "Upgrade failer,please ask for the soft engineer!", vbExclamation
                  DoCmd.Quit
                End If
           Case 2:    '更新動態庫
                DeleteFld CurDir & "Dlls", True, False
                CopyFld TargetPath & "DLLS", CurDir & "Dlls", True, True
                WriteINI "AllI", "Version", rs("VersionNO"), CurDir & "Dlls\mscini.dll"
                MsgBox "Upgrade successed."
            Case 3:    '更新資源庫
                DeleteFld CurDir & "Res", True, False
                CopyFld TargetPath & "Res", CurDir & "Res", True, True
                WriteINI "AllI", "Version", rs("VersionNO"), CurDir & "Dlls\mscini.dll"
                MsgBox "Upgrade successed."
        
         End Select
     Else  '=========不進行更新
       Me.Caption = " Please log in..."
       Me.Repaint
       UserDept.SetFocus
       rs.Close
       Set rs = Nothing
       Exit Sub
     End If
  End If

三、應用程式鏈接和文件拷貝選擇更新:
  If TEMPS <> rs("UpdateName") Then
      Select Case MsgBox("當前專案已有新版本,您需要更新以使用新功能..." + vbNewLine + "按 [是] 使用安裝程式進行更新,按 [否]使用文件拷貝方式更新, 按[取消] 將繼續使用舊版本! 本次更新內容:" & vbNewLine & vbNewLine & rs("UpdateContent"), vbInformation + vbYesNoCancle, "Update information...")
      Case vbYes:  
                LabHyp.HyperlinkAddress = rs("UpdatePath") & rs("UpdateExe")
                LabHyp.Hyperlink.Follow True
                DoCmd.Quit acQuitSaveNone
      Case vbNo:
                If CopyTFile(rs("UpdatePath") & rs("UpdateName"), CurDir & rs("UpdateName")) Then
                  DoCmd.SetWarnings False
                  MsgBox "Upgrade successed,the system will restart now.", vbInformation
                  TEMPS = CurDir & rs("UpdateName")
                  Call CreateTSCut(TEMPS)
                  Shell CStr(SysCmd(acSysCmdAccessDir)) & "MSAccess.EXE """ & TEMPS & """", vbMaximizedFocus
                  DoCmd.Quit acQuitSaveNone
                Else  '---------------------Update failer
                  MsgBox "Upgrade failer,please ask for the soft engineer!", vbExclamation
                  DoCmd.Quit
                End If
      Case vbCancle:
                Me.Caption = " Please log in..."
                Me.Repaint
                UserDept.SetFocus
                rs.Close
                Set rs = Nothing
                Exit Sub
      End Select
  Else  '==========The same version does not need upgrading
    Me.UserDept.Enabled = True
    Me.UserPass.Enabled = True
    Me.TimerInterval = 0
  End If

  End If


四、其他更新模式:
 當前采用利用Winrar打包Access程式為EXE自解壓包,通過發送郵件給用戶進行更新,也非常方便。