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 ...
随机推荐
- C语言学习笔记:14_内部函数和外部函数
/* * 14_内部函数和外部函数.c * * Created on: 2015年7月5日 * Author: zhong */ #include <stdio.h> #include & ...
- [Algorithm] Meeting hour optimization (Kanpsack problem) and Dynamic programming
For example we have array of meeting objects: const data = [ { name: }, { name: }, { name: }, { name ...
- ORACLE关于锁表查询的部分SQL
http://www.cnblogs.com/quanweiru/archive/2012/08/28/2660700.html --查询表空间名称和大小 SELECT UPPER (F.TABLES ...
- 安装apache+php记录
安装apache yum install httpd 修改apache配置文件,可以修改apache的默认端口号,根目录等 /etc/httpd/conf/httpd.conf 启动/重启apache ...
- jQuery之前端国际化jQuery.i18n.properties[转]
http://www.ibm.com/developerworks/cn/web/1305_hezj_jqueryi18n/ jQuery.i18n.properties是一款轻量级的jQuery国际 ...
- OpenCV 视频处理框架
OpenCV 本身集成了 FFmpeg,因此对于视频是有解码和编码功能的.尽管其效率在本人看来还不能跟未被封装的FFmpeg相提并论,然用其来对视频进行解码得到图像,然后对图像进行处理并将得到的图像又 ...
- Spring中依赖注入的四种方式
在Spring容器中为一个bean配置依赖注入有三种方式: · 使用属性的setter方法注入 这是最常用的方式: · 使用构造器注入: · 使用Filed注入(用于注解方式). 使用属性的sett ...
- UEFI是什么?与BIOS的区别在哪里?UEFI详解!
前几天在帮同事小何笔记本电脑安装64位 Windows 7 的时候,遇到一个从来没有碰到过的问题,使用光盘安装时,提示:Windows无法安装到这个磁盘.选中的磁盘具有MBR分区表.在EFI系统上,W ...
- $watch
$watch简单使用 $watch是一个scope函数,用于监听模型变化,当你的模型部分发生变化时它会通知你. $watch(watchExpression, listener, objectEqua ...
- python中in在list和dict中查找效率比较
转载自:http://blog.csdn.net/wzgbm/article/details/54691615 首先给一个简单的例子,测测list和dict查找的时间: ,-,-,-,-,,,,,,] ...