GetWindowsDirectoryA and GetSystemDirectory
#include <iostream>
#include <Windows.h> using std::cout;
using std::endl; // 获取Windows文件夹的路径
//UINT GetWindowsDirectory(LPTSTR lpBuffer,UINT uSize) //获取systrm32文件夹的路径
//UINT GetSystemDirectory(LPTSTR lpBuffer,UINT uSize) //这两个函数的使用方法很简单,和以前一样有两种方法来确定缓冲区的长度:
//1、Windows定义了一个文件路径的最长长度的常量MAX_PATH(值为260),我们可以用它来建立字符串缓冲区;
//2、给缓冲区传入NULL,调用函数成功后将返回缓冲区的长度。 int main()
{
char* buf = nullptr;
// 调用成功后,返回缓冲区的长度,返回windows文件夹的路径
UINT Size = GetWindowsDirectory(NULL,);
buf = new char [Size];
cout << Size << endl;
if( != GetWindowsDirectoryA(buf,Size))
cout << "WindowsDirectory path is :" << endl << buf << endl;
else
cout << "failed. GetLastError() :" << GetLastError() << endl;
delete buf;
buf = nullptr;
cout << endl; // 调用成功后,返回缓冲区的长度,返回系统路径
Size = GetSystemDirectory(NULL,);
buf = new char [Size];
cout << Size << endl;
if( != GetSystemDirectoryA(buf,Size))
cout << "WindowsDirectory path is :" << endl << buf << endl;
else
cout << "failed. GetLastError() :" << GetLastError() << endl;
delete buf;
buf = nullptr;
cout << endl; system("pause");
return ;
}
【转】:https://blog.csdn.net/liangjisheng/article/details/67642491
GetWindowsDirectoryA and GetSystemDirectory的更多相关文章
- C++ GetSystemDirectory()
关于GetSystemDirectory function,参考:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724373(v ...
- OD常用断点
OD常用断点 很全很全 常用断点 拦截窗口: bp CreateWindow 创建窗口 bp CreateWindowEx(A) 创建窗口 bp ShowWindow 显示窗口 bp UpdateWi ...
- 常用汇编命令&&OD命令总结
汇编32位CPU所含有的寄存器有: 4个数据寄存器(EAX.EBX.ECX和EDX)对低16位数据的存取,不会影响高16位的数据.这些低16位寄存器分别命名为:AX.BX.CX和DX,它和先前的CPU ...
- 如何用VB获得Windows各类系统目录
现在有很多关于如何用VB获得Windows目 录的文章,但大都只讲到如何获得Windows目录和System目录,有时候我们却需要获得像"我的文档"这样的目录("我的文档 ...
- OD调试程序经常使用断点大全
经常使用断点 拦截窗体: bp CreateWindow 创建窗体 bp CreateWindowEx(A) 创建窗体 bp ShowWindow 显示窗体 bp UpdateWindow ...
- Delphi7所使用的WinAPI大全(摘自VCL源码,一共1200个函数)
经过我整理的,去掉了A和W的重复.虽然没写注释,但以后要一个一个研究.有这些WINAPI就够用了. kernel32 = 'kernel32.dll'; gdi32 = 'gdi32.dll'; us ...
- OD调试程序常用断点大全
常用断点 拦截窗口: bp CreateWindow 创建窗口 bp CreateWindowEx(A) 创建窗口 bp ShowWindow 显示窗口 bp UpdateWindow 更新 ...
- C# Windows API
API:应用程序接口(API:Application Program Interface)应用程序接口(API:application programming interface)是一组定义.程序及协 ...
- Windows API 函数列表 附帮助手册
所有Windows API函数列表,为了方便查询,也为了大家查找,所以整理一下贡献出来了. 帮助手册:700多个Windows API的函数手册 免费下载 API之网络函数 API之消息函数 API之 ...
随机推荐
- mysql分表详解
经常听到有人说“数据表太大了,需要分表”,“xxxx了,要分表”的言论,那么,到底为什么要分表? 难道数据量大就要分表? mysql数据量对索引的影响 本人mysql版本为5.7 新增数据测试 为了测 ...
- 第8篇NFS PersistentVolume
一.部署nfs服务端: k8s-master 节点上搭建了 NFS 服务器,也可以在部署节点搭建,原理一样 (1)安装nfs服务: yum install -y nfs-utils rpcbind v ...
- JUC线程池
原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11443644.html newFixedThreadPool 重用指定数目(nThreads)的线程, ...
- 【leetcode】435. Non-overlapping Intervals
题目如下: Given a collection of intervals, find the minimum number of intervals you need to remove to ma ...
- 【leetcode】1001. Grid Illumination
题目如下: On a N x N grid of cells, each cell (x, y) with 0 <= x < N and 0 <= y < N has a la ...
- Spring解决循环依赖
1.Spring解决循环依赖 什么是循环依赖:比如A引用B,B引用C,C引用A,它们最终形成一个依赖环. 循环依赖有两种 1.构造器循环依赖 构造器注入导致的循环依赖,Spring是无法解决的,只能抛 ...
- apue 第10章 信号signal
每种信号都有名字,都是以SIG开头 信号机制最简单的接口是signal函数 #include <signal.h> typedef void (*sighandler_t)(int); s ...
- 低价购买 (动态规划,变种最长下降子序列(LIS))
题目描述 “低价购买”这条建议是在奶牛股票市场取得成功的一半规则.要想被认为是伟大的投资者,你必须遵循以下的问题建议:“低价购买:再低价购买”.每次你购买一支股票,你必须用低于你上次购买它的价格购买它 ...
- element-ui弹窗实现自定义宽度
<el-dialog :title="title" :visible.sync="hiddenDialogCommon" :width="wid ...
- WebView loadRequest请求错误"NSURLConnection finished with error - code -1022"
执行下面代码 [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www ...