12 2020 档案

摘要:我们可以使用D3D为游戏,科学和桌面应用程序创建3-D图形。 非官方demo实例: https://github.com/Ray1024/D3D11Tutorial 当然,我们第一步要开始认识里面的基本api。 #include <d3d11.h> #include <chrono> using n 阅读全文
posted @ 2020-12-31 15:16 strive-sun 阅读(824) 评论(0) 推荐(0)
摘要:从User32.dll中导出MessageBoxW 代码: #include <Windows.h> #include <iostream> #include <functional> typedef int(__stdcall *MsgBOX) ( HWND hWnd, LPCWSTR lpTex 阅读全文
posted @ 2020-12-28 17:48 strive-sun 阅读(305) 评论(0) 推荐(0)
摘要:日常文件操作的时候,在删除或者移动某个文件的时候,发现它被某些进程占用了。 那么下面的代码就可以帮助我们找出这些进程的id和name。 原理: 将资源注册到Restart Manager会话。重新启动管理器使用在会话中注册的资源列表来确定必须关闭并重新启动哪些应用程序和服务。 代码: #includ 阅读全文
posted @ 2020-12-28 17:30 strive-sun 阅读(456) 评论(0) 推荐(0)
摘要:仅供参考 文档: Rendering a Stream 代码示例: #include <cstdio> #include <Windows.h> // Windows multimedia device #include <Mmdeviceapi.h> #include <Functiondisco 阅读全文
posted @ 2020-12-23 15:08 strive-sun 阅读(210) 评论(0) 推荐(0)
摘要:需要首先获取特定用户的SID。 这是一些步骤, 验证输入参数。 为可能足够大的SID和域名创建缓冲区。 在循环中,调用LookupAccountName以检索提供的帐户名的SID。如果SID的缓冲区或域名的缓冲区不够大,则分别在cbSid或中返回所需的缓冲区大小cchDomainName,并在下一次 阅读全文
posted @ 2020-12-22 14:52 strive-sun 阅读(814) 评论(0) 推荐(0)
摘要:检查当前句柄是否有指定的权限。 #include <iostream> #include <windows.h> #include <tchar.h> //#pragma comment(lib, "cmcfg32.lib") HANDLE hProcess; BOOL CheckWindowsPr 阅读全文
posted @ 2020-12-21 15:26 strive-sun 阅读(254) 评论(0) 推荐(0)
摘要:因为是学习篇,写下是为了个人的学习与理解。故参考其他文章为多。 为什么会有死锁? 想象一下这样的情况,thread A 在run的时候需要等待thread B的结果,也就是threadprocA中添加tB.join(), 在thread B的threadProcB中添加tA.join()。结果就是线 阅读全文
posted @ 2020-12-17 15:06 strive-sun 阅读(307) 评论(0) 推荐(0)
摘要:因为是学习篇,写下是为了个人的学习与理解。故参考其他文章为多。 为什么需要线程同步? 在程序中使用多线程时,一般很少有多个线程能在其生命期内进行完全独立的操作。更多的情况是一些线程进行某些处理操作,而其他的线程必须对其处理结果进行了解。正常情况下对这种处理结果的了解应当在其处理任务完成后进行。 如果 阅读全文
posted @ 2020-12-17 14:52 strive-sun 阅读(289) 评论(0) 推荐(0)
摘要:对32位Windows来说,其虚拟地址空间总数就是2的32次方,即4GB。 如果没有在引导时加上/3GB或/BOOTVA选项,Windows默认最大会分2GB给内核模式程序使用,2GB给用户模式程序。 其实32位Windows不管系统物理内存有多少,它只会映射这4GB的虚拟地址空间。 也就是说,你不 阅读全文
posted @ 2020-12-17 11:23 strive-sun 阅读(734) 评论(0) 推荐(0)
摘要:this指针是存在与类的成员函数中,指向被调用函数所在的类实例的地址。 根据以下程序来说明this指针, #include<iostream.h> class Point { int x, y; public: Point(int a, int b) { x=a; y=b;} void MovePo 阅读全文
posted @ 2020-12-17 11:21 strive-sun 阅读(134) 评论(0) 推荐(0)
摘要:BITMAPINFOHEADER文档详细介绍了所需要的步骤, 对于未压缩的RGB格式,最小跨度始终是图像宽度(以字节为单位),四舍五入到最接近的DWORD。可以使用以下公式来计算步幅: stride = ((((biWidth * biBitCount) + 31) & ~31) >> 3) 要计算 阅读全文
posted @ 2020-12-17 11:15 strive-sun 阅读(681) 评论(0) 推荐(0)
摘要:设备相关位图(DDB): DDB不包含颜色值,因为每个设备可以具有自己的一组颜色,所以为一个设备创建的DDB可能无法在其他设备上很好地显示。 DDB通常被称为兼容位图,并且它通常比DIB具有更好的GDI性能。(在视频存储器上创建DDB) DDB有两种类型:可丢弃和不可丢弃。可丢弃的DDB是一种位图, 阅读全文
posted @ 2020-12-10 17:02 strive-sun 阅读(735) 评论(0) 推荐(0)
摘要:此文章为小结,仅供参考。 第一种情况,从桌面DC获取RGBA的数据。 32位 HDC hdc, hdcTemp; RECT rect; BYTE* bitPointer; int x, y; int red, green, blue, alpha; while(true) { hdc = GetDC 阅读全文
posted @ 2020-12-10 16:28 strive-sun 阅读(822) 评论(0) 推荐(0)
摘要:void main() { char *buffer = new char(1000); memset(buffer, 0, 1000); char buffer1[1000] = {}; buffer1[0] = 'a'; buffer1[1] = 'b'; buffer1[2] = 'c'; s 阅读全文
posted @ 2020-12-09 14:29 strive-sun 阅读(119) 评论(0) 推荐(0)
摘要:WM_DROPFILES : 当用户将文件拖放到已注册为丢弃文件的接收者的应用程序窗口中时发送该消息 我们可以利用这个消息获取文件名称,并将它们保存到容器里。 LRESULT CALLBACK StaticWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP 阅读全文
posted @ 2020-12-08 13:49 strive-sun 阅读(1886) 评论(0) 推荐(0)
摘要:MASM安装教程: https://blog.csdn.net/u010486308/article/details/105495848 代码参考: .model flat, stdcall option casemap: none include windows.inc include kerne 阅读全文
posted @ 2020-12-04 16:11 strive-sun 阅读(162) 评论(0) 推荐(0)
摘要:前者很常用, 经常被用来转换为字符串或者拼接字符串。 例子: #include <Windows.h> #include <stdio.h> int main() { int t = 123456; WCHAR str[256] = L"heelo"; wsprintf(&str[5], L"%d" 阅读全文
posted @ 2020-12-03 15:20 strive-sun 阅读(385) 评论(0) 推荐(0)
摘要:只需要记住使用OpenEvent来同步Event对象。 Project A: #define _CRT_SECURE_NO_WARNINGS #include <Windows.h> #include <stdio.h> #include <time.h> HANDLE hEvent; int ma 阅读全文
posted @ 2020-12-03 10:01 strive-sun 阅读(743) 评论(0) 推荐(0)
摘要:网上关于IFolderView2接口调用的示例有点少。 下面的例子是将桌面的图标隐藏起来,使用了FWF_NOICONS样式。 #include <ShlObj.h> // Shell API #include <atlcomcli.h> // CComPtr & Co. #include <stri 阅读全文
posted @ 2020-12-01 14:55 strive-sun 阅读(510) 评论(0) 推荐(0)