|
HI,
How do i read a Tree.I need to read the Tree from Root Item to all its childs.Iam not able to give logic. Plz help me
Thanks,
|
|
|
|
|
Did you see CTreeCtrl::GetRootItem/GetNextItem/GetSelectedItem?
|
|
|
|
|
Hi all,
I want to get my hard disk name I am using WMI to get it. I have Initialized com using CoInitializeEx, then i have set security levels using CoInitializeSecurity, then i Obtain the initial locator to WMI, then i have Connected to WMI through the IWbemLocator::ConnectServer method but my problem is i am not getting the right api to get hard disk name.. how can i get it???
IWbemServices *pSvc = NULL;
hres = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"),
NULL,
NULL,
0,
NULL,
0,
0,
&pSvc
);
can anybody help me in this
thanks in advance
|
|
|
|
|
First of all Set IWbemServices proxy security so that WMI service can impersonate the client by calling CoSetProxyBlanket.
Then Get Physical disks Installed on the system using ExecQuery().
|
|
|
|
|
can u tell me this through some example, or can u provide me with some link
|
|
|
|
|
Did you try to execute query using pSvc like
example from MSDN
IEnumWbemClassObject* pEnumerator = NULL;
hres = pSvc->ExecQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM Win32_OperatingSystem"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
for disk information
you have to try some thing like
SELECT * from Win32_DiskDrive
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
SandipG wrote: for disk information
you have to try some thing like
SELECT * from Win32_DiskDrive
Which property were you thinking would hold the volume name? Perhaps you meant Win32_LogicalDisk instead.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Oops, i didn't see that OP mentioned volume name.
But for volume names do we need WMI, i think we have some API.
GetVolumeInformation or something not sure.. Am i correct??
Regards,
Sandip.
|
|
|
|
|
SandipG wrote: But for volume names do we need WMI...
No, but the OP asked for it.
SandipG wrote: ...i think we have some API. GetVolumeInformation or something not sure.. Am i correct??
Yes, and I would have suggested it had it not been for the WMI requirement.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
I am getting error no 5 while writing in my C Drive which is having windows vista.
What should I do?
I tried with Dismount volume that is working with all drive except c:(OS drive).
What should I do that?
|
|
|
|
|
Error 5 == access denied. Sounds like a permissions thing. I suspect you aren't permitted to write to c:\? The same thing happens when writing to c:\ with a default install of XP as well - it's not necessarily a Vista thing.
|
|
|
|
|
This is only wuth vista becuase I have checked with Xp and all, this problem is with vista only.
|
|
|
|
|
"What should I do?": Reading about Right Managment in Vista.
=> http://msdn.microsoft.com/en-us/library/aa905330.aspx[^]
You cant write a file where you want, you need to have the write rights. A nice place to write is the User Directory who started the writing process.
Greetings from Germany
|
|
|
|
|
Thank you but I have set all security attributes. I am facing the problem only Os drive of Vista.
Is there any way to skip the security permission?
|
|
|
|
|
There is always a way. Your process needs administrative rights. But thats no good practise.
I guess your not so seasoned in Windows programming, so you got to learn a lot.
Once again: You better read and understand the right managment in Vista.
Greetings from Germany
|
|
|
|
|
MPTP wrote: Is there any way to skip the security permission?
Of course not - that's baked into the OS - if there was a way around security, then writing viruses would be even more common than they already are. Think of it like the locks on your car - is there any easy way around them (yes, you can pick them, but htere's no legitimate way around them).
|
|
|
|
|
MPTP wrote: I have set all security attributes.
No, you haven't.
You need to set folder permissions to allow the desired access by the
appropriate user(s).
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
One other thing you might try - Process Monitor[^] can help you see exactly what your process is doing in terms of file accesses and things - that might give an extra level of detail that you need?
|
|
|
|
|
Exactly what folder are you trying to write to? Short of being an administrator, there are only a few folders that you can write to.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
i have a dialog based appication. when i click on a button on a dialog(1st dialog), it will open 1 dialog(2nd dialog) and when i click on button on this dialog(2nd dialog) another dialog box(3rd dialog) will get opened and i want to change title of this dialog(3rd dialog).
thanks in advance
|
|
|
|
|
u can use SetWindowText().
|
|
|
|
|
Chandrasekharanp wrote: u can use SetWindowText().
You cannot use SMS language here, please.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|
Chandrasekharanp wrote: That was not intentional
Intentional or not intentional, it simply irritates the majority of the 'grown-up' population.
I am not sending an SMS to an old peer of mine, I'm answering a query on an programming board, that hundreds of professionals from around the world read every day. So, I would be very careful on how I present myself here.
This is off-topic and I won't discuss further on this.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
void CFdView::OnDraw(CDC* pDC)
{
CFdDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
this->GetDocument()->SetTitle("your title");
}
|
|
|
|