Forum: C++ Oct 5th, 2009 |
| Replies: 1 Views: 210 Double check that your implementation of OnCtlColor is returning a handle to the brush you want to set the background colour. |
Forum: C++ Sep 18th, 2009 |
| Replies: 5 Views: 345 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... |
Forum: C++ Sep 18th, 2009 |
| Replies: 4 Views: 600 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 you will enable managed extensions for... |
Forum: C++ Sep 10th, 2009 |
| Replies: 4 Views: 269 If val = 0x11223344 then that expression will 'or' the following
FF000000
3344
223344
11223344
So the top byte is always FF. The bottom byte... |
Forum: C++ Sep 10th, 2009 |
| Replies: 9 Views: 969 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... |
Forum: C++ Sep 3rd, 2009 |
| Replies: 4 Views: 312 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. |
Forum: C++ Aug 19th, 2009 |
| Replies: 10 Views: 438 A 'long' variable in this context is still an integer, not a float, so changing px to long will make no difference.
The most likely explanation, as you suggested, is that px has also been declared... |
Forum: C++ Jul 30th, 2009 |
| Replies: 4 Views: 205 The left hand side of your expression does not compile to a memory address, which is necessary for the assignment to occur.
Set a bit like this:
i |= (1 << index); |
Forum: C++ Jul 28th, 2009 |
| Replies: 4 Views: 273 I would assign aStudent to array element i, i.e. make that:
// read and save the records
for (int i = 0; i < nStudents; i++)
{
if (nStudents < MAX_STUDENTS)
{
.....
... |
Forum: C++ Jul 27th, 2009 |
| Replies: 5 Views: 504 In Win32 it's GetAsyncKeyState() or GetKeyState(). |
Forum: C++ Jul 27th, 2009 |
| Replies: 4 Views: 273 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.... |
Forum: C++ Jul 24th, 2009 |
| Replies: 5 Views: 666 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:-
class Point
{
Point(int x1, int... |
Forum: C++ Jun 17th, 2009 |
| Replies: 7 Views: 437 If you haven't done it, make sure you also change:
WS_CHILDWINDOW || WS_CLIPSIBLINGS ||WS_CLIPCHILDREN
to
WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
Forum: C++ Jun 16th, 2009 |
| Replies: 5 Views: 411 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... |
Forum: C++ May 28th, 2009 |
| Replies: 1 Views: 253 What language is the main app written in? Presumably C++/MFC, so it makes sense to go with MFC for the DLL.
You don't say which version of Visual Studio you are using, but in general to create an... |
Forum: C++ May 24th, 2009 |
| Replies: 3 Views: 617 Well I thought I made it fairly clear in your previous thread TBH.
I do now understand why you were getting crashes with MessageBox() though - you weren't! It wasn't crashing at all, just unable... |
Forum: C++ May 19th, 2009 |
| Replies: 5 Views: 407 So you are presumably getting a handle to an existing named event by using CreateEvent() or similar?
I also presume that the driver level event is first created in a third (driver) process and is... |
Forum: C++ May 18th, 2009 |
| Replies: 5 Views: 407 What is the event() you are waiting for?
Presumably this event is being seen by both processes.
If you are talking about a windows synchronisation event, these can be accessed by more than one... |
Forum: C++ May 12th, 2009 |
| Replies: 3 Views: 255 Sorry, only just seen your previous thread on this topic which makes it clearer that you're using .NET. In that case my earlier post isn't going to be very helpful.
You can use CancelAsync() as... |
Forum: C++ May 12th, 2009 |
| Replies: 3 Views: 255 In main thread:
When you handle the close event send a message to the worker thread requesting termination. Then use WaitForSingleObject() on the worker thread handle to wait for thread termination.... |
Forum: C++ May 8th, 2009 |
| Replies: 6 Views: 305 The OPs code is seeding it.
Though I do wonder about the code the OP used to generate that output. How close was it to the code actually posted? Was srand(time(0)) being called before each rand()... |
Forum: C++ May 8th, 2009 |
| Replies: 10 Views: 364 The key to this is the format of your text file. It's a unicode text file which needs special treatment on input.
So the next question is - have you been provided with this specific file which you... |
Forum: C++ May 7th, 2009 |
| Replies: 8 Views: 618 The timer doesn't work without the paint code in MyTimerFunc() because you don't handle WM_PAINT, so the window is not validated and the high frequency (and priority) of WM_PAINT messages blocks the... |
Forum: C++ May 7th, 2009 |
| Replies: 8 Views: 618 Using BeginPaint() ad-hoc like this isn't recommended. Works sometimes, but isn't reliable. You should only use it in response to WM_PAINT messages.
Your WM_PAINT handler does nothing, so I suggest... |
Forum: C++ May 7th, 2009 |
| Replies: 10 Views: 835 You could try ::GetCurrentDirectory() and see if it behaves differently, though I doubt it.
If you are actually interested in the directory in which the executable is installed, as opposed to the... |
Forum: C++ May 6th, 2009 |
| Replies: 10 Views: 835 Fair enough.
How are you invoking the program? The cwd is not necessarily the directory containing the executable, so if you invoke it in different ways this may affect the cwd path you are given. |
Forum: C++ May 6th, 2009 |
| Replies: 10 Views: 835 I suspect that you are changing the current working directory without realising it. Try experimenting a bit to see what it is you are doing before you call _getcwd() which might be changing it. |
Forum: C++ May 5th, 2009 |
| Replies: 2 Views: 399 As somevar is declared in main() you can't refer to it in build().
You are passing it into build() with the name othervar, so if you replace somevar by othervar in build() you will be able to... |
Forum: C++ Apr 30th, 2009 |
| Replies: 4 Views: 460 The auto_ptr copy constructor (which you are calling each time you return my_player) only allows a non-const parameter because it needs to clear the pointer from the source after moving it to the... |
Forum: C++ Apr 29th, 2009 |
| Replies: 7 Views: 617 L"String" generates a constant string in unicode format, so if you compile for unicode, these strings are what you need for compatibility with the unicode specific functions like TextOutW().
If you... |
Forum: C++ Apr 29th, 2009 |
| Replies: 7 Views: 617 Try changing the "Character Set" property to "not set" instead of multi. |
Forum: C++ Apr 29th, 2009 |
| Replies: 7 Views: 617 As your compiler indicates that you're calling TextOutW(), the unicode version of TextOut(), it appears that you have set an option in your project to compile for unicode (or it was the default). The... |
Forum: C++ Apr 28th, 2009 |
| Replies: 1 Views: 209 There are no language constructs to get the address of an object from the address of a member. Your compiler will manage the memory in the class as it sees fit so unless you want to get down and... |
Forum: C++ Apr 27th, 2009 |
| Replies: 2 Views: 179 I'm not sure why you are considering recursion for this problem. It's not appropriate here.
What about simplifying your algorithm:
int dayNum1 = getDayNumber(date1);
int dayNum2 =... |
Forum: VB.NET Apr 27th, 2009 |
| Replies: 1 Views: 414 You want a control derived from ComboBox which provides auto-completion.
Take a look at this example:
http://www.freevbcode.com/ShowCode.asp?ID=7007 |
Forum: C++ Apr 27th, 2009 |
| Replies: 2 Views: 285 Hard to be specific as you don't say whether you are using .NET, MFC or the Windows Api.
You need to modify the Visibility style of the control to make it disappear/reappear. To make it temporary... |
Forum: C++ Apr 25th, 2009 |
| Replies: 46 Views: 2,317 Useful link, thanks.
So, for the benefit of anyone else who didn't get that code, the point is that resetting p to NULL can be pointless since it is easily circumvented by copying the pointer.
Also... |
Forum: C++ Apr 25th, 2009 |
| Replies: 2 Views: 490 Try calling:
mysql_query(connection, sql.c_str());
sql.c_str() will provide the conversion to const char*. |
Forum: C++ Apr 25th, 2009 |
| Replies: 46 Views: 2,317 Seems a bit hard on the OP. He/she was just asking to be educated. Is that a problem?
As for your code, I hope the OP does get it, but I'm afraid I don't.
Calling delete on p deallocates it and, at... |
Forum: C++ Apr 25th, 2009 |
| Replies: 8 Views: 566 One obvious reason for the error is that 'value' contains a string which, when converted to hex, generates more than 2 digits and a zero terminator. In this case it would exceed your 3 character... |