|
DavidCrow wrote: Meaning that you don't want it to be sizeable?
Or even non-clickable (to sort)?
Maxwell Chen
|
|
|
|
|
Yes, sorting is not necessary in my case.
|
|
|
|
|
Not really, but it can be fixed size if necessary.
I just want to have horizontal reference same as current vertical header is.
For example – if the first column is an "Index" I want to see this column regardless of horizontal scroll position - for easy reference.
I think Lotus 123 used something like that. I have not found it in Excel – not yet.
|
|
|
|
|
Vaclav_Sal wrote: For example – if the first column is an "Index" I want to see this column regardless of horizontal scroll position - for easy reference.
Understood. I know of no way to do this with a stock control. You might have to resort to two separate controls.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I can't think of any way as such...
But you could always find a solution by changing the problem.
Look at grid controls, either C Maunders classic Grid Control, or the Ultimate Toolbox one.
I found the "Ultimate Toolbox" one a bit of a fiddle to start with, but I think it's more powerful in the end.
(I used the old CGridCtrl before, and have no great need to suffer to change)
Iain.
|
|
|
|
|
It is a good idea - use two controls "married" to each other.
It may even work better allowing any column to be used as a horizontal header. I'll give it a shot. Of course I need it in CListView which may complicate things a little.
Thanks guys and girls!
May 2008 be a good one for all of you.
Vaclav
|
|
|
|
|
I generally use what MSDN calls CRT lowlevel file I/O functions. These are the ones defined in io.h and fcntl.h; open, lseeki64, telli64, close, etc... There doesn't seem to be a function to allocate filespace quickly. For this example I would want to create a 10MB file. If I write 10485760 \0's to the file, it will obviously make the file 10MB - however it is slow (well for LARGE files).
I did experiment by using the following code on winvista 32-bit.
<br />
char c = 0;<br />
int newfile = open("newfile", _O_WRONLY | _O_BINARY | _O_TRUNC | _O_CREAT, _S_IREAD | _S_IWRITE);<br />
lseeki64(newfile, 10485759, SEEK_SET);
write(newfile, &c, 1);
close(newfile);<br />
This seemed to do the trick, and the resulting 10MB file was \0 filled. However, I didn't think you were allowed to seek past the end of a file with lseek. Is this behavior expected to work on all OSs, or will some have an error with the seek? Is there any better way to do it? Basically what I am trying to accomplish is telling the OS that I am going to need X amount of disk space BEFORE I start writing the actual data, without taking up much time. The files are usually around 8GB, but may be even larger than that. My goal is to minimize fragmentation and the possibility of running out of disk space unexpectedly in the middle of writing to the file.
Finally, the contents of the allocated file are unimportant and don't have to be \0 filled (i.e. garbage is ok), but will this way or an alternative guarantee \0 filling?
|
|
|
|
|
The only constraint I see with lseeki64() is that you can't position the offset before the beginning of the file. Another option would be to try SetFilePointer() and SetEndOfFile() ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Would GetDiskFreeSpaceEx or similar do the trick?
I am not sure if your concern about fragmenting the disk is necessary.
Why do you want to second guess the OS? Just my opinion of course.
Vaclav
|
|
|
|
|
Hi Friends
I Am new to this site
i got one problem regarding playback of mpeg compressed files
iam using windows mfc for this
iam receiving the file from the board via tcp protocol and iam storing in the hard disk and then calling decompression function like this
Decompression("filename.M4V");
HERE I WANT DIRECTLY WITHOUT STORING IN THE HARD DISK
IF WE WON'T GIVE EXTENSION TO FILE(LIKE .M4V,.MP4 ETC)IT IS NOT WORKING AT THE FUNCTION guess_format OF AV LIBRARY.
THE DETAILS OF THIS guess_format FUNCTION I DON'T KNOW
while i am storing the file (around 2 mb) in the buffer and calling decompression it is not working.but if you take from hard disk it is working....
pls help me
Girish
|
|
|
|
|
Can you post your code?
I am "guessing" - do you have your data somewhere in memory (buffer) also?
Since I know nothing about M4V file type - is the M4V extension embedded in file header? If not how can your function "guess" the format without the extension?
PS Just the name "guess_format" makes me suspicious. Computers are no good in "guessing".
Vaclav
|
|
|
|
|
|
Got the code and will take a look in the morning.
It is late here - 23:10 !
You may want to delete it from here so you do not get into trouble taking too much space. Just FYI.
Vaclav
|
|
|
|
|
thanks man
iam deleting the code from post
waiting for u r reply
good night
bye
Girish
|
|
|
|
|
hi vaclav
what happen 2 my problem,u got the code na
give me response
Girish
|
|
|
|
|
hi
please give me solution
i am still not able to find the solution
Girish
|
|
|
|
|
Hi all,
I have a problem with Visual c++ 6.0 compiler.
First, I define this template class and these 2 operators:
template <class T>
class mat
{};
template <class T> inline mat<T> operator +(mat<T> m1,T el){return m1;};
inline mat<double> operator -(mat<double> m1,double el){return m1;};
Then, I try to compile these istructions:
mat<double> A,B;
B=A+1;
B=A+1.0;
B=A-1;
The compiler give an error for the first operator if I don't specify the correct type of the right-hand operand; for the second operator there are no problems. Anyone can explain me why there is a difference between the two operators in the implicit casting? Are there a way to avoid this problem?
Thanks in advance!
|
|
|
|
|
Well, I made a test of your code on my VS2005 and a got an additional warning that, IMHO, gives new insight to the argument.
error C2782: 'mat<t> operator +(mat<t>,T)' : template parameter 'T' is ambiguous
It seems that, in the statement B=A+1; , the compiler has to choose between forcing the int to double and the opposite while in the statement B=A-1; there is no alternative to casting int to double (hence specialization turns out to be useful).
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.
[my articles]
|
|
|
|
|
Thank you for the reply! Now I understand the problem, but I prefer that the class works without this type casting. The only solution I have in mind is to write a different version of the operators for each fundamental type (I hoped to avoid that).
|
|
|
|
|
dear all
double a [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
for (int number = 1; number <= 10; number ++)
{
cout << setw(4) << number << endl;
printArray(a);
}
number ++;
from above, i can get 10 3x4 matrix, but they are all same values, so how to do they will be random?
thanks a lot.
by the way, how to brief definition of array a?
thanks
Li Zhiyuan
3/01/2008
|
|
|
|
|
li zhiyuan wrote: from above, i can get 10 3x4 matrix, but they are all same values, so how to do they will be random?
because rand() is evaluated once, and the returned value used to initialise all of the matrix elements.
see David Crow point [^].
li zhiyuan wrote: by the way, how to brief definition of array a?
To solve both problems, to compact source code, assign dynamically the matrix elements, i.e.
for (i=0; i<3; i++)
for (j=0; j<4; j++)
a[i][j] = (double)rand()/RAND_MAX;
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.
[my articles]
modified on Thursday, January 03, 2008 9:18:29 AM
|
|
|
|
|
CPallini wrote: because rand() is evaluated once...
Then why is it being called 12 times?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You're right. With a look at disassembly,I supposed a weird kind of optimization happend, but I was wrong : hence no initialization problem, maybe, in fact, that, as you suppose, his output function has flaws.
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.
[my articles]
|
|
|
|
|
dear all
actually i had finished this case, but i would like to brief this code, so after tried, but couldn't.the orignal code is here, anyone can brief it? thanks..
int main()
{
int number;
double a [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a2 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a3 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a4 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a5 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a6 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a7 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a8 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a9 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
double a10 [3][4] = {{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767},{(double)rand()/32767,(double)rand()/32767,(double)rand()/32767,(double)rand()/32767}};
for (int number = 1; number <= 10; number ++)
{
cout << setw(4) << number << endl;
printArray(a);
}
number ++;
cout << setw(6) << "\na1:" << endl;
printArray(a1);
cout << endl;
cout << setw(6) << "\na2:" << endl;
printArray(a2);
cout << endl;
cout << setw(6) << "\na3:" << endl;
printArray(a3);
cout << endl;
cout << setw(6) << "\na4:" << endl;
printArray(a4);
cout << endl;
cout << setw(6) << "\na5:" << endl;
printArray(a5);
cout << endl;
cout << setw(6) << "\na6:" << endl;
printArray(a6);
cout << endl;
cout << setw(6) << "\na7:" << endl;
printArray(a7);
cout << endl;
cout << setw(6) << "\na8:" << endl;
printArray(a8);
cout << endl;
cout << setw(6) << "\na9:" << endl;
printArray(a9);
cout << endl;
cout << setw(6) << "\na10:" << endl;
printArray(a10);
cout << endl;
return 0;
}
void printArray(double a[3][4])
{
for ( int i =0; i< 3; i++)
{
for (int j = 0; j < 4; j++)
cout <<setw(10) << setprecision(6) << setiosflags(ios::fixed|ios::showpoint) << a[i][j] << setw(10) ;
cout << endl;
}
}
from above code, i can obtain 10 3x4 random real number matrix, but i need to brief it.
thanks a lot in advance
Li Zhiyuan
4/01/2008
|
|
|
|
|
li zhiyuan wrote: anyone can brief it?
double a[3][4];
double a2[3][4];
double a3[3][4];
...
initArray(a);
initArray(a2);
initArray(a3);
...
printArray(a);
printArray(a2);
printArray(a3);
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|