windowsSDK
来源:互联网 发布:数车工艺品图纸及编程 编辑:程序博客网 时间:2024/05/16 09:04
File operation
CreateFileReadFile WriteFile CloseHandle PathFileExists CreateDirectorySHGetSpecialFolderPath
//example
HANDLE hFile;
HANDLE hAppend;
DWORD dwBytesRead, dwBytesWritten, dwPos;
BYTE buff[4096];
// Open the existing file.
hFile = CreateFile(TEXT("one.txt"), // open One.txt
GENERIC_READ, // open for reading
0, // do not share
NULL, // no security
OPEN_EXISTING, // existing file only
FILE_ATTRIBUTE_NORMAL, // normal file
NULL); // no attr. template
if (hFile == INVALID_HANDLE_VALUE)
{
printf("Could not open One.txt.");
return;
}
// Open the existing file, or if the file does not exist,
// create a new file.
hAppend = CreateFile(TEXT("two.txt"), // open Two.txt
GENERIC_WRITE, // open for writing
FILE_SHARE_READ, // allow multiple readers
NULL, // no security
OPEN_ALWAYS, // open or create
FILE_ATTRIBUTE_NORMAL, // normal file
NULL); // no attr. template
if (hAppend == INVALID_HANDLE_VALUE)
{
printf("Could not open Two.txt.");
return;
}
// Append the first file to the end of the second file.
// Lock the second file to prevent another process from
// accessing it while writing to it. Unlock the
// file when writing is finished.
do
{
if (ReadFile(hFile, buff, sizeof(buff), &dwBytesRead, NULL))
{
dwPos = SetFilePointer(hAppend, 0, NULL, FILE_END);
LockFile(hAppend, dwPos, 0, dwBytesRead, 0);
WriteFile(hAppend, buff, dwBytesRead, &dwBytesWritten, NULL);
UnlockFile(hAppend, dwPos, 0, dwBytesRead, 0);
}
} while (dwBytesRead == sizeof(buff));
// Close both files.
CloseHandle(hFile);
CloseHandle(hAppend);
Thread Operation
CreateThread GetExitCodeThread Exithread TerminateThread CloseHandle SuspendThreadResumeThread
- Thread Synchronize realize
Mutex: CreateMutex CreateEvent ReleaseMutex OpenMutex
CriticalSection: InitializeCriticalSection EnterCriticalSection LeaveCriticalSection DeleteCriticalSection
- windowsSDK
- WindowsSDK 之 Window Classes
- WindowsSDK 之 消息循环
- WindowsSDK 之 Main..........
- windowsSDK 菜单资源浅谈
- windowsSDK贪吃蛇
- windowsSDK移位加密算法实现
- WindowsSDK编程学习日记(1)
- WindowsSDK编程学习日记(2)
- WindowsSDK编程学习日记(3)
- [转载]C#中使用WindowsSDK
- windowsSDK加速键实例分析
- 基于WindowsSDK检测游戏手柄
- WindowsSDK实现3D字体特效
- windowsSDK利用子窗口控件设置窗口透明
- windowsSDK实现 屏幕实时监控 热键截图 功能
- 在一个程序集中获取一个类的所有子类
- Replace函数
- JQuery UI之(二)对话框——dialog
- 2009-12-13 Sun
- OD常用断点表
- windowsSDK
- 经验小结
- 似曾相识: 几个月的纪念日
- 嵌入式系统学习步骤
- 各种C++库
- directx 摄像头控制
- 设计模式-------建造者
- 文件系统执行过程【草稿】
- seasar2的多文件上传