Shlwapi.h头文件的使用
// TestShlwAPI.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <Shlwapi.h>
#pragma comment(lib,"shlwapi.lib")
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
// Valid file path name (file is there).
char buffer_1[] = "C:\\Install.log";
char *lpStr1;
lpStr1 = buffer_1;
WCHAR wsz1[64];
swprintf(wsz1, L"%S", lpStr1);
// Invalid file path name (file is not there).
char buffer_2[] = "C:\\TEST\\file.doc";
char *lpStr2;
lpStr2 = buffer_2;
WCHAR wsz2[64];
swprintf(wsz1, L"%S", lpStr1);
// Search for the presence of a file with a true result.
//int retval = PathFileExists(lpStr1);
int retval = PathFileExists(wsz1);
if(retval == 1)
{
cout << "Search for the file path of : " << lpStr1 << endl;
cout << "The file requested \"" << lpStr1 << "\" is a valid file" << endl;
cout << "The return from function is: " << retval << endl;
}
else
{
cout << "The file requested " << lpStr1 << " is not a valid file" << endl;
cout << "The return from function is: " << retval << endl;
}
// Search for the presence of a file with a false result.
//retval = PathFileExists(lpStr2);
retval = PathFileExists(wsz2);
if(retval == 1)
{
cout << "\nThe file requested " << lpStr2 << " is a valid file" << endl;
cout << "Search for the file path of: " << lpStr2 << endl;
cout << "The return from function is: " << retval << endl;
}
else
{
cout << "\nThe file requested \"" << lpStr2 << "\" is not a valid file" << endl;
cout << "The return from function is: " << retval << endl;
}
system("pause");
}
Shlwapi.h头文件的使用的更多相关文章
- 【C】.h头文件的重复包含问题
.h头文件存在的意义就是封装,可以方便多个.c源文件使用,但要防止.h头文件被同一个.c源文件多次包含. 例如, io.h文件 #ifndef _IO_H_ #define _IO_H_ #defin ...
- 【转】【Raspberry Pi】Unix NetWork Programming:配置unp.h头文件环境
一.初衷 近期正在做网络计算编程的作业.要求平台为unix/linux,想着Raspberry Pi装的Debian系统也是Linux改的,也应该能够勉强用着,所以就用它来做作业了! 二.说明 先把环 ...
- Android JNI开发生成.h头文件问题(转)
在JNI开发中,首先要将建立的anroid类编译成.h文件,编译用到命令javah,由于第一次用,以前对java的编译过程也不怎么了解,所以走了好多弯路,网络没有对这一步的详细介绍,这里讲一下: 通过 ...
- 基础知识复习(二)——stdafx.h 头文件及x&(x-1)运算
今天好久没写过C++程序了,使用VS2013 新建空的控制台程序,结果自动生成了头文件和main 方法. 就了解了stdafx.h头文件的含义及用法. stdafx:standard Applicat ...
- hpp头文件与h头文件的区别
hpp,其实质就是将.cpp的实现代码混入.h头文件当中,定义与实现都包含在同一文件,则该类的调用者只需要include该hpp文件即可,无需再将cpp加入到project中进行编译.而实现代码将直接 ...
- Android JNI开发生成.h头文件问题
在JNI开发中,首先要将建立的anroid类编译成.h文件,编译用到命令javah,由于第一次用,以前对java的编译过程也不怎么了解,所以走了好多弯路,网络没有对这一步的详细介绍,这里讲一下: 通过 ...
- C/C++关于string.h头文件和string类
学习C语言时,用字符串的函数例如stpcpy().strcat().strcmp()等,要包含头文件string.h 学习C++后,C++有字符串的标准类string,string类也有很多方法,用s ...
- 找不到所需要的ndbm.h头文件
具体描述: 通过deb包安装gdbm之后,发现找不到所需要的ndbm.h头文件.但是你会发现一个叫gdbm-ndbm.h的文件,你只需要把文件名改成ndbm.h就可以了,当然需要一定权限. sudo ...
- stdlib.h 头文件
stdlib 头文件即standard library标准库头文件.stdlib.h里面定义了五种类型.一些宏和通用工具函数. 类型例如size_t.wchar_t.div_t.ldiv_t和lldi ...
随机推荐
- cesiumjs学习笔记之三——cesium-navigation插件 【转】
http://blog.csdn.net/Prepared/article/details/68940997?locationNum=10&fps=1 插件源码地址:https://githu ...
- [leetcode]Reorder List @ Python
原题地址:http://oj.leetcode.com/problems/reorder-list/ 题意: Given a singly linked list L: L0→L1→…→Ln-1→Ln ...
- 百度编辑器ueditor通过ajax方式提交,不需要事先转义字符的方法(异常:从客户端(xxx)中检测到有潜在危险的 Request.Form 值)
最近项目中使用百度编辑神器ueditor,确实是很好用的一款编辑器.官网教程提供的与后端数据交互都是跟表单方式有关的,项目中使用的是ajax方式提交,因此出现了不少问题,现在记录备忘下. 环境:.ne ...
- mybatis异常 :元素内容必须由格式正确的字符数据或标记组成。
今天同事写一个查询接口的时候,出错:元素内容必须由格式正确的字符数据或标记组成. 错误原因:mybatis查询的时候,需要用到运算符 小于号:< 和 大于号: >,在mybatis配置文 ...
- solr安装使用笔记
下载 solr官方下载地址:http://lucene.apache.org/solr/ 使用 启动 solr dir/bin/solr.cmd start 停止 solr dir/bin/solr. ...
- MVC应用积累
1.Controller中的跳转 (1)直接Redirect后加(Controller/Action):Response.Redirect("/Home/Index"); (2)直 ...
- easyui问题小结
http://blog.sina.com.cn/s/blog_77cb836301017lrd.html
- 全局安装 vue
通过npm命令安装vuejs在用 Vue.js 构建大型应用时推荐使用 NPM 安装,NPM 能很好地和诸如 Webpack 或Browserify 的 CommonJS 模块打包器配合使用.(以下操 ...
- javaScriptObject转String
function obj2str(o){ var r = []; if(typeof o =="string") return "\""+o.repl ...
- java 复制Map对象(深拷贝与浅拷贝)
java 复制Map对象(深拷贝与浅拷贝) CreationTime--2018年6月4日10点00分 Author:Marydon 1.深拷贝与浅拷贝 浅拷贝:只复制对象的引用,两个引用仍然指向 ...