| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3211 人关注过本帖
标题:[原创]和大家一起分享桌面宠物程序所用到的API(VB)
只看楼主 加入收藏
china25qd
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2007-9-6
收藏
 问题点数:0 回复次数:6 
[原创]和大家一起分享桌面宠物程序所用到的API(VB)
*/ --------------------------------------------------------------------------------------
*/ 出自: 编程中国 http://www.bc-cn.net
*/ 作者: china25qd
*/ 时间: 2007-10-3 编程论坛首发
*/ 声明: 尊重作者劳动,转载请保留本段文字
*/ --------------------------------------------------------------------------------------


我这个是VB版的,希望高手多提宝贵意见谢谢!
1.
'设置窗体形状声明
'------------------------
'自定义
Public Type Dat
'设计坐标
sx As Integer '存储扫描头次遇到非背景色的X坐标
ex As Integer '存储扫描非背景色结束的X坐标
sy As Integer 'Y坐标的开始
ey As Integer 'Y坐标的结束
End Type
'------------------------
'目的:得到指定像素点
'输入:X坐标
' Y坐标
'返回:点的像素
Public Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
'------------------------
'目标:创建一个矩形区域
'输入:X1:指定左上角的X坐标
' Y1:指定左上角的Y坐标
' X2:指定右下角的X坐标
' Y2:指定右下角的Y坐标
'返回:矩形区域的句柄
Public Declare Function CreateRectRgn Lib "gdi32" Alias "CreateRectRgn" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
'------------------------
'目的:合并两个区域存储到目标区域中
'输入:hDestRgn:目标区域的句柄
' hSrcRgn1:源区域1的句柄
' hSrcRgn2:源区域2的句柄
' nCombineMode:合并方式
Public Declare Function CombineRgn Lib "gdi32" Alias "CombineRgn" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
'------------------------
'目标:根据指定的显示区域改变窗口的形状
'输入:hWnd:窗口句柄
' hRgn:指定显示区域
' bRedraw:是否立即重画窗口
Public Declare Function SetWindowRgn Lib "user32" Alias "SetWindowRgn" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
'------------------------
'CombineRgn 函数的nCombineMode参数常量:
Public Const RGN_AND = 1
Public Const RGN_COPY = 5
Public Const RGN_DIFF = 4
Public Const RGN_OR = 2
Public Const RGN_XOR = 3
'------------------------
'目的:删除指定区域
'输入:hWnd:窗口句柄
' hObject:区域句柄
Public Declare Function DeleteObject Lib "gdi32" Alias "DeleteObject" (ByVal hObject As Long) As Long

2.
'设置窗口是否总在最前的API函数和常数
Public Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
'----------------------
Public Const SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_NOCOPYBITS = &H100
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOOWNERZORDER = &H200 ' Don't do owner Z ordering
Public Const SWP_NOREDRAW = &H8
Public Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOZORDER = &H4
Public Const SWP_DRAWFRAME = SWP_FRAMECHANGED
'----------------------
Public Const HWND_BOTTOM = 1
Public Const HWND_NOTOPMOST = -2
Public Const HWND_TOPMOST = -1
Public Const HWND_DESKTOP = 0
Public Const HWND_TOP = 0
Public Const HWND_BROADCAST = &HFFFF&
Public Const SWP_HIDEWINDOW = &H80
Public Const SWP_SHOWWINDOW = &H40
'----------------------
public Const Flags = SWP_DRAWFRAME Or SWP_NOMOVE Or SWP_NOSIZE

3.
'为鼠标拖动窗体声明的API函数和常数:
Public Const WM_SYSCOMMAND = &H112
Public Const SC_MOVE = &HF010&
Public Const HTCAPTION = 2
'-----------------------
Public Declare Function ReleaseCapture Lib "user32" Alias "ReleaseCapture" () As Long
'-----------------------
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long


如果QQ和MSN也是用VB写的话,那么它们也会用到这些API

[此贴子已经被作者于2007-10-3 20:58:21编辑过]

搜索更多相关主题的帖子: 宠物 API 分享 
2007-10-03 11:34
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2007-10-03 11:51
woshicy
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2007-4-19
收藏
得分:0 
比较强哈!
2007-10-03 16:13
lu_wei
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2007-9-3
收藏
得分:0 
好像是好东西
2007-10-03 17:24
china25qd
Rank: 1
等 级:新手上路
帖 子:161
专家分:0
注 册:2007-9-6
收藏
得分:0 

恩,还是有人看的啊!


抱膝怀天下 闲坐观四海
2007-10-03 21:01
paome
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2008-6-13
收藏
得分:0 
顶一下
2008-06-13 23:55
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
N早以前好像研究过类似的,不过那个程序代码估计不太好找了,连我自己都忘了存在硬盘的那个文件夹了
2008-06-15 23:52
快速回复:[原创]和大家一起分享桌面宠物程序所用到的API(VB)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.043069 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved