设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
楼主: Roadbeg

[高2]系统托盘区功能.

[复制链接]

点击这里给我发消息

发表于 2003-4-9 21:13:00 | 显示全部楼层
给你目标你却不努力,儒子不可教也。
发表于 2003-4-9 21:42:00 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2003-4-9 21:49:00 | 显示全部楼层
托盘只需要加入这个模块就可以了!
Option Compare Database


'************** Code Start *************
'
'------------------------------
'  Do NOT try to step through
'  this code.  Entering debug mode
'  will cause a GPF if the window
'  is subclassed.
'------------------------------

'//LoadImage flags
Private Const WM_GETICON = &H7F  'message is sent to a window to retrieve a handle _
                                                            to the large or small icon associated with a window
Private Const WM_SETICON = &H80  'message to associate a new large or small icon with a window
Private Const IMAGE_BITMAP = 0      'Loads a bitmap.
Private Const IMAGE_ICON = 1         ' Loads an icon.
Private Const IMAGE_CURSOR = 2   'Loads a cursor.
Private Const LR_LOADFROMFILE = &H10      'Loads the image from the file specified by _
                                                                           the lpszName parameter. If this flag is not _
                                                                           specified, lpszName is the name of the resource.
Private Const ICON_SMALL = 0&    'Retrieve the small icon for the window.
Private Const ICON_BIG = 1&         'Retrieve the large icon for the window.

'loads an icon, cursor, or bitmap.
Private Declare Function apiLoadImage Lib "user32" _
   Alias "LoadImageA" _
   (ByVal hInst As Long, _
   ByVal lpszName As String, _
   ByVal uType As Long, _
   ByVal cxDesired As Long, _
   ByVal cyDesired As Long, _
   ByVal fuLoad As Long) _
   As Long

Private Declare Function apiSendMessageLong Lib "user32" _
   Alias "SendMessageA" _
   (ByVal hWnd As Long, _
   ByVal wMsg As Long, _
   ByVal wParam As Long, _
   ByVal lParam As Long) _
   As Long

'//SHGetFileInfo flags
Private Const SHGFI_ICON = &H100                          '// get icon
Private Const SHGFI_DISPLAYNAME = &H200            '// get display name
Private Const SHGFI_TYPENAME = &H400                  '// get type name
Private Const SHGFI_ATTRIBUTES = &H800               '// get attributes
Private Const SHGFI_ICONLOCATION = &H1000       '// get icon location
Private Const SHGFI_EXETYPE = &H2000                   '// return exe type
Private Const SHGFI_SYSICONINDEX = &H4000         '// get system icon index
Private Const SHGFI_LINKOVERLAY = &H8000           '// put a link overlay on icon
Private Const SHGFI_SELECTED = &H10000               '// show icon in selected state
Private Const SHGFI_ATTR_SPECIFIED = &H20000   '// get only specified attributes
Private Const SHGFI_LARGEICON = &H0                    '// get large icon
Private Const SHGFI_SMALLICON = &H1                    '// get small icon
Private Const SHGFI_OPENICON = &H2                     '// get open icon
Private Const SHGFI_SHELLICONSIZE = &H4             '// get shell size icon
Private Const SHGFI_PIDL = &H8                               '// pszPath is a pidl
Private Const SHGFI_USEFILEATTRIBUTES = &H10  '// use passed dwFileAttribute

Private Const FILE_ATTRIBUTE_NORMAL = &H80
Private Const MAX_PATH = 260

Private Type SHFILEINFO
   hIcon As Long                                      'Handle to the icon that represents the file.
   iIcon As Long                                        'Index of the icon image within the _
                                                                 system image list.
   dwAttributes As Long                            'Array of values that indicates the _
                                                                  attributes of the file object.
   szDisplayName As String * MAX_PATH  'String that contains the name of the _
                                                                  file as it appears in the Windows shell
   szTypeName As String * 80                   'String that describes the type of file.
End Type

'Retrieves information about an object in the file system,
'such as a file, a folder, a directory, or a drive root.
Private Declare Function apiSHGetFileInfo Lib "shell32.dll" _
   Alias "SHGetFileInfo
发表于 2003-4-9 22:58:00 | 显示全部楼层
to harsonliao : 我没做过,不过应该是用movesize了,movesize 完全能达到要求,而且简单
发表于 2003-4-9 23:04:00 | 显示全部楼层
to 吴天明 ,菜单用一个非模式的弹出窗体代替,只要把窗体的边匡,放大缩小按钮,记录浏览等等全部去掉就 ok了,里面要好看就加点图片进去,要做换肤都可以,如果喜欢,加一个异型函数进取,做个异型菜单出来也不是难事。

我把思路全说了,代码,本站的旧贴中全部都有。

不过我这样说得容易,codeing却要挺长时间,就看谁有这个耐心了,我是已经没兴趣了。

另外,有兴趣的去 www.access-web.com 或者 www.access911.com 这两个外国网站去看看,里面大多效果都有了,就看你是否有那个耐心了

如果wtm1得代码看不懂,可以去天极网找一片中文的,里面有详细说明。

[此贴子已经被作者于2003-4-9 15:08:56编辑过]

发表于 2003-4-9 23:14:00 | 显示全部楼层
还是不明白!一塌糊涂!给个例子看看!当程序成为系统托盘后,在系统托盘点击右键出现菜单,靠!!!我越想越晕!!帮帮吗??
 楼主| 发表于 2003-4-10 00:00:00 | 显示全部楼层
需要这些 api,感兴趣的网友把这些 api 的说明看了,应该就明白了.
sendmessage
setwindowlong
shell_notifyicon
callwindowproc


[此贴子已经被作者于2003-4-9 16:00:40编辑过]

发表于 2003-4-10 00:33:00 | 显示全部楼层
奥!不明白!

点击这里给我发消息

发表于 2003-4-10 03:27:00 | 显示全部楼层
确认点击点可使用
Public Declare Function apiGetCursorPos Lib "user32" _
  Alias "GetCursorPos" _
  (lpPoint As POINTAPI) _
  As Long

使用 CreatePopupMenu创建真正的菜单

点击这里给我发消息

发表于 2003-4-10 06:56:00 | 显示全部楼层
已经实现了真正的菜单功能,不过还需测试一下,只是不能参加比赛啦,没能有zhengjialon的好效果:)还是充作下一期胜出者奖品啦
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-18 08:31 , Processed in 0.089070 second(s), 32 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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