设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1672|回复: 0
打印 上一主题 下一主题

[分享]FoxMail的内置Word模板源程序

[复制链接]
跳转到指定楼层
1#
发表于 2005-3-14 04:01:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
安装FoxMail后,会在Word里新增加一个工具栏(红色的图标),以方便用户用FoxMail收发邮件。卸载FoxMail后,但其工具栏仍然存在,非常讨厌,于是想法把其弄掉,没想无意中打开其源码,贴在此供有需要的各位分享,以下是其源程序:

Public Const SW_NORMAL = 1

Public Const SW_MINIMIZE = 6

Public Const HKEY_CURRENT_USER = &H80000001

Public Const KEY_QUERY_VALUE = &H1

Public Const REG_SZ = 1                         ' Unicode nul terminated string

Public Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long

Public 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         ' Note that if you declare the lpData parameter as String, you must pass it By Value.

Public Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub Foxmail()

'

    On Error Resume Next

'HKEY_CURRENT_USER\Software\Aerofox\FoxMail\V3.1

'FoxMailPath

    Dim hKey As Long

    Dim tmpStr As String * 255

    Dim PathLen As Long

   

    If RegOpenKeyEx(HKEY_CURRENT_USER, "Software\Aerofox\FoxMail\V3.1", 0, KEY_QUERY_VALUE, hKey) <> 0 Then

      Exit Sub

    End If

    PathLen = Len(tmpStr)

    If RegQueryValueEx(hKey, "FoxmailPath", 0, REG_SZ, ByVal tmpStr, PathLen) <> 0 Then

      Exit Sub

      RegCloseKey hKey

    End If

    RegCloseKey hKey

    FoxmailPath = Trim(Left(tmpStr, PathLen))

    ActiveDocument.Save

    If (ActiveDocument.Path <> "") And (ActiveDocument.FullName <> "") Then

      ShellExecute 0, "Open", FoxmailPath, """" & ActiveDocument.FullName & """", "", SW_NORMAL

    End If

End Sub

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-11-14 14:50 , Processed in 0.070805 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表