| 网站首页 | 技术文章 | 下载频道 | 博客 | 编程论坛 |
 
| 技术教程首页 | 开发语言 | WEB开发 | .NET技术 | 数据库 | 操作系统 | 网页制作 |
 
 
您现在的位置: 编程中国 >> 技术教程 >> 开发语言 >> VB >> 编程技巧 >> 正文
  ►  和大家一起分享桌面宠物程序所用到的API(VB)
和大家一起分享桌面宠物程序所用到的API(VB)
作者:shiweifu    阅读人次:……    文章来源:本站原创    发布时间:2007/10/8    网友评论()条
 

原帖及讨论:http://bbs.bccn.net/thread-174774-1-1.html

*/ --------------------------------------------------------------------------------------
*/ 出自: 编程中国  http://www.bccn.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

 

 
文章录入:编辑01    责任编辑:编辑01 
  • 上一篇文章:

  • 下一篇文章:

  •  
    相关文章
    原创地带
    24小时热门帖子