|
yes and this need to put preferablely in stdafx.h or any common header file that is included in all the files so that the project is compiled uniformly or add it to the project settings.
-Prakash
-- modified at 5:46 Monday 9th January, 2006
|
|
|
|
|
_UNICODE for C like wsprintf
UNICODE for Microsoft Function/API
never say die
|
|
|
|
|
Aljechin wrote: Just adding the 'UNICODE' directive is enough?
It's best to define both UNICODE and _UNICODE .
Aljechin wrote: I know I should use all "W" functions...
It might be easier to just use the macros defined in tchar.h like _tcscpy() and _tcslen() .
Aljechin wrote: I know I should...place literal strings within _T.
Correct.
Aljechin wrote: ...but when I pasted unicode text in one edit box of my app, it showed ??? and not the unicode text)...
Did you assign a Unicode font to the edit control?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Sir,
I will tell you in sequence what happened. First I added 'UNICODE' ( in project-settings ). The app was unaware of unicode (displayed ???). I added _UNICODE and suddenly the compiler gave me a bitter error that _WinMain@16 is an unresolved external symbol. I had to give my entry, i.e. entry:"wWinMainCRTStartup". I really dont know why I had to do this, but after this only it compiled, and the program worked with unicode. I did not assign any unicode font also, to the edit control. What is the significance of this "wWinMainCRTStartup"? and is that if i assign a unicode font to the edit control it can still go ahead to be unicode aware without defining _UNICODE and my own entry point "wWinMaainblahblah"?
Thanks and Regards,
Aljechin Alexander
|
|
|
|
|
Aljechin wrote: What is the significance of this "wWinMainCRTStartup"?
It's the entry point for Unicode MFC applications.
Aljechin wrote: ...if i assign a unicode font to the edit control it can still go ahead to be unicode aware without defining _UNICODE and my own entry point "wWinMaainblahblah"?
The best way to answer "What happens if..." questions is to just try it and see.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Is there a way to convert RTF string to plain text?
Putting a string into CRichEditCtrl using Callback StreamIn and then getting it out using CRichEditCtrl::GetWindowText seems overly complicated and doesn't work in my case, since GetWindowText returns null unless you've displayed the string (UpdateData(FALSE)) and it doesn't support unicode (or at least I've been unable to get it working).
Just stripping RTF codes wouln't do since unicode rtf uses some strange character encoding.
If you know how to do it I'd really appreciate. (I think I've read something about coping it into clipboard and then getting plain text, but can't find it..)
Maciej Lisiewski
|
|
|
|
|
Maciej Lisiewski wrote: (I think I've read something about coping it into clipboard and then getting plain text, but can't find it..
Copy it to the Clipboard then get the CF_TEXT(?) format and use that. Should work.
Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com
|
|
|
|
|
Every bit of code I found/wrote in order to put CStringW into clipboard caused program crash (no exception thrown).
.. help?
-- modified at 8:25 Monday 9th January, 2006
|
|
|
|
|
Maciej Lisiewski wrote: Is there a way to convert RTF string to plain text?
After you stream it into the Rich Edit control you can always stream it out.
Reference:
CRichEditCtrl::StreamOut[^]
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
|
|
|
|
|
For some reason it doesn't work.
I'm using this StreamIn/StreamOut:
<code>
static DWORD CALLBACK StreamOut( DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )
{
// Setting up temp buffer
char* buff;
buff = new char[ cb + 1 ];
buff[ cb ] = ( char ) 0;
strncpy( buff, ( LPCSTR ) pbBuff, cb );
int max = strlen( buff );
CString* str = ( CString* ) dwCookie;
#ifdef _UNICODE
// We want to convert the buff to wide chars
int length = ::MultiByteToWideChar( CP_UTF8, 0, buff, max, NULL, 0 );
if( length )
{
TCHAR* wBuff = new TCHAR[ length ];
::MultiByteToWideChar( CP_UTF8, 0, buff, max, wBuff, length );
*str += wBuff;
delete[] wBuff;
}
#else
*str += buff;
#endif
delete[] buff;
*pcb = max;
return 0;
}
static DWORD CALLBACK StreamIn( DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )
{
CString* str = ( ( CString* ) dwCookie );
#ifdef _UNICODE
// Unicode is only supported for SF_TEXT, so we need
// to convert
LPCTSTR ptr = str->GetBuffer( (*str).GetLength() );
int length = ::WideCharToMultiByte( CP_UTF8, 0, ptr, -1, NULL, 0, NULL, NULL );
int max = min( cb, length );
if( length )
{
char* buff = new char[ length ];
::WideCharToMultiByte( CP_UTF8, 0, ptr, -1, buff, length + 1, NULL, NULL );
strncpy( (LPSTR) pbBuff, buff, max );
delete[] buff;
}
str->ReleaseBuffer();
#else
int max = min( cb, (*str).GetLength() );
strncpy( ( LPSTR ) pbBuff, (*str) , max );
#endif
(*str) = (*str).Right( (*str).GetLength() - max );
*pcb = max;
return 0;
}
</code>
If I StreamIn with SF_RTF and StreamOut with SF_TEXT I end up with an empty string or one far too long, but containing the desired data.
-- modified at 8:25 Monday 9th January, 2006
|
|
|
|
|
|
Is it allowed to post soapbox(kind of) material here?
|
|
|
|
|
Hi,
I have a OpenGlView extended from a CView. I then extend from OpenGLView to get e.g. a TexturedSceneOpenGLView.
However when I do this only the OpenGLView is constructed and the OnPaint and other handlers for TexturedSceneOpenGLView are not called.
Does anyone know how I can make this work or offer any alternative suggestions.
Kind Regards,
flip
|
|
|
|
|
I don't understand exactly what your problem is... So you have a OpenGLView class that inherits from CView. Then, you have another class (TexturedSceneOpenGLView) that inherits from OpenGLView ? Is that right ?
And, what is exactly the problem ? Can you post some code ?
|
|
|
|
|
flip wrote: Subclassing CView twice with MFC
I think you are refering to deriving, subclassing in windows has a different meaning.
you said that TexturedSceneOpenGLView's OnPaint event is not called, just wanted to know if you have created an instance of that class and made the view visible?
-Prakash
|
|
|
|
|
can any one help me out
in convert WAV file to VOX,
Thanks in Advance
|
|
|
|
|
I dont know the format of VOX audio, but before you do, you need to get a codec for conversion for doing it programatically.
But if you need a tool, you can search google for any available converter.
-Prakash
|
|
|
|
|
I just voted u a 5 to nullify the 1 vote. I dont know why some moron voted you a 1
Regards,
|
|
|
|
|
Aamir Butt wrote: I just voted u a 5 to nullify the 1 vote. I dont know why some moron voted you a 1
awwwwww, Thanks
-Prakash
|
|
|
|
|
Hello members
Plz suggest me ,how to make the scroll Bar colourfull of a MDI application
I had created this in SDI ,but how to create this in MDI application.
Visual C++ query
Thanks in advance
rohini sharma
|
|
|
|
|
I have a toolbar using CreateWindowEx. How I show the mouse over effect like in MFC ( CToolBar control )
|
|
|
|
|
This style sets hot tracking on.
TBSTYLE_FLAT.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I created an SDI in VC++. When I derive classes from MFC classes they are shown in the class wizard and windows message handlers can be added to those classes. When we again derive from these classes which are derived from the MFC classes, those are not shown in the class wizard classes list. So I m having problem adding windows message handlers to those classes which are at the second level of inheritance.
For eg:
I made a class named CListRs with base MFC class CListView. Then when I take the class wizard I can see CListRs in the class name combo box and is able to add message handlers to it. Now I made another class CMailView derived from CListRs. But it is not seen in the class name combo box of the class wizard. So I m unable to add windows message handlers to this class.
Can anyone please help?
Hoping for a reply
|
|
|
|
|
Try deleteing your *.CLW file and hit Ctrl+W. This will ask for create class view from exisiting file. add all file and create class view.....
|
|
|
|
|
Thanks for the reply. Tried that, but doesnt solve the problem. Now what to do?
|
|
|
|