|
I'm doing a project. It's working fine until it tries to open a file with a Chinese character in its path.
CFileDialog ImportDlg(TRUE,NULL,NULL,OFN_OVERWRITEPROMPT,_T("text Files (*.txt)|*.txt||"));
int iResult=ImportDlg.DoModal();
CString str=ImportDlg.GetPathName();
I think it works if I set the character set to Unicode set. I'm just wondering why it gives me question mark for the Chinese when I switch to MBCS set?
|
|
|
|
|
I guess you a haven't installed support for Asian languages in your OS.
Switching to Unicode should show you the same question marks.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Actually I do installed support for Asian languages, and it does show this Chinese in Unicode set. That's why I'm wondering.
|
|
|
|
|
Ok. In that case you could try to dump the data into a text file and open the text file.
It could be that the characters are not showable by the viewer.
Make sure you write these 3 hex. characters at the begining of the file.
EF BB BF
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Check the thread addressing the similar problem [^]
Since this is a non-Unicode application, you need to make sure that your "Language for non-Unicode programs" is set to Chinese (Simplified) and reboot. It then should work. (If you are on an English os and running a language pack, changing to the language pack does not automatically change the "Language for non-Unicode programs". This is done manually).
To make this change on Vista, see:
http:
IMO, it's better to stick with UNICODE for this kind of complex languages like Japanese and Chinese.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
I have an 3 rd party API that will a fill a buffer of type LPSTR,
This buffer is actually in picture format, i have to convert make this appear in a CStatic control.
what i have:
BYTE pBuffer;
HDC hDC; //HDC handle for the CSttaic Control
API will fill this pBuffer
(LPSTR)pBuffer
I have to make this pBuffer to appear in picture format in CStatic control.
Would apprecaite any help.
|
|
|
|
|
What do you mean with 'in picture format ' ?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
This "pBuffer" i can save it as a Bitmap format like this.....
But i want to draw this pBuffer into a CStatic without converting to Bitmap...
CFile file;
CString strTemp;
char szTemp[MAX_PATH];
char *pDot;
GetModuleFileName(AfxGetInstanceHandle(),szTemp,sizeof(szTemp));
pDot = strrchr(szTemp,'.');
*(pDot+1) = 'B';
*(pDot+2) = 'M';
*(pDot+3) = 'P';
strTemp.Format(szTemp,GetTickCount());
file.Open(strTemp,CFile::modeCreate | CFile::modeWrite);
file.Write(pBuffer,dwSize);
file.Close();
|
|
|
|
|
According to your answer to CPallini, your buffer contains a BMP file. So, wiki[^] should contain all the information you need to access the pixel data. Also look for BITMAPFILEHEADER, BITMAPINFO and such structures in MSDN, these should help too. You could for example use CreateDIBSection[^] to get a HBITMAP from your data and use it to feed it to a picture (static) control or draw it yourself.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hello,
Please any one tell me where i can get message IDs for registered activex controls?
I want to automate MSFlexgrid control or MSdatagrid control using Perl. This requires sending message to those controls. But I could not find any document containing grid control messages. I could get Message ID s of most of the controls (commonly used) in winuser.h and commctrl.h. Thank you in advance.
|
|
|
|
|
ActiveX (i.e. COM ) controls have their own way (i.e. interface methods) to interact with.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I'm Grateful for your concern.How to invoke interfaces externally using Perl?
|
|
|
|
|
I'm not an expert but this page [^] looks promising.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am working on Vista with VS 2005.
In my application, I am handling the WM_POWERBROADCAST message and in the message handlig function, execution some code which i must execute when the system goes to hibernate or standby(sleep) mode.
I find that on Vista, windows doesnot wait for the WM_POWERBROADCAST message handling function to return a value(true or false) before proceeding to entering into sleep mode.
On Vista, the system goes to sleep mode even before the WM_POWERBROADCAST message handling function returns a value. And because of this, my application does not have enough time to execute code in the handler function and results in a crash.
Should Windows go/not go to hibernate/sleep mode depending on the return value of the WM_POWERBROADCAST handling function?[MSDN Link]
|
|
|
|
|
The following is from the documentation -
To prevent the system from transitioning to a low-power state in Windows Vista, an application must call SetThreadExecutionState to inform the system that it is in use.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I tried calling the SetThreadExecutionState() function in the OnInitDialog() of an sample dialog based applicaiton with various combinations of flags ES_CONTINUOUS ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED, but to no avail.
Could you please tell me as to which flag is to be used with SetThreadExecutionState()?
|
|
|
|
|
I guess you have to call SetThreadExecutionState inside the WM_POWERBROADCAST handler.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Tried adding the SetThreadExecutionState() funciton in the WM_POWERBROADCAST handling funciton but to no avail.
|
|
|
|
|
sometimes I can get a handle of a windows easily,but I need a pointer of the window object,how can i do this?
thanks in advance!
|
|
|
|
|
You can attach the handle to a newly created object.
CWnd* pNewWnd = CWnd::FromHandle(hWnd);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
first i created a window object,then i get the handle of the object, after that i send the handle to another function,if i attach the handle to a new object,does it mean i have two identical object ?
|
|
|
|
|
You will then have 2 objects that work on the same window handle.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
is there any way to retrive the original object?
|
|
|
|
|
Both objects are independent.
They only works on the same window handle.
So you will have to keep the reference yourself.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|