Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to make Win32 Api calls from C++ Builder

Posted on 2003-11-15
4
Medium Priority
?
2,123 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 375 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 375 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

722 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