Saturday, March 8, 2014

Shlwapi.h not found or FilePathRemoveSpec or Linker Error of FilePathRemoveSpec Solved

 I Solved the Problem with including Shlwapi.h and Using FilePathRemoveSpec

I did the Following Steps

1. Install Microsoft Platform SDK

After installing it you will get a Folder like this in your Program Files

Srep 1:You will Find a folder named Microsoft SDKs in your program files






















Step 2: Check whether Shlwapi.h is Included in that folder Windows->v6.0->Include





















Step 3: Add Path to VC++ Directories both Include and Lib






























































Step 4: Add External dependencies for the project


























Step 5 : Browse there and Type Shlwapi.lib in the Window and Click ok

Now your Visual Studio Can run the Following code works Fine :

#include <windows.h>
#include <iostream>
#include <conio.h>
#include "Shlwapi.h"

void main( void )
{
// Path to include file spec.
char buffer_1[ ] = "C:\\TEST\\sample.txt"; 
char *lpStr1;
lpStr1 = buffer_1;

// Print the path with the file spec.
cout << "The path with file spec is          : " << lpStr1 << endl;

// Call to "PathRemoveFileSpec".
PathRemoveFileSpec(lpStr1);

// Print the path without the file spec.
cout << "\nThe path without file spec is       : " << lpStr1 << endl;
getch();
}

OUTPUT:
==================
The path with file spec is          : C:\TEST\sample.txt

The path without file spec is       : C:\TEST






























No comments:

Post a Comment