Win32 API

来源:互联网 发布:怎么激活电脑windows 编辑:程序博客网 时间:2024/04/30 15:37
ScrollDC
  函数功能:该函数水平和垂直滚动一个位矩形。
  函数原型:BOOL ScrollDC(HDC hDC,int dx,int dy,CONST RECT ·IprcScroll,CONST★lprcClip,HRGN hrgnUpdateLPRECT IprcUpdate);
  参数:
  hDC:含有要滚动位数的设备描述表句柄。
  dx:在设备单元中,指定水平滚动数量。在向左滚动时此参数必须为负。
  dy:在设备单元中,指定垂直滚动数量。在向上滚动时此参数必须为负。
  lprcScroll:指向包含与滚动矩形的同等之物的RECT结构。
  lprcClip:指向包含类似于剪下矩形之物的RECT结构。只有在剪辑矩形内部的图案才受影响。
  hrgnUpdate:处理滚动过程中位覆盖的区域。ScrollDC定义这个区域,它不一定是一个矩形。
  lprcUpdate:指向RECT结构,它接收到类似于被限制滚动更新区域矩形之物。这是所需求重画的最大的矩形区域。当函数返回时,不管指定设备内容映射的模式如何,结构中的值将在客户端对应结构中。
  返回值:如果函数运行成功,返回值为非零;如果函数运行失败,返回值为零。若想获得更多的错误信息,请调用GetLastError函数。
  注意:如果参数lprcUpdate为空,系统将不再计算更新矩形。如果参数hrgnUpdate和IprcUpdate均为空,系统将不再计算更新区域。如果参数hrgnUpdate不为空,系统将好像拥有包含一个有效的未被滚动过程覆盖区域旬柄(由ScrollDC定义滚动过程)。当必须滚动窗体的整个客户区域,使用ScrollWindowEx函数。
  Windows CE:参数dx和dy中只有一个可以为非零。
  速查:Windows NT 3.1、Windows 95、windows CE1.0对以上,头文件:winuser.h;库文件:user32.lib。


GetLogicalDrives
  VB声明
  Declare Function GetLogicalDrives Lib "kernel32" Alias "GetLogicalDrives" () As Long
  说明
  判断系统中存在哪些逻辑驱动器字母
  返回值
  Long,这个结构中的二进制位标志着存在哪些驱动器。其中,位0设为1表示驱动器A:存在于系统中;位1设为1表示存在B:驱动器;以次类推


GetLogicalDriveStrings
  VB声明
  Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
  说明
  获取一个字串,其中包含了当前所有逻辑驱动器的根驱动器路径
  返回值
  Long,装载到lpBuffer的字符数量(排除空中止字符)。如缓冲区的长度不够,不能容下路径,则返回值就变成要求的缓冲区大小。零表示失败。会设置GetLastError
  参数表
  参数 类型及说明
  nBufferLength Long,lpBuffer字串的长度
  lpBuffer String,用于装载逻辑驱动器名称的字串。每个名字都用一个NULL字符分隔,在最后一个名字后面用两个NULL表示中止(空中止)  


InterlockedExchange
VB声明
Declare Function InterlockedExchange Lib "kernel32" Alias "InterlockedExchange" (Target As Long, ByVal Value As Long) As Long
说明
设置一个长整数变量的值
返回值
Long,变量的前一个值
参数表
参数 类型及说明
Target Long,要设置的变量
Value Long,变量的新值
注解
这个函数执行的操作可以安全地避开同步问题——即使是一个共享变量


InterlockedIncrement
VB声明
Declare Function InterlockedIncrement Lib "kernel32" Alias "InterlockedIncrement" (lpAddend As Long) As Long
说明
递增一个长整数变量的值
返回值 Long,变量的上一个值
参数表
参数 类型及说明
lpAddend Long,要递增的长整数变量
注解
这个函数执行的递增操作可以安全地避开同步问题——即使是一个共享变量


InterlockedDecrement
VB声明
Declare Function InterlockedDecrement Lib "kernel32" Alias "InterlockedDecrement" (lpAddend As Long) As Long
说明
递减一个长整数变量的值
返回值 Long,变量的上一个值
参数表
参数 类型及说明
lpAddend Long,要递减的一个长整数变量
注解
这个函数执行的递减操作可以安全地避开同步问题——即使是一个共享变量


GetUserName
别名:GetUserNameA
库名:advapi32.dll
声明:Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
说明:取得当前用户的名字
返回值:
Long,TRUE(非零)表示成功,否则返回零。会设置GetLastError
参数表
lpBuffer ------- String,一个字串缓冲区,预先初始化成由nSize指定的长度。它将用于容纳用户名
nSize ---------- Long,初始化成lpBuffer的长度。返回以后,它会包含载入lpBuffer的字符数量


ProcessorFeature
    [in] Processor feature to be tested. This parameter can be one of the following values.
PF_3DNOW_INSTRUCTIONS_AVAILABLE(7)
The 3D-Now instruction set is available.
Windows NT 4.0: This value is not supported.
PF_COMPARE_EXCHANGE_DOUBLE(2)
The compare and exchange double operation is available (Pentium, MIPS, and Alpha).
PF_FLOATING_POINT_EMULATED(1)
Floating-point operations are emulated using a software emulator.
This function returns a nonzero value if floating-point operations are emulated; otherwise, it returns zero.
Windows NT 4.0: This function returns zero if floating-point operations are emulated; otherwise, it returns a nonzero value. This behavior is a bug that is fixed in later versions.
PF_FLOATING_POINT_PRECISION_ERRATA(0)
On a Pentium, a floating-point precision error can occur in rare circumstances.
PF_MMX_INSTRUCTIONS_AVAILABLE(3)
The MMX instruction set is available.
PF_NX_ENABLED(12)
Data execution prevention is enabled.
Windows Server 2003 and Windows XP: This value is not supported until Windows Server 2003 SP1 and Windows XP SP2.
PF_PAE_ENABLED(9)
The processor is PAE-enabled. For more information, see Physical Address Extension.
Windows NT 4.0: This value is not supported.
PF_RDTSC_INSTRUCTION_AVAILABLE(8)
The RDTSC instruction is available.
Windows NT 4.0: This value is not supported.
PF_XMMI_INSTRUCTIONS_AVAILABLE(6)
The SSE instruction set is available.
Windows NT 4.0: This value is not supported.
PF_XMMI64_INSTRUCTIONS_AVAILABLE(10)
The SSE2 instruction set is available.
Windows 2000 and Windows NT 4.0: This value is not supported.
返回值
  If the feature is supported, the return value is a nonzero value.
If the feature is not supported, the return value is zero.
If the HAL does not support detection of the feature, whether or not the hardware supports the feature, the return value is also zero.
说明
  None.
系统要求
  Client: Requires Windows XP, Windows 2000 Professional, or Windows NT Workstation 4.0.
Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.
Header: Declared in Winbase.h; include Windows.h.
Library: Link to Kernel32.lib.
DLL: Requires Kernel32.dll.


SendNotifyMessage  
函数功能:该函数将指定的消息发送到一个窗口。如果该窗口是由调用线程创建的;此函数为该窗口调用窗口程序,并等待窗口程序处理完消息后再返回。如果该窗口是由不同的线程创建的,此函数将消息传给该窗口程序,并立即返回,不等待窗口程序处理完消息。
  函数原型:BOOL SendNotifyMessage(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM IParam);
  参数:
  hWnd:其窗口程序将接收消息的窗口的句柄。如果此参数为HWND_BROADCAST,则消息将被发送到系统中所有顶层窗口,包括无效或不可见的非自身拥有的窗口、被覆盖的窗口和弹出式窗口,但消息不被发送到子窗口。
  Msg:指定被发送的消息。
  wParam:指定附加的消息指定信息。
  IParam:指定附加的消息指定信息。
  返回值:如果函数调用成功,返回非零值;如果函数调用失败,返回值是零。若想获得更多的错误信息,请调用GetLastError函数。
  备注:如果发送一个低于WM_USER范围的消息给异步消息函数(PostMessage,SendNotifyMessage,SendMesssgeCallback),消息参数不能包含指针。否则,操作将会失败。函数将在接收线程处理消息之前返回,发送者将在内存被使用之前释放。
  需要以HWND_BROADCAST方式通信的应用程序应当用函数RegisterWindwosMessage来获得应用程序间通信的独特的消息。
  速查:Windows NT:3.1及以上版本;Windows:95及以上版本;Windows CE:1.0及以上版本;头文件:winuser.h;输入库:user32.lib;Unicode:在Windows NT环境下以Uncode和ANSI方式实现。


InsendMessage  
函数功能:该函数决定当前窗口程序是否处理另一个线程调用SendMesssge(在相同进程或不同进程)发送来的消息。
  函数原型:BOOL InsendMessage(VOID);
  参数:无。
  返回值:如果窗口程序处理另一个线程调用SendMessage发送来的消息,返回非零值。如果窗口程序不处理另一个线程调用SendMessage发送来的消息,返回值是零。
  速查:Windows NT:3.1及以上版本:Windows:95及以上版本;Windows CE:不支持;头文件:winuser.h输入库:user32.Iib。  


Function Name TlsAlloc
Library "kernel32"
Funtion or Sub Function
Declare Declare Function TlsAlloc Lib "kernel32" Alias "TlsAlloc" () As Long
Search on Google TlsAlloc
Search Microsoft TlsAlloc

Function Name TlsSetValue
Library "kernel32"
Funtion or Sub Function
Declare Declare Function TlsSetValue Lib "kernel32" Alias "TlsSetValue" (ByVal dwTlsIndex As Long, lpTlsValue As Any) As Long
Search on Google TlsSetValue
Search Microsoft TlsSetValue

Function Name TlsGetValue
Library "kernel32"
Funtion or Sub Function
Declare Declare Function TlsGetValue Lib "kernel32" Alias "TlsGetValue" (ByVal dwTlsIndex As Long) As Long
Search on Google TlsGetValue
Search Microsoft TlsGetValue

Function Name TlsFree
Library "kernel32"
Funtion or Sub Function
Declare Declare Function TlsFree Lib "kernel32" Alias "TlsFree" (ByVal dwTlsIndex As Long) As Long
Search on Google TlsFree
Search Microsoft TlsFree
原创粉丝点击