|
I assume you mean disk space? If so use the IOCTL_DISK_GET_LENGTH_INFO control code with DeviceIoControl() .
The documentation can be found here
Hope this helps,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Sorry i was wrong i just edit the question..
|
|
|
|
|
Between my first answer and now, I've had a bit of a look for an answer for you.
First - click on my name to go to an article I wrote about detecting drives being added / removed. It may be helpful for you.
You've already been told about DEVICE_IO_CONTROL possible solution.
The only other function I've found is GetDiskFreeSpaceEx - which doesn't tell you the total size, just the free space.
But if free space is good enough information for you, it will be a lot easier to use.
Good luck,
Iain.
|
|
|
|
|
it is nice but not use full for me..If it is possibel then can you give me example of USB attached device Size..
Thx's
|
|
|
|
|
|
I have almost zero database experience, so please be gentle.
I want to access/update a MS SQL Server (or the free Express version) database from a C++ application (could be MFC if required), but don't know where to start. Any pointers would be very welcome!
Thanks.
|
|
|
|
|
If I remember rightly there is on OLE/DB provider COM object available for MS SQL Server. It should be a matter of writing a COM client to talk to it. I guess OLE/DB is out of date these days but other than going LINQ I don't know what's replaced it.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Digging some more it seems ADO is the way to go. Alternatively I buy a copy of this[^] which will give us support for lots of different databases and is cross-platform, which would be useful for this particular project...
|
|
|
|
|
You may also use ODBC [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ADO wraps OLE DB to present a VB- and scripting-friendly interface. From C++ you may find that the OLE DB Consumer Templates are actually easier to use: you don't have to go through the Automation data types.
There's even a book[^].
Unfortunately not very many people seem to know about this, so you may find help difficult to come by.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Here's a place you can compare the non-.NET data access technologies
specific to Windows...
Windows Data Access Components SDK[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hi ,
I have to display some data in an edit box.
The buffer contains 10,13 characters in between.
So I am displaying as it is.
Suppose I have in my buff "red\r\nblue\r\ngreen",
the display must be
red
blue
green. like this.
But my edit box displaying it in a single line like "red\r\nblue\r\ngreen",
How can I do it?
Please help me.
Regards,
Sunil Kumar
|
|
|
|
|
If the code is not confidential, can you show it to us, please?
|
|
|
|
|
You need to set the ES_MULTILINE style. It's one of the check boxes in the designer, or use the style in your CreateWindow call.
(If that still fails, try \r\n, but it should work).
Iain
|
|
|
|
|
Hi,
Yeah if I define as multiline it is working.
But it is working only if I give manually like
SetWindowText("red\r\nblue\r\ngreen");
But if i get the data from external source via UART I am collecting in a buffer.
Buffer contains the chars 10,13 after each word.
Then I directly do SetWindowText(buffer);In that case it is displaying in a single line,
not in multilines.
So what should be done if I have to display the data in multilines whenever i come across 10,13 characters.
Please help!
Regards,
Sunil Kumar
|
|
|
|
|
Replace 10 with \r and 13 with \n ?
|
|
|
|
|
Hi Rajesh,
Is there any difference between 10 and '\r' , 13 and '\n'.
I think they are ascii euqivalents only na??
In the buffer if I replace 10 with '\r', in the debug mode I am able to see 10 only as it is the ascii
euivalent.
Regards,
Sunil Kumar
|
|
|
|
|
So, that was the reason why I asked you for the code. Also, I'd like to see how this 10 and 13 are coming within a string. It is impossible to tell you anything without looking at your code.
|
|
|
|
|
sunilkumar.d wrote: Is there any difference between 10 and '\r' , 13 and '\n'.
Yes.
sunilkumar.d wrote: I think they are ascii euqivalents only na??
You're wrong:
10 is the ASCII code for '\n'
13 is the ASCII code for '\r' .
(i.e. you're getting the characters in the reverse order).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
My first thought was "Hmph, of course it works..."
But I thought I'd get some evidence before acting all superior.
This does not work:
CString buf;
buf += "Hello";
buf += char (10);
buf += "There";
SetDlgItemText (IDC_EDIT7, buf);
This does not work:
CString buf;
buf += "Hello";
buf += char (13);
buf += "There";
SetDlgItemText (IDC_EDIT7, buf);
This does not work:
CString buf;
buf += "Hello";
buf += char (10);
buf += char (13);
buf += "There";
SetDlgItemText (IDC_EDIT7, buf);
This works!
CString buf;
buf += "Hello";
buf += char (13);
buf += char (10);
buf += "There";
SetDlgItemText (IDC_EDIT7, buf);
Which comes as a bit of a surprise to me... Needing both CR and LF is no shock, but which order? Quite a surprise.
How you solve it is up to you really. Your reading from the UART routine could simply swap char(10) with char(13) and vice versa.
Or your routine that puts the text into the screen could.
You could put it in a string, and do a replace like so:
while (1)
{
int nFind = MyString.Find ("\n\r");
if (nFind < 0) break;
MyString [nFind] = '\r';
MyString [nFind+1] = '\n';
}
The choices are (near) endless.
Iain.
|
|
|
|
|
Yeah Iain,
It is a bit surprise.
If I change the order , like if 10 is replaced with '\r' and 13 is replaced
with '\n', it is displaying in multilines.
Regards,
Sunil Kumar
|
|
|
|
|
Hi all,
i have to access file those extension are .mdb, how can i write data from one .mdb file to another,thru coding.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
"_$h@nky_" wrote: how can i write data from one .mdb file to another,thru coding
you mean, pure file copy ?
or you want to copy internal parts of it only ?
if so, you must know the format of the file first...
|
|
|
|
|
No i have already done file copying.
In file copying the exist data is removed.
So i want write data from source file to dest file,without losting of existing data of dest file.
So please tell me how can i do this ?
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|