如何把程序嵌入桌面

无影追风 2004-07-26 12:12:12
我发现有的软件在WIN2000/XP下能把界面嵌入桌面,即使是图标都能盖过它,这个怎么实现呢?
...全文
368 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
无影追风 2004-07-27
  • 打赏
  • 举报
回复
看到你们的回复,虽然我看不懂代码,不过还是结贴吧,以后再慢馒研究代码。
shashou47 2004-07-27
  • 打赏
  • 举报
回复
看不懂啊!!!!!!!!!!!!!!
无影追风 2004-07-27
  • 打赏
  • 举报
回复
呵呵,原来这么复杂啊
zyl910 2004-07-27
  • 打赏
  • 举报
回复
CustomDraw是MicroSoft专门为通用控件提供的自定义绘制的功能

以前对于Windows基本控件提供的是OwnerDraw
OwnerDraw是对整个项目进行自绘的,不太灵活(比如我只需要改背景图片)


MSDN:


Custom Draw


Custom draw is not a common control; it is a service that many common controls provide. Custom draw services allow an application greater flexibility in customizing a control's appearance. Your application can harness custom draw notifications to easily change the font used to display items or manually draw an item without having to do a full-blown owner draw.

About Custom Draw


Using Custom Draw


Custom Draw Reference


About Custom Draw
This section contains general information about custom draw functionality and provides a conceptual overview of how an application can support custom draw.

Currently, the following controls support custom draw functionality:

Header controls
List view controls
Rebar controls
Toolbar controls
Tooltip controls
Trackbar controls
Tree view controls
Note Custom draw is implemented in version 4.70 and later of Comctl32.dll.

About Custom Draw Notification Messages
All common controls that support custom draw send NM_CUSTOMDRAW notification messages at specific points during drawing operations. These notifications describe drawing operations that apply to the entire control as well as drawing operations specific to items within the control. Like many notification messages, NM_CUSTOMDRAW notifications are sent as WM_NOTIFY messages.

The lParam parameter of a custom draw notification message will be the address of an NMCUSTOMDRAW structure or a control-specific structure that contains an NMCUSTOMDRAW structure as its first member. The following table illustrates the relationship between the controls and the structures they use. Structure Used by
NMCUSTOMDRAW Rebar, trackbar, and header controls
NMLVCUSTOMDRAW List view controls
NMTBCUSTOMDRAW Toolbar controls
NMTTCUSTOMDRAW Tooltip controls
NMTVCUSTOMDRAW Tree view controls


Paint Cycles, Drawing Stages, and Notification Messages
Like all Microsoft® Windows® applications, common controls periodically paint and erase themselves based on messages received from the system or other applications. The process of a control painting or erasing itself is called a paint cycle. Controls that support custom draw send NM_CUSTOMDRAW notification messages periodically through each paint cycle. This notification message is accompanied by an NMCUSTOMDRAW structure or another structure that contains an NMCUSTOMDRAW structure as its first member.

One piece of information that the NMCUSTOMDRAW structure contains is the current stage of the paint cycle. This is referred to as the draw stage and is represented by the value in the structure's dwDrawStage member. A control informs its parent about four basic draw stages. These basic, or global, draw stages are represented in the structure by the following flag values (defined in Commctrl.h). Global draw stage values
CDDS_PREPAINT Before the paint cycle begins.
CDDS_POSTPAINT After the paint cycle is complete.
CDDS_PREERASE Before the erase cycle begins.
CDDS_POSTERASE After the erase cycle is complete.


Each of the preceding values can be combined with the CDDS_ITEM flag to specify draw stages specific to items. For convenience, Commctrl.h contains the following item-specific values. Item-specific draw stage values
CDDS_ITEMPREPAINT Before an item is drawn.
CDDS_ITEMPOSTPAINT After an item has been drawn.
CDDS_ITEMPREERASE Before an item is erased.
CDDS_ITEMPOSTERASE After an item has been erased.


Your application must process the NM_CUSTOMDRAW notification message and then return a specific value that informs the control what it must do. See the following sections for more information about these return values.

Taking Advantage of Custom Draw Services
The key to harnessing custom draw functionality is in responding to the NM_CUSTOMDRAW notification messages that a control sends. The return values your application sends in response to these notifications determine the control's behavior for that paint cycle.

This section contains information about how your application can use NM_CUSTOMDRAW notification return values to determine the control's behavior. Details are broken into the following topics:

Responding to the prepaint notification
Requesting item-specific notifications
Drawing the item yourself
Changing fonts and colors
Responding to the prepaint notification
At the beginning of each paint cycle, the control sends the NM_CUSTOMDRAW notification message, specifying the CDDS_PREPAINT value in the dwDrawStage member of the accompanying NMCUSTOMDRAW structure. The value that your application returns to this first notification dictates how and when the control sends subsequent custom draw notifications for the rest of that paint cycle. Your application can return a combination of the following flags in response to the first notification. Return value Effect
CDRF_DODEFAULT The control will draw itself. It will not send additional NM_CUSTOMDRAW notifications for this paint cycle. This flag cannot be used with any other flag.
CDRF_NOTIFYITEMDRAW The control will notify the parent of any item-specific drawing operations. It will send NM_CUSTOMDRAW notification messages before and after it draws items.
CDRF_NOTIFYPOSTPAINT The control will send an NM_CUSTOMDRAW notification when the painting cycle for the entire control is complete.
CDRF_SKIPDEFAULT The control will not perform any painting at all.


Requesting item-specific notifications
If your application returns CDRF_NOTIFYITEMDRAW to the initial prepaint custom draw notification, the control will send notifications for each item it draws during that paint cycle. These item-specific notifications will have the CDDS_ITEMPREPAINT value in the dwDrawStage member of the accompanying NMCUSTOMDRAW structure. You can request that the control send another notification when it is finished drawing the item by returning CDRF_NOTIFYPOSTPAINT to these item-specific notifications. Otherwise, return CDRF_DODEFAULT and the control will not notify the parent window until it starts to draw the next item.

Drawing the item yourself
If your application draws the entire item, return CDRF_SKIPDEFAULT. This allows the control to skip items that it does not need to draw, thereby decreasing system overhead. Keep in mind that returning this value means the control will not draw any portion of the item.

online 2004-07-26
  • 打赏
  • 举报
回复
Option Explicit

Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Const WS_EX_TRANSPARENT As Long = &H20&
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Sub Form_Load()

Dim Ret As Long
Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED Or WS_EX_TRANSPARENT
SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
'Set the opacity of the layered window to 200
SetLayeredWindowAttributes Me.hWnd, 0, 200, LWA_ALPHA
End Sub
boyzhang 2004-07-26
  • 打赏
  • 举报
回复
汗! -_-~~~~ CustomDraw? 第一次听说.... 哎!寒!
蒋晟 2004-07-26
  • 打赏
  • 举报
回复
http://www.vckbase.com/vckbase/vckbase10/vc/nonctrls/atlcomocx_02/1002001.htm
zyl910 2004-07-26
  • 打赏
  • 举报
回复
即使是图标都能盖过它

==========================

只能用CustomDraw桌面ListView的方法
牵涉到两种高难度技术
1.跨进程子类
2.CustomDraw


具体代码可参考陈宽达的《Delphi深度历险》
dongge2000 2004-07-26
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/3071/3071477.xml?temp=.982464
yinweihong 2004-07-26
  • 打赏
  • 举报
回复
楼主可能是想实现类似金山影霸2003的桌面播放吧~
无影追风 2004-07-26
  • 打赏
  • 举报
回复
超级绿豆你怎么实现的。
supergreenbean 2004-07-26
  • 打赏
  • 举报
回复
你写个ActiveX Document,然后把他设为Active Desktop看看 ?
无影追风 2004-07-26
  • 打赏
  • 举报
回复
就是说,我拖一个桌面图标过去,不能盖在界面上。
online 2004-07-26
  • 打赏
  • 举报
回复
你试一下,可以啊

但是还是不能被图标覆盖???
解释一下
无影追风 2004-07-26
  • 打赏
  • 举报
回复
这个代码我知道啊,但是还是不能被图标覆盖。

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧