|
Use a CString object and its concatenation operator. Smething like:
CString str = drive + dir + file_you_want_to_check;
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
MS documentation states: "The GetFullPathName function retrieves the full path and file name of a specified file". So you still have the file name there.
I'd use PathRemoveFileSpec this "Removes the trailing file name and backslash from a path, if it has them."
Info on PathRemoveFileSpec:
Minimum DLL Version shlwapi.dll version 4.71 or later
Header shlwapi.h
Import library shlwapi.lib
Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0
|
|
|
|
|
Thanks, I am able to use that function ..
I call it with the ofn.lpstrFile (path and file name).
Then I should have the ofn.lpstrFile ready to merge with the other file name ... how can I do this?
Thanks, Ruben.
|
|
|
|
|
If you've got the Windows SDK then you'll find details about the Shell Lightweight Utility Path Funtions in the documentation under:
User Interface Services > Windows Shell > Shell Reference > Shell Lightweight Utility Funtions > Path Functions.
(If you've not got the SDK then I recommend you get it. It's a free download from msdn)
There are lots of useful routines for manipulating paths. The one you need to merge the path with the name of the 2nd file is PathAppend.
Cheers, Chris
|
|
|
|
|
|
Hi.
How could I convert an hecadecimal value that is in a CString variable to integer hexadecimal
for example I have:
CString strHexa="C9"
but I need this value in an integer variable:
int n=0xc9;
Thank you.
|
|
|
|
|
char *end;
int n = strtol(strHexa, &end, 16);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
<font style="color:blue;">#include</font> <stdio.h> <font style="color:green;">
<font style="color:blue;">#include</font> <CString> <font style="color:green;">
<font style="color:blue;">int</font> my_integer = 0;
Cstring string = "C9";
<font style="color:blue;">char </font>str[] = (LPCTSTR)string;
sscanf(str, "%x", my_integer);
printf("%d %x\n", my_integer, my_integer);
this outputs : 201 C9
TOXCCT >>> GEII power
|
|
|
|
|
Anyone knows how to set up Windows XP theme for the controls.
Thanx very much...;)
|
|
|
|
|
Do you mean for your application, or so you can draw controls using themes?
If the latter, look up OpenThemeData()[^] in MSDN for a starting point.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
You need to use manifest, there are number of articles that shows how to use them here in CP.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
The usual technique of traversing a folder and all it's sub-folders is pretty commonplace, but it suffers from the fact that the stack just might run out (sure, we can specify the stack size in vc, but we dont want to hog a lot of memory for the stack!).
What is a good way to use a non-recursive loop to traverse folders? Is there no solution apart from using "goto" statements?
Bikram
|
|
|
|
|
Bikram Singh wrote:
What is a good way to use a non-recursive loop to traverse folders? Is there no solution apart from using "goto" statements?
Sure there is. Just call SetCurrentDirectory() with each directory encountered.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Do you have some source code for the entire problem?
Bikram
|
|
|
|
|
No. I've personally not ever used the function. It's a hold-over from the Unix world and its single-threaded environment. For Windows and multi-threaded applications, if another thread is running, the "current directory" is constantly changing for all of the threads. For anything that requires folder traversal, I always use recursion. Can you explain in more detail your hesitation in using this methodology?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
If your program in a Win32 app with a message loop you could use PostMessage to do the whole thing asynchronously, and then in the main function use a event loop to wait till it was all done. Dunno how efficient that is
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Search in this board for an algorithm I posted a week ago or so to recurse a directory. This uses SetCurrentDirectory() and uses minimal stack.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I tried this for almost an hour yesterday because I knew I had just recently seen an example. All that I could find was a post from coremn.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
It's pretty easy. Something like:
<br />
CStringList dirs, files;<br />
CString dir;<br />
CFileFind ff;<br />
BOOL ok;<br />
<br />
dirs.AddTail("c:\\work\\lisp");<br />
<br />
while (!dirs.IsEmpty())<br />
{<br />
dir = dirs.RemoveHead();<br />
if (ff.FindFile( dir + "\\*.*" ))<br />
{<br />
do<br />
{<br />
ok = ff.FindNextFile();<br />
if (ff.IsDots()) continue;<br />
if (ff.IsDirectory())<br />
{<br />
dirs.AddTail( ff.GetFilePath() );<br />
continue;<br />
}<br />
files.AddTail( ff.GetFilePath() );<br />
}while (ok);<br />
}<br />
}<br />
--
Joel Lucsy
|
|
|
|
|
Hi, I have a question.
Is there some mode in MFC to use the class CFileDialog inside a CPropertySheet ?
The goal can be extended to other CDialog classes that is necessary to use as CDialog but also as CPropertyPage without duplicate the code inside.
Thanks
Bye from Maxer
|
|
|
|
|
Maxer wrote:
Is there some mode in MFC to use the class CFileDialog inside a CPropertySheet ?
Do you mean from a CPropertyPage ? If so, this should work:
CFileDialog fd(TRUE);
if (fd.DoModal() == IDOK)
{
...
}
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
No, what I would want is to see the CFileDialog in a tab of a CPropertySheet.
Is it possible?
Bye from Maxer
|
|
|
|
|
Maxer wrote:
No, what I would want is to see the CFileDialog in a tab of a CPropertySheet.
What do you think the tabs are? They are CPropertyPage objects. A CPropertySheet is comprised of two or more (yes, you can have one but that makes no sense) CPropertyPage s.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Do you have try to add the CFileDialog object to a CPropertySheet object ?
CFileDialog is a CDialog derived class and not a CPropertyPage derived class.
Bye from Maxer
|
|
|
|
|
Maxer wrote:
Do you have try to add the CFileDialog object to a CPropertySheet object ?
No, the CFileDialog object is instantiated and used in one of the CPropertyPage s.
Maxer wrote:
CFileDialog is a CDialog derived class and not a CPropertyPage derived class.
Of course. Did I imply otherwise?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|