473,796 Members | 2,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Visual C++ Open/Save Dialog question

I was wondering what the easiest way to get only the filename from the
FileName property of the Save/Open dialogs in Visual C++? I've create a
string variable and set it to SaveDialog1.Fil eName but that contains
the path and the filename. I know I could go through and find the first
\ from the end of the variable and remove anything before it but there
has to be an easier, less time consuming way, of doing this. In Delphi
there was a property of the Save/Open dialogs that would automatically
return only the filename and not the path, but, as far as I can tell,
there is not one for Visual C++. Any help and/or ideas would be greatly
appreciated!

Thanks,
Tom Sapp
http://www.sappsworld.com

Oct 29 '05 #1
4 5724
Tom Sapp wrote:
I was wondering what the easiest way to get only the filename from the
FileName property of the Save/Open dialogs in Visual C++? [...]


Please ask in 'microsoft.publ ic.vc.language' - the designated Visual
C++ newsgroup. 'comp.lang.c++' talks about standard C++, and it does
not have "Save/Open dialogs", which makes your query off-topic.
Oct 29 '05 #2
Tom Sapp wrote:
I was wondering what the easiest way to get only the filename from the
FileName property of the Save/Open dialogs in Visual C++? I've create a
string variable and set it to SaveDialog1.Fil eName but that contains
the path and the filename. I know I could go through and find the first
\ from the end of the variable and remove anything before it but there
has to be an easier, less time consuming way, of doing this.


Why? Is that really difficult? You sould like one of those programmers
who doesn't actually like programming.

If you wrote a function to do this it would be five lines long (at
most), would take you about 10 minutes, and then you would never have to
write that function again.

John
Oct 29 '05 #3
Take a look at splitpath and makepath in the MSDN.

"Tom Sapp" <ra****@gmail.c om> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
I was wondering what the easiest way to get only the filename from the
FileName property of the Save/Open dialogs in Visual C++? I've create a
string variable and set it to SaveDialog1.Fil eName but that contains
the path and the filename. I know I could go through and find the first
\ from the end of the variable and remove anything before it but there
has to be an easier, less time consuming way, of doing this. In Delphi
there was a property of the Save/Open dialogs that would automatically
return only the filename and not the path, but, as far as I can tell,
there is not one for Visual C++. Any help and/or ideas would be greatly
appreciated!

Thanks,
Tom Sapp
http://www.sappsworld.com

Oct 29 '05 #4
"Tom Sapp" <ra****@gmail.c om> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
I was wondering what the easiest way to get only the filename from the
FileName property of the Save/Open dialogs in Visual C++? I've create a
string variable and set it to SaveDialog1.Fil eName but that contains
the path and the filename. I know I could go through and find the first
\ from the end of the variable and remove anything before it but there
has to be an easier, less time consuming way, of doing this. In Delphi
there was a property of the Save/Open dialogs that would automatically
return only the filename and not the path, but, as far as I can tell,
there is not one for Visual C++. Any help and/or ideas would be greatly
appreciated!

Thanks,
Tom Sapp
http://www.sappsworld.com


What's so hard about that? If it's a std::string just use
find_last_of(.. .). If it's not a std::string, make it one.

std::string FullPath = CStringReturned FromUglyWindows Code;
Oct 29 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7270
by: angelag | last post by:
I am currently taking a college course in Visual Basic.Net and I am a beginner. I bought Visual Studio.Net 2003 to do my homework at home. I built my first project and e-mailed it to myself at school. When I tried to open it in the lab, I got a message saying I couldn't open it because it was created with a newer version. Evidently the lab is using Visual Studio.Net 2002. My professor doesn't just want the executable file, he wants...
2
2643
by: Pat Richey | last post by:
i'm trying to make an open and a save file dialog that allows you to open/save various formats, but when you change the extension you want to filter the file list disappears until you leave the current directory. here's the code for the save box: SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Portable Document Format (*.pdf)|*.pdf" + "|Encapsulated Postscript (*.eps)|*.eps" + "|Bitmap (*.bmp)|*.bmp" + "|JPEG...
3
1201
by: Matt Osborn | last post by:
For a project containing help; set the resource.hm file attributes to include read only. Uncheck Tools->Options->Environment->Documents->Edit read only files. Open Project Open Resource View In Resource View, expand project.rc Expand dialog Notice that all dialog IDs have been replaced with the ID number rather than the defined name.
4
5114
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download" Hyperlink1.NavigateUrl = "MyReport.csv" When the user clicks the HyperLink I would always like to
2
3197
by: Jonathan Trevor | last post by:
Hi, For the last couple of releases of a product we're developing we've been running to very wierd behavior from IE and our ASP.NET web application which serves up various types of files and I'm getting very frustrated in trying to solve it! We content we are serving up is potentially sensitive and therefore we DO NOT want it cached on the remote client (IE) beyond the lifetime of the application rendering it (IE, Powerpoint, Word...
0
2981
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they entered. When this button is pressed and extract is prduced and IE's standard Open/Save dialog should popup so they can navigate to the directory to save the extract in, or if they want, they can choose to open and view the extract without saving it. ...
4
3696
by: Dorte | last post by:
Hi, I am using the code below to stream a CSV file with the response object. Dim FileName As String = "Test.csv" With Web.HttpContext.Current.Response Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" & FileName) .Charset = ""
3
4794
by: xycos | last post by:
Hello. I apologize for asking this question as the information I need is availible via the MSDN library, however I cannot seemt o understand what I need to do, so I'm asking here. I have created application settings in Visual Studio (right-click on the project, go to the settings tab, etc.) and have associated each of these settings with a property on a form. This seems to be working right (i.e. if I edit the default value of a setting,...
0
7338
jwwicks
by: jwwicks | last post by:
Introduction This tutorial describes how to use Visual Studio to create a new C++ program, compile/run a program, resume work on an existing program and debug a program. It is aimed at the beginning CIS student who is struggling to get their programs working. I work in the computer lab at the college I'm attending and I see many students who don't know how to use the IDE for best results. Visual Studio automatically creates a number of...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10237
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10018
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6795
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5578
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.