I'm new to mfc programming, and have a question... hope you can help me
I have a program that make some calculation, the user input some numbers and press a button to start.
When he press the button, the program start the calculations, and shows the results in a Clistbox as it arrives.
The problem is that when I use clistbox.addstring, the results are not automatically show in the clistbox, instead the user have to wait for all calculations to finish to see the results.
What can I do to show the results as soon as it arrives in the clistbox, and continues to do the calculations in the background??
Your UI looks frozen because the message pump is blocked doing calculations. You must do your calculation in a separate thread[^] and post a User defined message[^] to the main window and handle the message to update your list box.
It is a crappy thing, but it's life -^Carlo Pallini
You must do your calculation in a separate thread[^] and post a User defined message[^] to the main window
Just an interesting aside - I ran into this a couple of days ago. Rather than define a custom user message for each individual action that must occur on the UI thread, I tried to do it the .NET way - define a single message, say WM_INVOKE, and pass a pointer to a member function as LPARAM when posting the message (like Control.Invoke). Unfortunately, C++ doesn't allow you to take a pointer to a member function of an instance object directly - you can get a pointer to a member function, but you'll have to track the instance yourself and then when calling, use the esoteric .* operator to invoke it.
I couldn't be bothered to write a separate struct to hold the instance pointer and the function pointer, so I ended up writing multiple user defined messages instead
If I use nmake to create 64 bit what option should I give as command line parameter so that it will create 64bit output
You need to use the correct Visual C++ binaries. Usually you can do that by changing working directory to your VC directory (e.g. c:\Program Files\Microsoft Visual Studio 9.0\VC for VS2008) and using one of these commands:
If you're running 64-bit Windows
If you're running 32-bit Windows
This will put the Visual C++ binaries to create 64-bit code at the head of your path. Entering the command 'cl' should now say something like this - note the for x64:
Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01for x64
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p