摘要:
MSDN的文章参考: 使用互斥对象 一开始没看懂是啥意思,后面研究之后发现, 重点在这段代码, while (dwCount < 20) { dwWaitResult = WaitForSingleObject( ghMutex, // handle to mutex INFINITE); // n 阅读全文
摘要:
仅适用于同一台电脑的两个进程聊天,对于不同电脑之前的聊天需要依靠tcp/ip协议。 两个进程是通过发送WM_COPYDATA 消息来传输字节的。 代码如下: Server.cpp #include <Windows.h> #include <stdio.h> #include <iostream> 阅读全文
摘要:
这个框框好像删不掉,就先放这边吧。。。 #define WIN32_LEAN_AND_MEAN #include <unknwn.h> #include <windows.h> #include <dwmapi.h> #include <gdiplus.h> #include <objidl.h> 阅读全文
摘要:
#include <tchar.h> #include <windows.h> #include <mmsystem.h> // for MCI functions // Link to winmm.lib (usually included in project settings) #pragma 阅读全文
摘要:
我们可以使用D3D为游戏,科学和桌面应用程序创建3-D图形。 非官方demo实例: https://github.com/Ray1024/D3D11Tutorial 当然,我们第一步要开始认识里面的基本api。 #include <d3d11.h> #include <chrono> using n 阅读全文
摘要:
从User32.dll中导出MessageBoxW 代码: #include <Windows.h> #include <iostream> #include <functional> typedef int(__stdcall *MsgBOX) ( HWND hWnd, LPCWSTR lpTex 阅读全文
摘要:
日常文件操作的时候,在删除或者移动某个文件的时候,发现它被某些进程占用了。 那么下面的代码就可以帮助我们找出这些进程的id和name。 原理: 将资源注册到Restart Manager会话。重新启动管理器使用在会话中注册的资源列表来确定必须关闭并重新启动哪些应用程序和服务。 代码: #includ 阅读全文
摘要:
仅供参考 文档: Rendering a Stream 代码示例: #include <cstdio> #include <Windows.h> // Windows multimedia device #include <Mmdeviceapi.h> #include <Functiondisco 阅读全文
摘要:
需要首先获取特定用户的SID。 这是一些步骤, 验证输入参数。 为可能足够大的SID和域名创建缓冲区。 在循环中,调用LookupAccountName以检索提供的帐户名的SID。如果SID的缓冲区或域名的缓冲区不够大,则分别在cbSid或中返回所需的缓冲区大小cchDomainName,并在下一次 阅读全文
摘要:
检查当前句柄是否有指定的权限。 #include <iostream> #include <windows.h> #include <tchar.h> //#pragma comment(lib, "cmcfg32.lib") HANDLE hProcess; BOOL CheckWindowsPr 阅读全文