|
Maybe i have this problem on another place in the code. The following code is a part of the OnToolTipText function:
#ifndef _UNICODE
if (pNMHDR->code == TTN_NEEDTEXTA)
lstrcpyn(pTTTA->szText, strTipText, 80);
else
_mbstowcsz(pTTTW->szText, strTipText, 80);
#else
if (pNMHDR->code == TTN_NEEDTEXTA)
_wcstombsz(pTTTA->szText, strTipText, 80);
else
lstrcpyn(pTTTW->szText, strTipText, 80);
#endif
This should handle the difference between XP and Win98, right?
But it doesn't. My program works fine in XP, but terminates in Win98.
Does it matter that i develop in vc7 on XP? And then try to run the exe
on Win98? But i think that it should work anyway.
Please, someone, help!!
|
|
|
|
|
Hi - I'm on WinXP using .NET Visual C++.
I am trying to draw unicode characters (phonetic symbols, specifically) to a CWnd using GDI... I dont' think I have to change my app to entirely Unicode to do this (?), but don't know why this doesn't work:
CFont font;
font.CreateFont(20,
0, // width
0, // escapement
0, // orientation
25, // weight
FALSE, // italic
FALSE, // underline
0, // strikeout
0, // char set
0, // out precision
0, // clip precision
0, // quality
0, // pitch and family
"Arial Unicode MS");
int iNumPhonemes = _phonemeList.GetNumPhonemes();
CPoint drawPoint;
CString str(TEXT(""));
memDC.SelectObject(&font);
for(int i = 0; i < iNumPhonemes; i++)
{
str = TEXT("");
WCHAR ipaCode = (WCHAR)_phonemeList[i].ipaCode;
str += WCHAR(ipaCode);
memDC.TextOut(40, 40*i, TEXT(str));
}
... where _phonemeList.ipaCode is just an integer number, the unicode decimal value of the required symbol. It seems to ignore the Unicode part and just print the character corresponding to the bottom byte of the unicode character.
Any ideas?
TIA
alibob
|
|
|
|
|
From the docs:
"The TEXT macro identifies a string as Unicode when the UNICODE is defined during compilation. Otherwise, it identifies a string as an ANSI string."
And since
<code>
BOOL TextOut(
HDC hdc,
int nXStart,
int nYStart,
LPCTSTR lpString,
int cbString
);
</code>
means that
<br />
memDC.TextOut(40, 40*i, TEXT(str));<br />
is not calling TextOutW() unless you define UNICODE.
QED
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
I am using a Com Application in my project and was not able to use methods of the Com Server in a Thread function as I got a COM error always .
It would be helpful if I can get some reference or suggestions regarding this .
|
|
|
|
|
Did you initialize com using AfxOleInit() or ::CoInitialize(NULL); in the thread that you are using COM?
John
|
|
|
|
|
I can invoke COM server functions in my thread by doing this :
#define _WIN32_WINNT 0x0400 in my stdafx.h file.
That works ok.
Now the moment I add an Active X component in my Project (Dialog Application), I get the following in Debug :
Warning: OleInitialize returned scode = RPC_E_CHANGED_MODE ($80010106).
Warning: CreateDlgControls failed during dialog init.
and the App fails to run .
|
|
|
|
|
Boy! Are you in for a ride...
Do a google for some of the following words:
STA
MTA
Apartment
COM Threading Model
You will find tons of information, most of which you HAVE to read
(There is no short explanation to your problem, sorry)
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
We are all aware that by default VC++ implementation of NEW does not throw an exception (as it should based on C++ standards).
MSDN has an article related to using set_new_handler() to make new throw std::bad_alloc when it fails instead of returning NULL.
My question is how is that handled in an MFC app? For instance lets say you have a method named Foo(), and Foo() might throw std::bad_alloc due to it calling new internally. If you called Foo() from an MFC class method you override, and did not have a try/catch, would MFC catch the bad_alloc?
In fact, what impact does it have at all on MFC if you change NEW to throw?
I'm also curious how other developers handle NEW... Do you leave it returning NULL by default? If so, won't that cause problems if you use STL and an STL method calls new and it throws?
|
|
|
|
|
MFC has its own override of operator new that throws a CMemoryException .
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Yep, and that is what happens when MFC calls new and it fails.
But what happens if you call STL or your own funtions from within an MFC function override and your new handler is called throwing bad_alloc?
It appears that MFC wont catch it, you will get an unhandled exception. If you try to recover from it, you might leak MFC resources.
PS: Did this change in VC .NET? Or does new still return NULL?
|
|
|
|
|
I've got a group box on my dialog that shows up as transparent. All controls have transparent UNchecked. Any ideas?
Well, actually, I just fixed it by selecting 'transparent' for the group box. What's the deal with that?
BW
"Gandalf. Yes. That is what they used to call me. Gandalf the Grey. *I* am Gandalf the White."
- Gandalf the White
|
|
|
|
|
i dunno what a transparent groupbox even looks like maybe a picture?
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
The "transparent" setting is a little counterintuitive. You can look up details about it in MSDN under "WS_EX_TRANSPARENT".
One description in MSDN says, WS_EX_TRANSPARENT Specifies that a window created with this style is to be transparent. That is, any windows that are beneath the window are not obscured by the window. A window created with this style receives WM_PAINT messages only after all sibling windows beneath it have been updated.
For example, if you have CStatic text written on a dialog, and it is NOT transparent, then the CStatic control will fill the control's rectangular window with a background color (usually gray) before writing the text. This has the effect of erasing anything that was drawn there previously. If "transparent" is specified, the CStatic control will not fill the control's rectangular region with gray before writing the text. (If I remember correctly - that's how it works.)
So, why is your group box showing up transparent? If it is a custom-designed control, then the developer might've forgotten to actually do the rectangular-area fill before drawing everything else. The dialog won't fill this rectangular region because "it's under the ownership of the group-box" and because it is non-transparent, it is not the dialog's responsibility to fill it.
------------------------------------------
"Isn't it funny how people say they'll never grow up to be their parents, then one day they look in the mirror and they're moving aircraft carriers into the Gulf region?" - The Onion
|
|
|
|
|
This may be a simple question, but is there a way to catch when an MFC application is maximized? It would be great if there is a message or something I could override and add my code to....Thanks!
|
|
|
|
|
WM_SIZE(SIZE_MAXIMIZED, ...
|
|
|
|
|
Exactly what I needed! Thanks!
|
|
|
|
|
I have a point in one of my classes where I need to send the users focus to the next field in the tab order, is there a way I can throw a <tab> keypress, or a way to set focus to the next field in the tab order?
thanks for any suggestions
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
NextDlgCtrl();
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks for the quick responce i was using a CFormView, and it wouldn't let me use it, but i realized my problem was that i was creating my edit fields with WS_READONLY instead of WS_DISABLED.. my program was stopping at uneditable fields and i didnt want it to, didnt realize it was cause it wasnt disabled
ill keep this answer in mind tho, im sure ill need it sooner or later
thanks again!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Hello,
I've searched but have been able to come up with anything on this, so any input would be appreciated
The problem:
When my process is taking care of some lengthy processing, the Applications tab of the Windows Task Manager reports it as "Not Responding", when in reality it is just busy working hard. The problem is that most users confuse this by stating "The process is hung" and try to kill it, etc. They don't realize that ( NotResponding != Dead ) which is probably not their fault, but M$'s for choosing such a term to "label" a busy process.
My question:
Is there any way to programatically control what is displayed here? Or, what would probably be a better solution, send "I'm still alive and working" type messages to the Windows Task Manager so that it doesn't report the process as Not Responding?
Thanks!
--
Edward Livingston
(aka ExtraLean)
--
"I still maintain that seeing a nipple is far less disturbing than seeing someone get their brains blown out." -- Chris Maunder
|
|
|
|
|
The process is too busy in it's main thread for it's message loop to respond to windows. You need to do this work in a worker thread.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hi Christian, long time we didn't fight for a question
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
*grin* I must admit I'd never seen your solution before. Will it make the UI responsive, or only *seem* responsive ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
It'll only fool the Task Manager into thinking the app is responsive, but this is what the guy asked for.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That's fair enough, I was only curious for myself because I'd not seen it before at all, so I wanted to know for my own reference.
Thanks
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|