|
When you're at your first breakpoint, go to Debug/Exceptions. Scroll down to the last exception, select it, and click on "Stop always", then OK. This tells the debugger to break when the app throws a C++ exception (which is what a first chance exception is). Continue on to the next breakpoint and the debugger should stop as soon as the exception occurs.
You can also do this for other types of exception, such as Access Violations and Stack Overflows.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
I did what you said, and though it stopped in diassembly (or is it assembly? , I looked at the call stack and figured out the problem. It was soooo instructive. I thank you!!!
Appreciate your help,
ns
|
|
|
|
|
Thanks for your appreciation.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
How do I use "bit masking" to set individual bits in a word?
i.e. if I have:
0x00F0 = 0000 0000 1111 0000
and I want:
0000 0010 1111 0000 = 0x02F0
-
|- set only bit 9
What is the trick?
Thanx!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
One possiblility:
WORD w = 0x00F0 | 0x0200;
Thus all you want to keep is set to 0, the rest gets an 1.
If you want to clear bits instead of setting them, use the & operator instead of the | and set everything to 0 you want to get cleared.
|
|
|
|
|
To set particular sets of bits of data, you need to OR it to the target. So, in your example to set bit 9 = 0x200, you need to OR this with 0xF0:
0x200 OR 0xF0 = 0x2F0 .
have a look at the excellent article:
http://www.codeproject.com/cpp/bitbashing.asp[^]
for more info.
|
|
|
|
|
RChin wrote:
have a look at the excellent article:
http://www.codeproject.com/cpp/bitbashing.asp[^]
Ahh yes... just what the doctor ordered!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Nitron wrote:
just what the doctor ordered!
A Doctor ordered you to learn about bit masking
Regards,
Brian Dela
Run naked in the snow until you're sweating like a stuck pig and can't seem to catch your breath. When the flu becomes pneumonia, they can cure that with a shot. - Roger Wright
|
|
|
|
|
Brian Delahunty wrote:
A Doctor ordered you to learn about bit masking
um... Are you telling me your's hasn't?!?!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
The usual way is to do a bitwise "OR" of just the bit you want to set, which is 0x0200:
short result = 0x00F0 | 0x0200;
Notice that in this case "or"ing the values is equivalent to adding them together:
Binary Hex Dec
---------------------------------------
0000 0000 1111 0000 0x00F0 240
+ 0000 0010 0000 0000 0x0200 512
= 0000 0010 1111 0000 0x02F0 752
Then to check if the bit is set, you do a bitwise "AND":
bool bitIsSet = (result & 0x0200) != 0;
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
thanks all! I figured it must be easy to do...
I don't get to deal with it all that often, and I usually find myself doing it by hand!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Hi
Quick question - am I comparing like for like if I do the following in a CEdit derived class? I am trying to determine whether or not the text will be completely visible when placed in the edit control. This code indicates that the text will not be completely visible, even though it quite clearly is!
void CMyEdit::DoSomething(const CString & strText)<br />
{<br />
CRect rectText;<br />
GetClientRect(rectText);<br />
<br />
CDC * pDC = GetDC();<br />
<br />
CSize sizeExtent = pDC->GetTextExtent(strText);<br />
<br />
if (sizeExtent.cx > rectText.Width())
{<br />
}<br />
<br />
ReleaseDC(pDC);<br />
}
Thanks in advance!
|
|
|
|
|
I just did a quick lookup on the GetTextExtent function and noticed that there's another one called GetOutputTextExtent, which may be the one you need.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
When you call GetDC() you get a DC with a default font in it. This will (most probably) not be the font being used by the edit control. You need to use that font when measuring your text. Check the result of a call to CEdit::GetFont().
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Thanks for that - calling CEdit::GetFont() and passing the result to CDC::SelectObject() before doing the comparison worked a treat!
|
|
|
|
|
I am a rookie in the MFC game , and am having some awful problems in creating a Popup window. From the parent windows OnCreate i try to create the popupwindow with createEx(...). Have tried all combinations (also excluding WS_CHILD) but nothing seems to work. I receive an assert error upon launch. If I keep the window simple (WS_CHILD), no problemo. I cannot seem to find any documentation on the subject. Can anyone HELP ME.
Thanks
|
|
|
|
|
Can you say what is your assertion failor? which source file and line?
A. Riazi
|
|
|
|
|
we need to migrate a huge project overseas - or to other OS.
the project works fine on pure english OS, but crashes on other OS which use different languages, i.e. Italian and Chinese windows.
we don't need to modify the project at all because people there know english - but it crashes there.
it is too hard to find why in the moment.
any experience, hint or comment to fix the problem is useful, thx in advance.
includeh10
|
|
|
|
|
Well, is it just not starting, or do you need to do something special, like entering a special character etc?
All of my programs, developed with english OS wrk great on german windows. they even tolerate the umlauts.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Is your project use OS resources (any strings, bitmaps, icons, ...)?
A. Riazi
|
|
|
|
|
yes, many.
bitmap, menu (which uses string), icon ...
is this possible reason?
includeh10
|
|
|
|
|
If program wants to load string (or any other resources) from resource but not found it, program will be crashed.
A. Riazi
|
|
|
|
|
If I were to press the "Print Screen" key on my keyboard, and capture whatever screen image my monitor might be showing, does window assign a filename to that screen image for later use?
Normally, that image would go to the clipboard from which you can 'Paste' it on to another screen to get the image. However, not all applications have the 'Paste' icon available (or the means for it to be used).
What I need to do, is capture a screen image, compress it, and send it as an attachment in an email message.
Thanks for any help. I appreciate it.
William
|
|
|
|
|
*print screen*
-->Open MS Paint
*paste*
*crop* (if necessary) [aside] You can use alt + print screen to capture the current window. [/aside]
File-->save as:
Select jpg format if you don't have a compression utility like win zip. Or you can choose bmp and zip it afterwards.
*attach file to e-mail*
*send*
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Also you can press Alt+Print Screen to capture "Active Window".
use paint to paste bitmap!
A. Riazi
|
|
|
|