Posts
 
Reputation
Joined
Last Seen
Ranked #403
Strength to Increase Rep
+8
Strength to Decrease Rep
-2
100% Quality Score
Upvotes Received
11
Posts with Upvotes
11
Upvoting Members
11
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
9 Commented Posts
0 Endorsements
Ranked #396
~43.5K People Reached
Favorite Forums
Favorite Tags
Member Avatar for daviddoria

The important difference with assert() is that it doesn't affect production (release build) code. So all those checks don't affect performance, and as the code is debugged by then, you don't need them right? (yeah right). For debugging I find assert() much better than exit(0) as it leaves the debugger …

Member Avatar for vibhor48
0
280
Member Avatar for Kadence

[QUOTE=Kadence;931160] I also couldn't find any references or docs online for GetAKeySyncState(), and when I try to compile (after including windows.h) on my Windows machine I get[/QUOTE] In Win32 it's GetAsyncKeyState() or GetKeyState().

Member Avatar for mtbfreak
0
2K
Member Avatar for malvi

I'm not sure I understand it either, but I don't think it's win32 because MFC is in the title, and I don't think the problem is one of adding error checking, rather it's to remove it. If you don't want to see an error message when the input is invalid …

Member Avatar for MrSpigot
0
170
Member Avatar for zentropy

More info will be required for a response. What environment are you working in - Unix,PC,.Net,MFC etc.

Member Avatar for Ketsuekiame
0
333
Member Avatar for madmax007

I think you should check out the [URL="http://sourcemaking.com/design_patterns/command"]Command pattern[/URL]. In your case this means adding an Execute() method to your BaseEvent class. In the derived event classes you will code the Execute() method to call a virtual method in the Module class. You send the Event (Command) to a Module …

Member Avatar for madmax007
0
163
Member Avatar for atticusr5

I've barely glanced at that code but stack overflow in a binary tree application is likely to be a recursion error. i.e. one of your methods is calling itself (which is fine) but the exit condition which stops it calling itself is never being reached. See if you can find …

Member Avatar for mattjbond
0
1K
Member Avatar for Tellalca

myStack:top and myStack:push take a Stack_entry argument, not a char which you are calling them with. Given that Stack_entry is typedefed to char that links fine in my VS2005 environment, but VS2008 may have tightened up on that. Try calling those methods with true Stack_entry types.

Member Avatar for Tellalca
0
168
Member Avatar for gnarlyskim

Without seeing the rest of this class (e.g. constructor/destructor) it's not possible to give a full answer to your problem. However, explicitly calling destructors on your local variables is a bad idea. The destructor will be called again when it goes out of scope. The point at which it crashes …

Member Avatar for gnarlyskim
0
125
Member Avatar for kevintse

[QUOTE=kevintse;1187626] I just have no idea why Bjarne Stroustrup states that "In particular, declaring data members protected is usually a design error.". [/QUOTE] I think you do - he tells you his exact reasons in the extract you quoted. You could have a number of derived classes in your application …

Member Avatar for kevintse
0
1K
Member Avatar for Monster Killer

A bit more info may be required. Are you using MFC or .NET with C++? If MFC, are you using CTabCtrl? I've no idea what level you're at but in simple terms you create a button click handler, inside which you: - query the tab control to find out the …

Member Avatar for Monster Killer
0
131
Member Avatar for fadia

You're right to stop where you are until you've sorted out the design. This approach you've taken so far is going to be painful. So, think about inheritance. Do your classes pass the basic test - i.e. PassengerMenu 'is a' MainMenu? No they don't. Your MainMenu is a specific menu …

Member Avatar for fadia
0
165
Member Avatar for sam1

Narue's reply from the C++ forum is still applicable. i.e. the text property returns a string so you need to convert it to an integer before the compare.

Member Avatar for MrSpigot
0
2K
Member Avatar for Mitja Bonca

There's no simple property on the ListView which will give that functionality. It would probably be easier to use the DGV but if you really don't want to do that, you could enhance the ListView to get the behaviour you're after. 1. You would have to detect mouse clicks on …

Member Avatar for MrSpigot
0
140
Member Avatar for gehring

I've always found AfxExtractSubString() to be useful for that kind of thing. Not a particularly well documented function but it's there and it works. [CODE=cpp] BOOL AFXAPI AfxExtractSubString ( CString& rString, LPCTSTR lpszFullString, int iSubString, TCHAR chSep = '\n' );[/CODE] e.g. set lpszFullString to "Condition1|condition2|Condition3", set chSep to '|' set …

Member Avatar for MrSpigot
0
126
Member Avatar for bobsta

As the compiler tells you, your problem is that the return statement in rotationX is creating a temporary fourMatrix value for which you are trying to return a reference. Returning a reference to a temporary variable is meaningless since it will refer to nothing when the method is complete. Your …

Member Avatar for MrSpigot
0
97
Member Avatar for yoshi14

So, just to clarify, the compiler indicates that DoubleMonsters is not declared? Can you post the class definition for DoubleMonsters?

Member Avatar for yoshi14
0
138
Member Avatar for hajiakhundov

It looks like you're using managed C++, so try using: [CODE]using namespace System::Threading; Thread::Sleep(1000);[/CODE] I'm surprised that you find plain old Sleep() available, so perhaps you're picking up an odd version of Sleep from somewhere in your codebase.

Member Avatar for hajiakhundov
0
134
Member Avatar for loolyn

Double check that your implementation of OnCtlColor is returning a handle to the brush you want to set the background colour.

Member Avatar for MrSpigot
0
80
Member Avatar for shizu

Did you override OnInitDialog() in your dialog? If so, try simplifying it or step through it. A serious error here could reset the WF_CONTINUEMODAL flag and cause the dialog to exit.

Member Avatar for shizu
0
481
Member Avatar for AceiferMaximus

[QUOTE=AceiferMaximus;989032]Is it possible to call a .dll I made in C#, and use it in my unmanaged C++ code? [/QUOTE] It's certainly possible, though you may want to go via some managed C++ to get there. By compiling some of the modules in your C++ project with the /clr switch …

Member Avatar for AceiferMaximus
1
2K
Member Avatar for dpreznik

Frederick2 may well be right, though I would also look at more basic issues. Getting an hour glass cursor using MFC is generally a simple case of declaring: CWaitCursor myWaitCursor; inside a method. The wait cursor is then displayed for the duration of that method. It is removed when the …

Member Avatar for dpreznik
0
537
Member Avatar for kz07

To test the string for non-numerics - loop through the string and call standard library function isdigit() on each character. To convert to the array - loop through the (numeric) string, for each character subtract '0' and put the result in the corresponding element of the array.

Member Avatar for kz07
0
5K
Member Avatar for rmeltg

If val = 0x11223344 then that expression will 'or' the following [CODE] FF000000 3344 223344 11223344 [/CODE] So the top byte is always FF. The bottom byte is always the bottom byte of val and the 2 middle bytes are an 'or'ed set of some of the val bytes. That's …

Member Avatar for rmeltg
0
105
Member Avatar for mcco1

[QUOTE=JasonHippy;952634]What about if you change px from int to long? Does that give you any differemt results? The thing to take note of here is that px is currently declared as an int. Whereas rect.right and rect.left are both LONG/long variables. Therefore if the result of your calculation is less …

Member Avatar for JasonHippy
0
137
Member Avatar for slatk3y

[QUOTE=slatk3y;934064]ok, so that make sense. Thanks. I have another question now. I am trying to set a bit in unsigned, that is what I am doing: [code=C++] #include <iostream> using namespace std; int main(){ unsigned i = 0; unsigned index = 1; i >> (31 - index) |= 1; } …

Member Avatar for slatk3y
0
132
Member Avatar for xiikryssiix

If you don't want to end the loop on a sentinel, what about asking the user for a student count before you get the student record data. Remember to check that it's less than the size of your array. Then change your loop so that it's based on your count.

Member Avatar for MrSpigot
0
110
Member Avatar for crazyboy

[QUOTE=niek_e;928090]Although Adatapost's solution will compile and work, there's no reason why you should use this (ever).[/QUOTE] Well Adatapost's specific example doesn't achieve much but there's still a reason to do that. e.g. in constructing a temporary object to pass to a function:- [CODE=c++] class Point { Point(int x1, int y1){x …

Member Avatar for crazyboy
0
737
Member Avatar for newToC

If you haven't done it, make sure you also change: WS_CHILDWINDOW || WS_CLIPSIBLINGS ||WS_CLIPCHILDREN to WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN

Member Avatar for newToC
0
170
Member Avatar for llemes4011

int dummyArray[size] declares an array of a fixed size. 'size' must be a constant known at compile time. e.g. int dummyArray[5] would work as the compiler knows how much space to allocate. So your way out of this is: 1. Declare an array large enough to handle your largest expected …

Member Avatar for Narue
0
96
Member Avatar for blahblah619

If you're just counting down from 10 to 0 I'm not exactly sure why you've used 2 loops. Surely a single loop would do the job. I do notice that the inner loop won't terminate because your condition (units < 10) is incorrect. units is counting down and will always …

Member Avatar for siddhant3s
0
227