|
Did you use GENERAL_WRITE?
A. Riazi
|
|
|
|
|
'fraid so, did everything the online help system told me
code is below:
ULARGE_INTEGER i64FreeBytesToCallerC;
ULARGE_INTEGER i64TotalBytesC;
ULARGE_INTEGER i64FreeBytesC;
ULARGE_INTEGER i64FreeBytesToCallerD;
ULARGE_INTEGER i64TotalBytesD;
ULARGE_INTEGER i64FreeBytesD;
BOOL bSuccess = GetDiskFreeSpaceEx("C:\\",
(PULARGE_INTEGER)&i64FreeBytesToCallerC,
(PULARGE_INTEGER)&i64TotalBytesC,
(PULARGE_INTEGER)&i64FreeBytesC);
bSuccess = GetDiskFreeSpaceEx("D:\\",
(PULARGE_INTEGER)&i64FreeBytesToCallerD,
(PULARGE_INTEGER)&i64TotalBytesD,
(PULARGE_INTEGER)&i64FreeBytesD);
HANDLE hFile = ::CreateFile("C:\\File",GENERIC_WRITE|GENERIC_READ,
GENERIC_ALL,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL
);
long dwHighPart = i64FreeBytesC.u.HighPart ;
DWORD result = ::SetFilePointer(hFile, i64FreeBytesC.u.LowPart, &dwHighPart, FILE_BEGIN);
|
|
|
|
|
You must (at least) take into account that creating a new file will probably allocate at least one cluster, and as the file grows it would probably need several more runs/clusters just to describe the layout of the file on disk.
Try reducing the size of the file you want to create, one page at a time, and I'm sure you'll see that sooner or later the SetFilePointer call will succeed.
Oh, another thing, be prepared that the process can, or more likely will hang for the duration of time needed to actually write NULL's to the filesize you requested (and it can't be terminated, not even by trying to kill it by Task Manager, since it's "hanging" in kernel-mode), why your machine could become "less useful" for other work in the time needed to zero-fill this file.
++luck;
|
|
|
|
|
Glynn wrote:
Is it possible to create a file >2GB under NT/2K/XP
with normal Admin permisions.
Absolutely. IIRC you can create files as large as 2^48 bytes (good luck finding any disks that large! ).
What you might experience is a problem with the filesystem? FATn have problems with large files (though I believe that error should only pop up around 4GB-1).
Maybe you just have a parameter problem for SetFilePointer?
Disk quota might be another thing that could limit you.
|
|
|
|
|
I want to force the update of the title of my application which appears in the taskbar.
I explain :
In my application (MFC), I have a Big Algorithm which take time. In the main loop of this Algorithm, I update the application name to display the percent. (The name look like : "MyAppli - 15%"). The Title of my application is correctly update by windows, but the Title of my application in the taskbar was not update until the end of the algorithm.
If I put a breakpoint in my algorithm, visual update the title in the taskbar... So I image, my algorithm use to CPU, to let the taskbar update itself.
I have try to add this code in the main loop when I change the title :
UInt32 ui32GotMsg;
MSG message;
SetWindowText( szPercent );
while (true)
{
ui32GotMsg = ::PeekMessage( &message, NULL, 0U, 0U, PM_REMOVE | PM_NOYIELD );
if (0 != ui32GotMsg)
{
::TranslateMessage( &message );
::DispatchMessage( &message );
}
else
{
break;
}
}
But, the title in the taskbar doesn't update... I have try to put the code
AfxGetApp->OnIdle(0) just after the 'SetWindowText()' but it doesn't work.
How I can do to force the update of the title of my application in taskbar ?
|
|
|
|
|
Change your code to this:
UInt32 ui32GotMsg;
MSG message;
while (true)
{
ui32GotMsg = ::PeekMessage( &message, NULL, 0U, 0U, PM_REMOVE | PM_NOYIELD);
if (ui32GotMsg != 0)
{
::TranslateMessage( &message );
::DispatchMessage( &message );
}
else
{
SetWindowText( szPercent );
}
}
I hope this works!
A. Riazi
|
|
|
|
|
I have try it, but it doesn't works. (And I must put a break after the SetWindowText( szPercent ); because I must give back CPU time to my algorithm.
My code seem like this :
void BigFunction()
{
for(i=0; i<ui32NbLoop; i++)
{
....
SetWindowsTile();
}
}
void SetWindowsTile()
{
while (true)
{
ui32GotMsg = ::PeekMessage( &message, NULL, 0U, 0U, PM_REMOVE | PM_NOYIELD);
if (ui32GotMsg != 0)
{
::TranslateMessage( &message );
::DispatchMessage( &message );
}
else
{
break;
}
}
}
|
|
|
|
|
Hi !!
I don't have any idea of how to do it, but here is something I'd like to do :
- Develop an app in C++, which would be portable for Windows and Linux.
- This app would have to interface a database (Oracle ? Any better database ?)
I would appreciate any hints on how to do it, or places where I could start searching.
Thanks !
Jerome
|
|
|
|
|
The following class libraries may help:
|
|
|
|
|
Thanks for the quick answer !
I'm sure I'll find plenty of usefull informations in the links you provided.
A question comes to my mind though...Is ODBC the only way to do it ? Or is it the easiest ? Does it exists on Linux ?
Thanks again for your help !
Jerome
|
|
|
|
|
ODBC is the most portable way, it exists in Linux/Unix and you can write database-independent code with it (with some effort).
|
|
|
|
|
If you know what DB you will use and you know it won't change, you can use the API of your DB. I think most of the known DBs have at least a C Interface you can use.
For Oracle look for OCI (Oracle Call Interface) in the Oracle-Docs (online at otn.oracle.com[^] )
<--edit-->
Forgot to mention Pro*C/C++ Precompiler for Oracle. With this precompiler you can write your SQL-Statemetns simply into your C/C++ code. Then run the precompiler. It will subsitute your statements with the correct OCI-calls.
<--edit-->
If you don't know what DB you will use or you want to be able to change it very easy you can use ODBC.
The hardest way: You can implement a generic Data-Access-Class in combination with a Wrapper-Class for each DB-API. So you just replace your wrapper class and you can use another DB.
--
karl
|
|
|
|
|
Thank you for your help, and for the link ! (and also for your suggestion about the hard-way....which I'll try to avoid !!!!)
Jerome
|
|
|
|
|
Hi,
I'm using SHBrowseForFolder Shell API, in my program to select a Folder. I have been able to Display only Drives by initializing a ITEMIDLIST got from SHGetSpecialFolderLocation, in the BROWSEINFO structure.
I dont want to display the Floppy Drive - Letter and the CD ROM Drive Letter. Also among the File System Drives, I want to only display drives (Drive Letters), that have a NTFS File System. Is there any way in which this can be done? i.e Can i filter out the drives that i dont want to display from the dialog that SHBrowseForFolder puts up?
Also can I use SHBrowseForFolder to display Drives and Folders from a Remote System?
Any information regarding this would be a great help.
Regards
Anand
|
|
|
|
|
|
Thanks Riazi, This code was really a help, a little modification should get me going.
Thanks
Anand
|
|
|
|
|
|
Hi,
I have a listview with a background image by using the LVM_SETBKIMAGE message. The textcolor is set to transparent by using LVM_SETTEXTBKCOLOR with CLR_NONE so the image is shown behind any text within the listview. When I set an image for a subitem (report view), the text isn't drawn transparent but with a solid background. Is it possible to add images to subitems and have the text drawn transparent and if so, how do I do it?
Thanks in advance,
Aart Onkenhout
|
|
|
|
|
Hello:
While building a project containing many DLLs the VC++ 6.0 compiler stopped automatically if there was an error in a DLL. New Visual Studio .NET always continues in building although my fix usually requires rebuilding of all subsequent DLLs. Now I have to stop it manually and it is very annoying. Is there an option that stops building after an error?
Thanks Mirek
|
|
|
|
|
Press ESC on your keyboard!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Rickard:
I know how to stop building manually. My question is how to force it to stop automatically. I'm converting a VC++ project to new VS .NET and the project consists of 32 subprojects with more than 2 millions lines. Currently I'm somewhere in the middle and I get hundreds of warnings/errors after every build. So during building I always have to scroll back through hundreds of output lines to check if there was an error or not (and stop it if there is an error). Of course I could change the startup project always after I finish a DLL or I could use the "Build (selection only)" command but I'm always very disappointed when I see that someone has changed something what was good (better than after the change). But may be I'm wrong and there is an option that solves this problem.
Regards Mirek
|
|
|
|
|
mireks wrote:
So during building I always have to scroll back through hundreds of output lines to check if there was an error or not
I have no idea about what you want, and moreover I'm novice...
but (I'm sure that you'll know this) you can press F4 to go through the errors and warnings found...
If nobody answers you and you didn't know it... it can help you...
Hope this helps...
|
|
|
|
|
Joan: thank you for your answer but, unfortunately, it doesn't solve the problem. What I want: My project is large and consists of 32 subprojects (DLLs). When I'm building this project and if there is an error (for example in a DLL #5) then I want Visual Studio to stop building so that I could fix the error. VC++ 6.0 and all previous versions really stopped but new VS .NET continues in building (a DLL #6 and all other DLLs) and writes thousands of other warnings/error messages. I can stop it myself but sometimes it is difficult to notice that there was an error. In my case it doesn't make any sense to continue in building if there is an error, it is just a waste of time (especially if building takes about 20 minutes). I don't know why Microsoft has made this change. I can live with it but - as I've already written - it is annoying.
Regards Mirek
|
|
|
|
|
mireks wrote:
I know how to stop building manually
Argh... Again I read a message carelessly!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
How to create a Table(Like Msword Tables) in Windows Application?
|
|
|
|