Solved

How to make Win32 Api calls from C++ Builder

Posted on 2003-11-15
4
1,997 Views
Last Modified: 2012-08-14
Hello I am trying to call

PathRemoveFileSpec(FileName); //Shell api call from win32 library

but Borlands C++ builder gives me a linker error

[Linker Error] Unresolved external 'PathRemoveFileSpecA' referenced from C:\DOCUMENTS AND SETTINGS\MY DOCUMENTS\COLLEGE_WORK\YEAR4\SOFTWARE ENGINEERING\LAB2\MAIN.OBJ

I have tried including

#include "shlwapi.h"

and including the following directories
C:\Program Files\Microsoft SDK\include
C:\Program Files\Microsoft SDK\Lib

to Project->Options->Directories/Conditions libs and includes

But stil the same error any ideas?
0
Comment
Question by:auk_ie
4 Comments
 
LVL 16

Expert Comment

by:_nn_
ID: 9757194
Never used C++ Builder myself, but have you already tried to add explicitly shlwapi.lib to the list of objects to be linked ?
0
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 125 total points
ID: 9757857
I believe that even a free compiler such as that Borland thing supports the #pragma that will include the necessary lib file.  So try adding this at the top of your program:

   #pragma comment( lib, "SHLWAPI.LIB" );

if that doesn't work, try the full pathname:

     #pragma comment(lib, "C:\Program Files\Microsoft SDK\LibSHLWAPI.LIB" );

-- Dan
1
 
LVL 2

Accepted Solution

by:
xssass earned 125 total points
ID: 9957610
I used some winapi functions myself, and all I had to do is enter
"#include <windows.h>"
before "#pragma hdrstop"

Hope this helps,
  .K.
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10249245
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: DanRollins {http:#9757857}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Building cUrl in Windows v7.43.0 4 36
AVI wait icons for CAnimateCtrl in Visual Studio 2008 MFC 1 152
convert char array to number in c 5 86
designing in object programming 12 94
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question