|
I was writing some code using IShellFolder to get the file information from the operating system. I could get information like file DisplayName or TypeName from SHFILEINFO structure returned by SHGetFileInfo. The thing is I also need some other attributes like FileSize, LastModified/access time etc. In addition for local disk identifiers, I'd like to know the total size and free space attributes. I think either there is another interface for retrieving those information or I've got into a wrong way.
Many thanks in advance.
Pan
-- modified at 5:00 Wednesday 1st August, 2007
Toe the line
Thread the needle
Think outside of the box
|
|
|
|
|
Any help is welcome. Please don't let this post go down
Toe the line
Thread the needle
Think outside of the box
|
|
|
|
|
be patient... and know that the other part of the earth is still sleeping
|
|
|
|
|
True. I was a bit worried that this message was going to be degraded to NextNextNext page. People who want to be helpful won't have a chance to read it.
Toe the line
Thread the needle
Think outside of the box
|
|
|
|
|
PinuxATSweden wrote: The thing is I also need some other attributes like FileSize, LastModified/access time etc.
So have you tried using GetFileAttributesEx() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for your reply.
No. I implement this function by using the IShellFolder interface. When accessing files, I don't really know the logical display name. Therefore, instead of using the display file name or directory, I use an ITEMIDLIST originated from Desktop Item to represent a 'file':
LPITEMIDLIST lpi;
SHFILEINFO sfi;
SHGetFileInfo((LPCWSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), SHGFI_PIDL | SHGFI_TYPENAME);
SHGetFileInfo((LPCWSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
This can help me to enumerate anything under an ITEM(file/folder/disk...) and find the target sub-item in a faster way.
But as you can see the definition of SHFILEINTO structure doesn't have some information like file size/access time/disk space that I am retrieving.
typedef struct _SHFILEINFO {
HICON hIcon;
int iIcon;
DWORD dwAttributes;
TCHAR szDisplayName[MAX_PATH];
TCHAR szTypeName[80];
} SHFILEINFO;
Toe the line
Thread the needle
Think outside of the box
|
|
|
|
|
Can't you just use the GetDisplayNameOf() method to convert the PIDL to an actual path/file name (that can then be used with GetFileAttributesEx() )?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You got me. That seems to be the solution. Thanks for your help.
Toe the line
Thread the needle
Think outside of the box
|
|
|
|
|
Do I suffer from a performance issue if the displayed file list is fairly large by using this conversion. I am trying it.
Toe the line
Thread the needle
Think outside of the box
|
|
|
|
|
Hello Guru's
I got a problem in MFC (Dialog based form ) . I have some text
in a EditBox. And have also a file in my C drive ( or any where ) name
test.txt file is empty till now.
Now i want to save that edit box text in to that test.txt file with the help
of programming . Can any one told me how can i do this.
Please give me brief idea about that.
Regard's
Kaushik
|
|
|
|
|
Y_Kaushik wrote: Can any one told me how can i do this.
I wish, you had refered CFile[^] class.
Prasad
MS MVP - VC++
|
|
|
|
|
can u give me any sample for this
Regard's
Kaushik
|
|
|
|
|
Kaushik,
I could easily give or direct to sample code for this. But, this is very basic stuff. And I don't want to spoil you.
Learn to use google and other powerful tools on web. I'm advising you this for your development.
Prasad
MS MVP - VC++
|
|
|
|
|
On the MSDN you can see an example anyway see here[^] if helpfuls.
|
|
|
|
|
You read your datas with GetWindowText of Edit Control and use of CFile::Write for write to file.
|
|
|
|
|
what about using CStdioFile::WriteString!
use CStdioFile::Open to open file
and CStdioFile::WriteString! to write string into file
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
Hi all,
I need to implement some thing similiar to 'power toys' in VC++ which would support thumbnail viewing of the opened dialogs when we press ALT+TAB (or any defined keys).
I thing Shell programming should be applied to achieve this.
As i dont have any idea abt that any help from you on this is very much appreciated...
Thanks in advance.
Selva
|
|
|
|
|
if The power toy has anthing to do the last thing would be use shell script. It is windows application using GDI(i think). you can develop such Application in .NET. Try out Googling first.
There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing.
Oscar Wilde (1854-1900)
Regards...
Shouvik
|
|
|
|
|
Logically thinking, you can achieve this easily creating the bitmap buttons dynamically in a resizable dialog box. Not a very tough job, if i understood your problem correctly.
Anurag Gandhi.
http://www.softgandhi.co.nr
|
|
|
|
|
|
Hello everyone,
I am writing a pure C/C++ program to convert from UCS-2 to UTF-8 character string. I can not find enough information from Google -- the mapping tables (formula) between UCS-2 and UTF-8.
I want to develop the program through pure bit operations (&, | and shifting), and I do not want to invoking any OS specific APIs.
Any reference samples or the mapping tables (formula) between UCS-2 and UTF-8?
thanks in advance,
George
|
|
|
|
|
George_George wrote: Any reference samples or the mapping tables (formula) between UCS-2 and UTF-8?
For instance, this[^]. Also, you can take a look at my utf8-cpp[^] library to see an example of actual implementation.
|
|
|
|
|
Thanks Nemanja!
Good reference and I have looked into the document. But I can not find the mapping table or formula between UCS-2 and UTF-8. Could you kindly point them out please?
regards,
George
|
|
|
|
|
I have created a MFC regular dll whose dll export function takes the parameter as a CString and also returns a CString object.
I doubt it can be called from other language which don't have CString class.
The prototype function is like this:
<br />
extern "C" __declspec(dllexport) CString IndentCCode(CString strMyString)<br />
Any solution/ comment(s) whether it will work with other language?
I can use char* but pointer is also not supported in many language.
I will appreciate any help.
Thanking you in advance.
Anurag Gandhi.
http://www.softgandhi.co.nr
|
|
|
|
|
If you want it to work with other languages you will have to make it a COM dll and use BSTRs.
"a child will grow up to become an adult, but you can never stop the adult from acting like a child"
|
|
|
|