win32常用函数-1

原创 2012年03月22日 21:23:54

InitializeCriticalSection

The InitializeCriticalSection function initializes a critical section object.

 

VOID InitializeCriticalSection(

 

    LPCRITICAL_SECTION lpCriticalSection          // address of critical section object 

   );        

Parameters

lpCriticalSection

Points to the critical section object.

Return Values

This function does not return a value.

Remarks

The threads of a single process can use a critical section object for mutual-exclusion synchronization. The process is responsible for allocating the memory used by a critical section object, which it can do by declaring a variable of type CRITICAL_SECTION. Before using a critical section, some thread of the process must call the InitializeCriticalSection function to initialize the object.

Once a critical section object has been initialized, the threads of the process can specify the object in the EnterCriticalSection, TryEnterCriticalSection, or LeaveCriticalSection function to provide mutually exclusive access to a shared resource. For similar synchronization between the threads of different processes, use a mutex object.

 

A critical section object cannot be moved or copied. The process must also not modify the object, but must treat it as logically opaque. Use only the functions provided in the Win32 application programming interface (API) to manage critical section objects.

DeleteCriticalSection

The DeleteCriticalSection function releases all resources used by an unowned critical section object.

VOID DeleteCriticalSection(

 

    LPCRITICAL_SECTION lpCriticalSection          // pointer to critical section object 

   );        

 

Parameters

lpCriticalSection

Points to the critical section object.

Return Values

This function does not return a value.

Remarks

Deleting a critical section object releases all system resources used by the object. Once deleted, the critical section object cannot be specified in the EnterCriticalSection, TryEnterCriticalSection, or LeaveCriticalSection function.

GetLocalTime 

The GetLocalTime function retrieves the current local date and time.

 

VOID GetLocalTime(

 

    LPSYSTEMTIME lpSystemTime       // address of system time structure 

   );        

Parameters

lpSystemTime

Points to a SYSTEMTIME structure to receive the current local date and time.

Return Values

This function does not return a value.

FreeAndNil

Frees an object reference and replaces the reference with Nil.

procedure FreeAndNil(var Obj);

Parameters

var Obj

Object reference to be freed and Nil'd.

Description

FreeAndNil is a procedure used to free the object reference specified by Obj, and sets the object reference to the Nil value.

Use FreeAndNil to ensure that a variable is Nil after you free the object it references. Pass any variable that represents an object as the Obj parameter.

Note:  Do not pass a value for Obj if it is not an instance of TObject or a TObject descendant.

FreeAndNil is a convenience procedure provided for Delphi or C++ Builder products using a VCL version prior to VCL 5

相关文章推荐

win32 api常用函数

  • 2009年09月28日 03:56
  • 813KB
  • 下载

Win32 SDK基础(9)—— Windows 常用消息大全

一、Windows消息分布 消息范围 说 明 0 ~ WM_USER – 1 系统消息 WM_USER ~ 0x7FFF 自定义窗口类整数消息...

Win32 汇编: 常用寄存器的常规功能

通用寄存器 EAX 累加(Accumulator)寄存器 AX(AH、AL) 常用于乘、除法和函数返回值 EBX 基址(Base)寄存器 BX(BH、BL) 常做内存数据的指针 ECX 计数器(...

[win32] GDI绘图常用的三种坐标系

GDI绘图常用的三种坐标系:  屏幕坐标系 ,  窗口坐标系  和  客户区坐标系 1. 屏幕坐标系:    坐标原点在屏幕左上角, 自左向右x坐标增大 , 自上向下y坐标增大.  通过 GetWin...

Win32学习笔记 - Windows 常用消息大全

表A-1  Windows消息分布 消息范围 说 明 0 ~ WM_USER – 1 系统消息 WM_...

Windows程序设计(1)——Win32运行原理(三)

进程控制 1 获得系统进程 4 进程控制 4.1 获得系统进程 使用toolhelp模块可以实现获取系统中当前运行当中的进程列表。 思路如下,使用CreateToolhelp3...

1.Win32基本程序概念(深入浅出MFC之读书笔记)

Windows程序分为“程序代码”和“UI资源”两大部分,两部分最后以RC编译器整合为一个完整的的exe档案,如图所示。 Windows程序调用的函数可分为C Runtimes以及Windows A...

[Win32] SCManager 服务控制管理器API(1)

1。OpenSCManager 打开服务控制管理器 函数原型: SC_HANDLE WINAPI OpenSCManager( _In_opt_ LPCTSTR lpMachineName, ...

win32汇编入门了解(1)环境搭建

说明:本系列内容不会详细讲解汇编的知识,只是记录我自己学习的一个过程,而且,我学习的目标不是打算写汇编,而是了解一点点win32汇编的知识,只是为了让自己能读懂最基本的汇编。另外,win32汇编的核心...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:win32常用函数-1
举报原因:
原因补充:

(最多只允许输入30个字)