|
MultiByteToWideChar() is for converting to UTF-16 only.
|
|
|
|
|
Michael Dunn wrote: is for converting to UTF-16 only.
just a ?.... codepage argument take UTF -8 ?.. is MSDN documentation wrong?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
The codepage argument to MultiByteToWideChar() says what the encoding of the MBCS string is. MultiByteToWideChar() converts from that encoding to UTF-16.
|
|
|
|
|
You'll need the text in UTF-16 first, then call WideCharToMultiByte() passing the CP_UTF8 value for the code page.
|
|
|
|
|
Hi,
I tried with that , but could not found the desired result.
In fact the stepa which I followed are as:
1. First I got the characters in the rtf string for a character(say chinese) I typed.
ex:\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fmodern\\fprq6\\fcharset134 SimSun;}}{\\colortbl ;\\red0\\green0\\blue0;}\\viewkind4\\uc1\\pard\\cf1\\lang5124\\f0\\fs20\\'cc\\'d8\\par}"
This is for the character 特
2.Now I convert the character values in to equavalant unicode number, which I got for this is 29305.
3.Now I want to convert this unicode number in to equavalant UTF-8 character.
Can u suggest something with this scenerio .
Regs
Vineet Kumar Singhal
Sr.Software Engineer
Mumbai
Tough Time Never last, but Tough People do.
|
|
|
|
|
LPCWSTR wszUTF16 = L"\x7279";
char szUTF8[16] = {0};
WideCharToMultiByte(CP_UTF8, 0, wszUTF16, -1, szUTF8, 16, NULL, NULL);
|
|
|
|
|
I would like to know how to modify or add a registry setting?
Please help!
|
|
|
|
|
LaHaHa wrote: I would like to know how to modify or add a registry setting?
I would like to know how to use the search[^] feature. Can it find articles related to the words I type in?
Please help!
|
|
|
|
|
U can access the registry settings by
C:\WINNT\system32\regedt32 file where u can view and edit system registry.
|
|
|
|
|
Suresh H wrote: U can access the registry settings by
C:\WINNT\system32\regedt32 file where u can view and edit system registry.
He intends to do it with his program, I believe and not by opening the registry editor!
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
But the person did not tell.. its through the programs right
|
|
|
|
|
Suresh H wrote: But the person did not tell.. its through the programs right
means if the person ask you notepad ( real one) you will provide him virtual one!.. it is obvious that person on programming forum will ask only programming not regedit.exe
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Suresh H wrote: But the person did not tell.
What do I call you? He need not tell it. You need to know it by yourself! This is a programming forum.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Sorry! I mean write a program to do the registry editing!
Please help!
|
|
|
|
|
LaHaHa wrote: Sorry! I mean write a program to do the registry editing!
try CRegKey... it's very simple!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
The following functions would be helpful to deal with the registry.
<br />
RegOpenKeyEx()<br />
RegQueryValueEx()<br />
RegSetValueEx()<br />
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Thank you very much!
I will try it!
|
|
|
|
|
Hi
I want my appication should display menu in japanese. so how to use loadResString for this.
atul
|
|
|
|
|
M. Atul wrote: loadResString
I doubt if there is such a function. May be it exists in VB or something else. You can use the CString::LoadString if you are using MFC.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Dear All,
I want to write an XML file into shared memory.
I have an XML file or variable of MSXML2::IXMLDOMDocument2Ptr has the whole content.
I need to write this content into shared memory variable that is returned by MapViewOfFile API.
How can i do this ?
Kindly Help me.
Thanks.
-- modified at 1:03 Thursday 23rd November, 2006
|
|
|
|
|
Since MapViewOfFile returns a pointer to shared memory:
<code>LPVOID ptr = MapViewOfFile(. . .)</code>,
I think you should use it as the destination in a string-copy operation:
<code>lstrcpyW((LPWSTR)ptr, xml)</code>,
where xml is the XML string to by copied. Probably it can be obtained from your IXMLDOMDocument2 object like this:
<code>_bstr_t xml = myDocument->xml</code>.
I hope this helps.
|
|
|
|
|
I am saving one bitmap in one .bmp file,
but it is in inverted format something wrong i did.
I used two structure in my code BITMAPINFO and BITMAPFILEHEADER and then i write it into .bmp file.
1
PLEASE suggest me..
1>which property shall i change to get non-inverted bitmapformat.
OR
2>How to invert the inverted format which i got.
ABHIJIT
|
|
|
|
|
You say inverted, but do you mean upside down? You could try using positive or negative figures for the bitmap height paramater of BITMAPINFO.
|
|
|
|
|
Thank you,
i will try and reply you!!!
see u.
|
|
|
|
|
Thanks for reply!!!!!!!!!!!
I used this code please tell me any correction....
//This is for getting data from clipboard in CBitmap's object.
OpenClipboard();
Glb=EnumClipboardFormats(0);
HANDLE hBitMap = GetClipboardData(Glb); //getting from clipboard
if(hBitMap == NULL)
{
AfxMessageBox("Error in Capturing Image");
return;
}
//CBitmap * bmp = CBitmap::FromHandle(hBitMap);
CBitmap bmp;
if(!bmp.Attach((HBITMAP)hBitMap))
{
AfxMessageBox( "Error in Loading Image" );
}
BITMAP bitmap ;
bmp.GetBitmap(&bitmap);
int size = ((bitmap.bmWidth)*(bitmap.bmHeight)*(bitmap.bmBitsPixel))/8;
BYTE *lpBits = new BYTE[size];
::GetBitmapBits((HBITMAP)hBitMap,size,lpBits);
WriteBmp("C\\Patient.bmp",&bitmap,(int*)lpBits);
CloseClipboard();
}
For writing ang saving .bmp file.......
void WriteBmp(char* name,BITMAP *bmp,int* data)
{
BITMAPINFO Bmi;
memset(&Bmi,0,sizeof(BITMAPINFO));
Bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
Bmi.bmiHeader.biWidth = (bmp->bmWidth);
Bmi.bmiHeader.biHeight = (bmp->bmHeight);
Bmi.bmiHeader.biPlanes = 1;
Bmi.bmiHeader.biBitCount = bmp->bmBitsPixel;
Bmi.bmiHeader.biCompression = BI_RGB;
Bmi.bmiHeader.biSizeImage = bmp->bmHeight*bmp->bmWidth*bmp->bmBitsPixel/8;
FILE* image = fopen (name,"wb");
if(image==0)
return;
int h = abs(Bmi.bmiHeader.biHeight);
int w = abs(Bmi.bmiHeader.biWidth);
Bmi.bmiHeader.biHeight=h;
Bmi.bmiHeader.biWidth=w;
int sz = Bmi.bmiHeader.biSizeImage;
BITMAPFILEHEADER bfh;
bfh.bfType=('M'<<8)+('B');
bfh.bfOffBits=sizeof(BITMAPFILEHEADER)+ sizeof(BITMAPINFOHEADER);
bfh.bfSize=sz+bfh.bfOffBits;
bfh.bfReserved1=0;
bfh.bfReserved2=0;
fwrite(&bfh,sizeof(bfh),1,image);
fwrite(&Bmi.bmiHeader,sizeof(BITMAPINFOHEADER),1,image);
fwrite(data,sz,1,image);
fclose(image);
}
|
|
|
|