|
How do I get information from the file properties section of a file? What I want to do is use C or C++ to get the lyrics field from an audio file.
Any ideas?
-- dessa99
|
|
|
|
|
I believe that you're looking for the information on how to view the 'Summary' of a file, as displayed by Windows Explorer.
First, to achieve this, you need to know COM programming. I will describe the method in a short-handed manner. If you do not know shell programming, then this list of information will not be very helpful.
1. Get the desktop folder item
2. Navigate into the folder where the file is (IShellFolder::BindToObject)
3. Get a pointer to the file's IShellFolder interface, and query it for IShellFolder2 interface
4. Call IShellFolder2::GetDetailsOf, passing NULL in the first parameter, and an increasing column index as the second. The third parameter will return the title of the indexed column or E_FAIL if the index doesn't exist.
The MSDN says the same in a more verbose manner:
"The available information fields and their column numbers vary depending on the particular folder. To enumerate the available fields call IShellDetails::GetDetailsOf with pidl set to NULL for increasing values of iColumn. This approach provides you with the title associated with each column index. When iColumn exceeds the number of columns supported by the folder, IShellDetails::GetDetailsOf will return E_FAIL. Bear in mind that these titles are localizable, and may not be the same for all locales."
After you have the titles, and can identify the index of the title you're interested in, then you need to get the PIDL (Pointer to item identifier list) of the file. To get this, use the IShellFolder pointer you had, call IShellFolder::GetDisplayNameOf and use the display name with SHParseDisplayName to get the PIDL. Then call IShellFolder2::GetDetailsOf again with the PIDL and column index. You'll be presented with the information you were looking for.
If none of this makes sense, you should begin your journey in MSDN by searching for 'Shell Basics' and learn the concepts required to program the Shell. It's a difficult and quite a complex thing to learn, but once you master at least a part of it, your skills and options in using Windows OS is much more varied.
Hope this helps.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
How can I make so that disabled menu items are not highlighted when I put cursor on them?
|
|
|
|
|
I would suggest that you have to subclass and write your own owner drawn menu for this.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Yeah, I was thinking about it but wondered if there was a simple way to implement it. Thanks anyway.
|
|
|
|
|
Platform : vc 6.0 ,Windows 2000
1.select MFC AppWizard (EXE)
2.Select SDI
3.Next
4.Next
5.Next
6.Next
7.Base Class is : CEditView
Add three Menu item :(Left ,Center ,Right )
Now :
How can i control the text alignment with this three Menu Item?
uqtur
|
|
|
|
|
i want to know how can i make a "virtual CD" drive on the computer
if any one have a usefull experience,articles or links please send me
|
|
|
|
|
Hi!Dear,
I just want to register in the website
www.c-sharpcorner.com. but after I filled in my email address and my nickname,it never sent password to my email box.I am my email address is correct.my email address is:libingmomer@163.com,passward is "libing". I dont know where is the problem.Maybe it treat my email address as a invalid one.
Now I prefer my honoured you can register a nickname and a password on this website for me to login.
Thanks!
|
|
|
|
|
Hi,
I would like to store great numbers on a primitive type. Is unsigned long int primitive type that can hold the greatest non-negative number? Or which primitive type I can use?
Kind Regards,
-
When in doubt, push a pawn!
-
|
|
|
|
|
Take a look at hyper it holds either a signed or unsigned 64bit number. i.e. unsigned hyper int - will give you a 64bit unsigned integer
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hi Mr. Kancidrowski,
I used hyper but compiler(Visual C++ 2005 Express Beta) gave me compiler error.
Regards,
-
When in doubt, push a pawn!
-
|
|
|
|
|
2005! Wow, you are keen! I am still running either V6.0 or 2003.
What was the error message?
BTW, call me Ant. It needn't be formal!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
unsigned long ul = -1;
so
ul == 0xFFFFFFFF
TOXCCT >>> GEII power
|
|
|
|
|
The error:
when I use the CFile object to write com1(computer seriel port 0) with 270 bytes, the code "pfile->Write(lpchar, 270)" will sometimes throw a CFileException::diskFull exception;
Could u tell me why and In what condition the system will throw the exception
"CFileException::diskFull", when I am writting a seriel port?
Any Suggestions.
Thanks.
Hello World!
|
|
|
|
|
Hi,
I'm doing the beginning VC++ Dialog Box tutorials on this site, and I noticed when I add a member variable to a control(using the Class Wizard) and select Category: Value, the Wizard adds an initialization line in the Dialog constructor.
However, when I add a member variable and select Category: Control with say, Variable Type: CListBox, the Wizard doesn't add anything to the Dialog constructor. Shouldn't the class objects that are members of the class also get initialized in the Dialog constructor? If the answer is yes, how would I do that?
|
|
|
|
|
No you do not need to initialize other classes within the dialog class. They take care of their own initialization.
If you take a look at the header file for the dialog you will see a line like
CListBox m_ListBoxControl;
This instantiates a CListBox object and calls its constructor.
Similarly, when you create and launch a dialog
CMyDialog myDialog; This instantiates the CMyDialog object and calls its constructor
myDialog.DoModal();
calls the dialog DoModal function.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hi,
Thanks for responding.
I’m having trouble verifying your explanation. As far as I can tell, a declaration of a member object in a class doesn’t instantiate the member object and call it's constructor. The code below demonstrates that. I declared a class Car with one member object of type Age:
#include <iostream>
using namespace std;
class Age
{
public:
int years;
Age()
{
cout<<"Age constructor called";
}
};
class Car
{
public:
Age a;
};
int main()
{
cout<<"Was a constructor message displayed?"<
|
|
|
|
|
You need to construct an object of class Car in order for an object of class Age to be constructed.
You have missed this out!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
This is what you said:
-------
"If you take a look at the header file for the dialog you will see a line like
CListBox m_ListBoxControl;
This instantiates a CListBox object and calls its constructor."
-------
My test code shows that your statement is incorrect--just declaring a member object in a .h file does not instantiate the object and call it's constructor. Now, you seem to be saying something different.
Anyway, as far as I can tell, the class Wizard never instantiates the object in a .cpp file with a line like:
CListBox m_ListBoxControl;
which would create the object and call it's default constructor. But, I don't think a statement like that is appropriate for a class member anyways--I think object members of a class get instantiated when an object of the class is created.
I do see this line:
CCodeProject_Dialog2Dlg dlg;
in CCodeProject_Dialog2App::InitInstance(). I guess that must call the default contructor of the object m_ListBoxControl because it's a member of the CCodeProject_Dialog2Dlg class, and in the creation of 'dlg' it gets called somehow.
However, looking around the files, now I don't see the default constructor that's called for 'dlg':
CCodeProject_Dialog2Dlg dlg;
The only constructor I see is:
-------
CCodeProject_Dialog2Dlg::CCodeProject_Dialog2Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CCodeProject_Dialog2Dlg::IDD, pParent)
-------
which has one paramemter, so it can't be the defautlt constructor, and if the programmer defines a constructor, then they have to provide their own default constructor. Where is the default constructor that's called?
|
|
|
|
|
7stud wrote:
My test code shows that your statement is incorrect
You are not going to get code to execute if you are not using it! In the context of your original question I thought I had explained that you do not need to initialize the composite class objects. You do need to instantiate the class that holds these composites however. Sorry if you did not understand this.
When a class is instantiated then all other composite classes within that class are instantiated, if they are defined in the manner discussed earlier.
With regards to the Dialog class constructor.
CCodeProject_Dialog2Dlg dlg;
Does calls the constructor
CCodeProject_Dialog2Dlg::CCodeProject_Dialog2Dlg(CWnd* pParent )<br />
: CDialog(CCodeProject_Dialog2Dlg::IDD, pParent)
NOTE: When the header has 1 parameter that is defaulted (in this case to NULL) you do not need to pass that parameter as long as you want the default behaviour.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
NOTE: When the header has 1 parameter that is defaulted (in this case to NULL) you do not need to pass that parameter as long as you want the default behaviour.
How is the one parameter defaulted to NULL? If I write a constructor like this:
CSomeClass::CSomeClass(a, b, c, d /*All parameters in every function in this project are NULL*/)
{}
Do all the parameters of every function in the project have default values of NULL?
NEVER MIND...I SEE THAT THE DEFAULT VALUE FOR THE SINGLE PARAMETER IS IN THE HEADER FILE.
Thanks for your help.
|
|
|
|
|
It is a good thing that you are questioning what people tell you.
Just to clarify. If you write something like that in the .cpp file it is as a reminder that the parameter is defaulted to NULL
CCodeProject_Dialog2Dlg::CCodeProject_Dialog2Dlg(CWnd* pParent /*=NULL*/)
If you look in the .h file you will see the constructor defined something like
CCodeProject_Dialog2Dlg(CWnd* pParent = NULL)
Note if you have more than one parameter, all parameters after the first one that you default must have default values.
i.e These are OK
Function(int *A = NULL, int *B = NULL, int *C = NULL)
Function(int *A, int *B = NULL, int *C = NULL)
Function(int *A, int *B, int *C = NULL)
These are not
Function(int *A = NULL, int *B, int *C = NULL)
Function(int *A = NULL, int *B, int *C)
Function(int *A, int *B = NULL, int *C)
7stud wrote:
Thanks for your help.
Your welcome
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I have a simple program with classes derived from CWinApp and CFrameWnd. In my CMainWnd public: CFrameWind child class I have a menu that has one item, Item1. If I select the item it displays "Hello World" but if I resize or move the window the client area will refresh and the text will disappear from the dc.
Questions:
1. What should be in scope in OnDraw()?
{
}
2. What should be in scope OnMenuHelloWorld
{
}
|
|
|
|
|
you must call the function that is responsible for drawing inside the
OnDraw()
the OnDraw function is called by the operating system when any update occurs in the program so if you resize the window this is update so the windows will call the OnDraw function inside which will call your drawing function. by this way it wont disapear
|
|
|
|
|
Hello,
I am using VC++ 6 and I can't figure out why a ComboBox will not show list of items with a vertical scroll bar. I have the Type set to Dropdown, Ownerdraw set to No, and Vertical scroll checked.
When I click on the dropdown, I get the first item in the list with a VERY tight vertical scroll bar.
I have six items in my list, but all I can see is one at a time in the dropdown.
What am I doing wrong?
Thanks,
Murrah Boswell
|
|
|
|
|