|
Are you sure it is a "mix of ASCII and UCS-2"? That would be very strange. It may be a multibyte encoding, like SHIFT_JIS.
|
|
|
|
|
No, I'm not really sure about anything.
It just seems like that for me. That hex code I pasted is something like ".sph *some japanese*" as clear text.
|
|
|
|
|
To find out if the Japanese characters are really encoded as UCS-2, check that the first two Japanese bytes form a symbol that you actually see on the screen. In your case it would be U+95e7, and this is the correspondingUnicode character[^]. Is that what you see?
On the other hand, if it is Shift_JIS, 0x95e7 would correspond[^] to Unicode 0x6155[^] - is that what you see on the screen? If it turns out to be SHIFT_JIS, just use MultiByteToWideChar to convert it to UTF-16.
|
|
|
|
|
I want to check whether LVS_EX_CHECKBOXES is set as the extended style of a list view. How to check that?
|
|
|
|
|
Let the m_list be the object of the list control.
You get the Extended style of the list control and check it as in the If statement....
m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_CHECKBOXES );
if(m_list.GetExtendedStyle() & LVS_EX_CHECKBOXES)
{
AfxMessageBox("LVS_EX_CHECKBOXES Set");
}
else
{
AfxMessageBox("LVS_EX_CHECKBOXES Not Set");
}
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Hello All,
I have an MFC application. In my application I create an instance of IE, and browse to some link, say "www.Adserver.com".
After hitting to this link, I always receive an image from the "www.Adserver.com", I will get different image everytime I hit this URL.
I need to display this image on one of my dialog in my application, hence I need the handle to URLCacheEntry maintained by window for IE.
To get this handle I can use the function GetUrlCacheEntryInfo( IN LPCSTR lpszUrlName,...); however the input parameter to this function "IN LPCSTR lpszUrlName" is something I need to extract from the running instance of IE, which is displaying this image.
We can assume that always there will be a single image displayed in IE.
Thanks in advance for your replies.
Suyash
|
|
|
|
|
when source pass with null value the len will be 0.
but due to effect of that tempOutFile create the garbage value I need to clear it with null value.
<code>
string Utility::ConvertWCHARToString(LPCWSTR source)
{
try
{
size_t len = wcslen(source) * sizeof(LPCWSTR);
char* tempOutFile= new char[len];
WideCharToMultiByte(CP_ACP,0,source,-1,tempOutFile,(int)len,NULL,NULL);
string s = tempOutFile;
if(tempOutFile)
{
delete[] tempOutFile;
}
return s;
}
catch(exception ex)
{
throw ex;
}
}
I have try to intialize the value explicitly but it didn't work(crash application).
like
if(len==0)
tempOutFile=NULL;
|
|
|
|
|
amitmistry_petlad wrote: char* tempOutFile= new char[len];//tempOutFile=Garbage valve need tempOutFile =""
Modify this to,
char* tempOutFile = NULL;
if (len)
{
tempOutFile = new char[len];
}
|
|
|
|
|
This is for my master
I did it but it gives bad pointer and application crashed!!!
|
|
|
|
|
You are not supposed to use code following , if len in question is 0 .
|
|
|
|
|
yes ,i have do it. I had compare when got NULL then return s="".
|
|
|
|
|
Then, its definitely due to code, you have not shown here. Can you explain, how you are using this function, and where you are facing problem.
|
|
|
|
|
I think you also have a problem here:
size_t len = wcslen(source) * sizeof(LPCWSTR);
wcslen(source) should give you the length you need - but then you are multiplying it by sizeof(LPCWSTR) which is 4 bytes since it's a pointer. That really isn't necessary.
You should then be able to wrap the rest in an if:
if (len > 0)
{
char* tempOutFile= new char[len];
WideCharToMultiByte(CP_ACP,0,source,-1,tempOutFile,(int)len,NULL,NULL);
string s = tempOutFile;
if(tempOutFile)
{
delete[] tempOutFile;
}
return s;
}
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hi friends,
What is the Max limit of the number of bytes copied from Source to Destination in mempcy ??
Thanks in advance.
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
Hi,
The maximum limit is mostly compiler dependent.
It will be the maimum size of "size_t" .
i.e : "size_t" is an alias of "unsigned long" , so the maximum size of "unsigned long" is ULONG_MAX
Note : ULONG_MAX is 4294967295
Regards,
vinsankar
|
|
|
|
|
Vinod A Sankaranarayanan wrote: It will be the maimum size of "size_t" .
that's right
Vinod A Sankaranarayanan wrote: i.e : "size_t" is an alias of "unsigned long"
wrong here. unsigned long is always 4 bytes, even on 64 bits systems; size_t is 8 bytes on 64 bits systems
|
|
|
|
|
toxcct wrote: unsigned long is always 4 bytes, even on 64 bits systems;
Actually, unsigned long is 8 bytes on most 64-bit Unix systems; the Standard does not specify the size of unsigned long
|
|
|
|
|
Nemanja Trifunovic wrote: the Standard does not specify the size of unsigned long
doesn't it ?
AFAIK, only [signed | unsigned] int s weren't specified...
short and long still length to 2 and 4 bytes respectively
|
|
|
|
|
toxcct wrote: doesn't it ?
Nope[^], it pretty much guarantees only minimal sizes for integer types. As I said, on most 64-bit Unix systems, long is 64 bits.
|
|
|
|
|
I always thought it was that way too
Either I was always wrong or the C standard has been changed since I first learned this.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
the game seems to be over for us... let's go back to school ! lol
|
|
|
|
|
|
Thanks everyone..
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
I have a call to WaitForMultipleObjects() which waits for any of 4 events to happen ...but the statements after the call to WaitForMultipleObjects() are not executed.
i am not able to debug and get wat value is returned by the call WaitForMultipleObjects()
thanks in advance
|
|
|
|
|
What does your code look like?
Post the call to WaitForMultipleObjects() and its surroundings and please use <pre> / </pre> tags when posting code.
Are you absolutely sure that WaitForMultipleObjects() is called? Place a breakpoint on it to verify this.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|