|
Hi David,
c:\my documents\my long directory\my file.doc was a simple example that gets an abreviated path of
c:\my documents\...my file.doc. Thererefore c:\my documents\... is the abbreviated path of c:\my documents\my long directory\.
Daniel
|
|
|
|
|
I understood all that. My question was where is this path shown?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Ok - sorry the path is shown at the bottom of the File Menu where it usually shows the most recently used files.
|
|
|
|
|
It does that so you don't end up with menus across the screen.
To override this you'll need to search for OnInitMenu in the MFC sources. Good luck, it gets quite knotty down there...
Iain.
|
|
|
|
|
thanks for the suggestion Iain. It does indeed get quite knotty down there.
For now, I have a simple workaround of setting the CRecentFileList's member variable m_nMaxDisplayLength to show longer length filenames and paths,
Cheers,
Daniel
|
|
|
|
|
hi all
I have a LPWSTR variable and want to copy it's contents to std::string variable is it possible?
if yes how ?
thanks.
-- modified at 15:32 Tuesday 18th April, 2006
|
|
|
|
|
As I remember, std:string is for char *s, so you need to convert from unicode.
std::string Conv (LPWSTR szWide)
{
USES_CONVERSION;
std::string s;
s = W2A(szWide);
return s;
}
or use std::wstring instead. unicode has its place!
Iain.
|
|
|
|
|
one line way:
WideCharToMultiByte( CP_ACP, 0, lpWideCharStr, -1, (LPSTR) sShare.c_str(), BUFFER_SIZE, NULL, NULL );
-----------
Mila
|
|
|
|
|
I have a Application in form "Dialog".
on that there are some control like :
"Static", "Edit", "Rich Edit"...
When i click left mouse on that, then press return
("Enter" key on keyboard) and the Application disappear
as if i click "Close".
What's happened ?
Why ???
Could you help me ???
|
|
|
|
|
See this post[^]. Seems like everybody has the same problem, today .
~RaGE();
|
|
|
|
|
|
Hi
I found in some postings the data types "BYTE" and "DWORD". Can someone tell me in what library they can be found if any?
Another question, the posting says BYTE b=50; but if we have a stream of binary digits in a file, is there an easy command to input every 32 (or k bits in general) into a variable for further processing or will i have to use a pointer and keep track of the number of bits already inputed and convert it step by step to a decimal integer (by adding 2^m each time...)?
Thanks
|
|
|
|
|
A BYTE is an unsigned 8bit value.
A DWORD is an unsigned 32bit value.
Should be defined in <windows.h>
CPP911 wrote: Another question, the posting says BYTE b=50; but if we have a stream of binary digits in a file, is there an easy command to input every 32 (or k bits in general) into a variable for further processing or will i have to use a pointer and keep track of the number of bits already inputed and convert it step by step to a decimal integer (by adding 2^m each time...)?
fread ?
CFile::Read ?
~RaGE();
|
|
|
|
|
CPP911 wrote: I found in some postings the data types "BYTE" and "DWORD". Can someone tell me in what library they can be found if any?
You can find them in windef.h .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
They are defined in <windef.h> but you only need to include <windows.h> if you want to use them as it includes <windef.h>.
Steve
|
|
|
|
|
Hi all,
I have found myself totaly confused yet again. I need to convert a 32bit int to a double. Well the docs say "an IEEE 754 floating-point value (64bit double precision). It then goes on to demonstarte the before and after (without any code).
0x3FF00000 -> (Decoded value) 0x3FF0000000000000 -> (Result) 1.0 'decimal'
I have managed to find some examples on the net, but unfortunatly none of them are in C/C++. Here is a C# method:
double ToDouble(int n){
byte[] doubleBytes = new byte[8];
byte[] uintBytes = BitConverter.GetBytes(n);
Array.Copy(uintBytes, 0, doubleBytes, doubleBytes.Length - uintBytes.Length, uintBytes.Length);
return BitConverter.ToDouble(doubleBytes, 0);
} I hope somebody can help me with the answer, I am totaly stuck. Thankyou.
|
|
|
|
|
OK, so the naive dumb question first : Why is this not working :
int i=3;
double d=(double)i;
~RaGE();
|
|
|
|
|
When I apply that to the given example 0x3FF00000, instead of getting 1.0 I get back 1072693248.0000000. Which is well away from what I want.
|
|
|
|
|
Sorry, I must miss something:
3FF00000(hex) = 1072693248(dec), so why should 3FF00000(hex) be equal to 1.0 ?
~RaGE();
|
|
|
|
|
Thats exactly why I am so confused. The 32bit int value comes from a byte array, and it is supposed to represent a number. There is a flag which indicates whether the int is an int or a float. I can convert the int, but I am totally lost while trying to convert to a float.
An RK value is an encoded integer or floating-point value.
RK values have a size of 4 bytes and are used to decrease file size for floating-point values.
If bit 1 is cleared, the encoded value represents the 30 most significant bits of an IEEE 754
floating-pointvalue (64-bit double precision). The 34 least significant bits must be set
to zero. If bit 1 is set, the encoded valuerepresents a signed 30-bit integervalue. To get
the correct integer,the encoded value has to beshifted right arithmeticaly by 2 bits. If bit0
is set, the decoded value(both integer and floating-point)must be divided by 100 to get thefinal
result. I am able to convert the value to an integer, but this text just doesn't explain enough for me.
-- modified at 15:32 Tuesday 18th April, 2006
|
|
|
|
|
Here is a very non optimal way (the shift can be replaced with a copy):
Take the 32bit # and mask off the lowest two bits. Then store it in a 64 bit integer __int64. Then left shift the integer by 32 bits. Then declare a double* and give it the address of the integer. Then declare a double and set it to the value that the double* (above) points to. Now if bit 0 of the first # is 1 divide the double by 100...
int code;
__int64 temp=(code & 0xFFFFFFFD);
temp << 32;
double* pFloat = (double *)temp;
double ans = *pFloat;
if (code & 1) ans /= 100.0;
John
-- modified at 16:20 Tuesday 18th April, 2006
|
|
|
|
|
Thankyou John,
Your suggestion worked a treat.
rk <<= 2;
__int64 *buf = new __int64;
*buf = rk;
*buf <<= 32;
double* dub = (double *)buf;
val = *dub;
|
|
|
|
|
Please check my code again as I have updated it because I forgot the last rule about dividing by 100.
John
|
|
|
|
|
You wouldn't beleive it, but it has taken me nearly all day to get this one little function working correctly. I just hope it will all be worth the effort.
Thanks again.
|
|
|
|
|
Your welcome, glad I could help...
John
|
|
|
|