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语言获取系统当前时间
C语言获取系统当前时间 time_t -- 时间类型 struct tm -- 时间结构 time(&now)函数获取当前时间距1970年1月1日的秒数,以秒计数单位. localtime ( ...
- 3 Sum leetcode java
题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find al ...
- Jquery中parent()和parents()
一.parent()方法 此方法取得匹配元素集合中每个元素的紧邻父元素,也就是第一级父元素,而不是所有的祖先元素.所取得的父元素集合也可以使用表达式进行筛选. 二.parents()方法 此方法取得一 ...
- IIS-网站发布之后访问HTTP 错误 403.14 - Forbidden
这种问题一般是因为页面本身发生了错误的原因导致的,这个时候先开启[目录浏览]功能 开通目录浏览之后再重新访问,就能看到相应的错误了,再去进行相应的解决就可以了.
- RS交叉表自动汇总后百分比列显示错误之解决方案
可以说在从事Cognos开发的过程中,仅仅对数据展现而言,大多数用户使用最多的工具便是Report Studio了,此工具可以帮助我们快速的构建一些可供用户自主选择的数据报告.当然我个人认为没有什么开 ...
- Matlab实现:图像边缘提取
1. 边缘提取算法 方法一:一阶微分算子 Sobel算子 Sobel算子检测方法对灰度渐变和噪声较多的图像处理效果较好,Sobel算子对边缘定位不是很准确,图像的边缘不止一个像素. Roberts算子 ...
- (LeetCode 141/142)Linked List Cycle
1.Given a linked list, determine if it has a cycle in it. 2.Given a linked list, return the node whe ...
- c语言 多重排序
经过了两天,终于会了. #include<stdio.h> #include<string.h> struct A { char name[100]; int gread; } ...
- 以Settings.APPLICATION_DEVELOPMENT_SETTINGS打开开发人员面板出错总结
近期遇到了一个问题,感觉须要记录一下. 要打开开发人员面板,之前的代码例如以下: Intent intent = new Intent(Settings.ACTION_APPLICATION_DEVE ...
- base64 图片编码之再优化
首先进入网站: http://b64.io/ 最多可减少图片体积容量近70%,建议不要优化base 64 图片格式为gif , 已实测如果用gif的话会增加容量.