Click here to Skip to main content
15,073,069 members

Comments by Alain Rist (Top 98 by date)

Alain Rist 4-Jul-11 11:28am View
Never send or post a WM_PAINT message, use Invalidate().
Alain Rist 29-Jun-11 5:13am View
The sample pchangers does not include all possible cases. If your character is not in the map add it there, it should work. cheers
Alain Rist 29-Jun-11 5:12am View
The sample pchangers does not include all possible cases. If your character is not in the map add it there, it should work. cheers
Alain Rist 1-Jun-11 12:05pm View
The edit control text length has nothing to do with CString. See my edited answer.
Alain Rist 23-May-11 11:33am View
You are totally right, the problem is on comparison, see my edited answer. cheers,
Alain Rist 10-May-11 15:13pm View
Some pupils of mine might have it one day :)
Alain Rist 26-Mar-11 3:46am View
You were quicker :)
Alain Rist 20-Mar-11 18:43pm View
Considering the level of the OP the first step is: Hands up your keyboard, scratch your head and THINK :) That's my answer intent.
Alain Rist 17-Mar-11 5:27am View
See my edited answer, not really for total beginner :)
Alain Rist 16-Mar-11 16:33pm View
I never used MFC on WinCe devices so I am not able to answer your question. My suggestion is to only have UNICODE text files on your device.
cheers, AR
Alain Rist 15-Mar-11 3:38am View
There is no A, B, C or D in your posted code.
Alain Rist 7-Mar-11 12:08pm View
With move semantics swap does no copy in this case.
Alain Rist 7-Mar-11 11:02am View
See my answer :)
Alain Rist 7-Mar-11 10:15am View
float values[100] = { 5.0f };" initializes values[0] to 5.0, and all others with the float 'default initializer' ie 0.f, strange to teach that to you ;)
Alain Rist 7-Mar-11 10:11am View
See, or or any C++ tutorial. BTW I never used C# :)
Alain Rist 7-Mar-11 10:01am View
[only the 2 first elements will be initialized!] is not true. If there are fewer items in the initializer list than elements in the array, the default constructor is used for the remaining elements. So float fvariable[100] = {0}; initializes the 100 values to 0.0f.
Alain Rist 5-Mar-11 3:34am View
Edited second link to point to the correct answer.
Alain Rist 4-Mar-11 4:14am View
[using std::string literally means to copy the argv constant C strings on the process stack into the (dynamically allocated) memory of the std::string variables]
This is not true with modern compilers implementing the move semantics, VC2010 and ggc 4.5 by now. cheers, AR
Alain Rist 4-Mar-11 4:05am View
Yes, needs an adaptor, see my update. cheers.
Alain Rist 24-Feb-11 5:08am View
Code should be more appealing now :)
Alain Rist 24-Feb-11 4:07am View
Thanks, I will try to make it look nicer :)
Alain Rist 22-Feb-11 9:51am View
Right, corrected :)
Alain Rist 4-Feb-11 2:39am View
Which compiler, Win SDK version, WTL version, OS with the problem?
Alain Rist 4-Feb-11 2:37am View
There is no CFrameWnd and no PreCreateWindow in WTL :(
Alain Rist 14-Jan-11 15:52pm View
int* buffer = (int*) a_valid_address; :)
Alain Rist 29-Dec-10 10:26am View
Sorry, I didn't feel cryptic :)
Alain Rist 29-Dec-10 2:41am View
The question is tagged C++ so your answer is irrelevant, even if efficient.
Alain Rist 29-Dec-10 2:27am View
What is the difference with the answer I gave one month ago?
Alain Rist 28-Dec-10 3:05am View
See my edited answer handling input beginning with a non-digit.
Alain Rist 28-Dec-10 3:02am View
Code edited to handle input beginning with a non-digit :)
Alain Rist 18-Dec-10 12:08pm View
Reason for my vote of 5
Good answer.
Alain Rist 15-Dec-10 4:22am View :)
Alain Rist 14-Dec-10 6:47am View
C++ is not C :)
Alain Rist 9-Dec-10 12:39pm View
Verum :)
Alain Rist 8-Dec-10 11:36am View
These kind of questions help me convert old snippets to C++0x, with the pleasure of code improvement :)
Alain Rist 7-Dec-10 16:54pm View
Alain Rist 6-Dec-10 5:18am View
Added MFC tag.
Alain Rist 2-Dec-10 2:35am View
What are the signatures of dll_callA() and dll_callB()?
Alain Rist 30-Nov-10 14:18pm View
Repost of
Alain Rist 30-Nov-10 2:06am View
There is no difference regarding your question, mouse and painting handling.
Alain Rist 29-Nov-10 9:32am View
Repost of
Alain Rist 25-Nov-10 2:07am View
As I told you in my answer first sentence, set your compiler warning level to maximum (for MSVC /W4 in Project->Settings->C++), compile and address all warnings.
Alain Rist 24-Nov-10 10:17am View
I am not sure the third compiles without error or at least WARNING.
const tClassOneVect& data = MyInstance; should work and call my answer's second construct (if exists) :)
Alain Rist 24-Nov-10 9:28am View
Code formatting
Alain Rist 24-Nov-10 9:27am View
Tried code formatting and visibly failed :(
Alain Rist 24-Nov-10 9:16am View
I mean write your code so that the warning does not occur
Alain Rist 23-Nov-10 9:49am View
Simpler indeed :) and safer as well :)
Alain Rist 23-Nov-10 3:19am View
Changed C++ tag to C++/CLI
Alain Rist 22-Nov-10 15:47pm View
DINT is not a standard C++ type, it is probably defined somewhere you have access, otherwise you could not use it. Please provide the type definition. cheers,
Alain Rist 18-Nov-10 3:12am View
You are being kidded, ask for serious work :)
Alain Rist 18-Nov-10 1:55am View
Do not answer to yourself, comment an answer so that the author is notified.
Alain Rist 18-Nov-10 1:54am View
From OP: Tank you but I wrote the code and named it like you said but it does not work. can you tell me why??
Alain Rist 16-Nov-10 13:17pm View
I edited my answser to address your objection. evviva :)
Alain Rist 16-Nov-10 2:46am View
No more confusion between 'char' and 'string', better indeed :)
Alain Rist 15-Nov-10 11:47am View
At least change string to char in your arrays, as is it does not compile and is very confusing
Alain Rist 13-Nov-10 7:23am View
There is no need to 'decode' NMEA data, as they are already ASCII characters. First study the article, then change some parts (for instance replace MFC CString by standard C++ std::string). And ahead :)
Alain Rist 13-Nov-10 3:41am View
How do you define and initialize buffRead?
Alain Rist 12-Nov-10 10:21am View
ceil(-4.99) == -4. :(
Alain Rist 12-Nov-10 2:15am View
Works only for positive values: 4.99 -> 5.49 -> 5 OK, -4.99 -> -4.49 -> -4 BAD
Alain Rist 12-Nov-10 1:52am View
It is not requested by the OP, and I am lazy :) Thanks and cheers
Alain Rist 10-Nov-10 4:34am View
#include <limits> const double eps = std::numeric_limits<double>::epsilon(); :)
Alain Rist 7-Nov-10 15:30pm View
Google "Windows PATH" and "Windows execution environment" and have the answers translated to Italian :)
Alain Rist 7-Nov-10 14:14pm View
Removed C++ tag , added C++/CLI
Alain Rist 1-Nov-10 2:38am View
With this new code the whole discussion under is not understandable. Please revert to prior text and ask a new question.
Alain Rist 31-Oct-10 12:05pm View
Comment the offending parts from bottom to top. When you have a compiling code uncomment one part at time from top to bottom. Use the maximum warning level for your compiler. Don't insert new code as long as your compiler warns. Yes writing code is a painful work :)
Alain Rist 31-Oct-10 11:16am View
See my edited answer
Alain Rist 31-Oct-10 2:55am View
Code formatting
Alain Rist 20-Oct-10 7:25am View
All that is up to you, and if relevant your manager :)
Alain Rist 18-Oct-10 3:08am View
The archive classes are built on std::iostream. The current library does not know C++0x shared_ptr, but the source for serializing boost::shared_ptr is not difficult to transpose to a custom std::shared_ptr serialization. IMHO using Boost Serialization should be simpler and easier to maintain than a home cooked solution, with not much more initial investment. Up to you anyhow :)
Alain Rist 16-Oct-10 5:19am View
Did you consider the boost Serialization library ?
Alain Rist 11-Oct-10 9:31am View
Edit your initial post with a precise indication of where and how the instructions in the link I gave you fail.
Alain Rist 11-Oct-10 4:09am View
I don't get you :(
You don't create the setup for Redistributable Package you download it and run it on your target machine.
Alain Rist 10-Oct-10 6:48am View
Thanks :)
Alain Rist 9-Oct-10 11:54am View
Added MFC tag
Alain Rist 6-Oct-10 9:25am View
What is bartpe?
Alain Rist 29-Sep-10 7:25am View
'but your code is not working when i distribute the class parameter definition... from braces to individual definition like;' then it's not anymore my code :)
The reason is you don't initialize all WNDCLASSEX members.
Alain Rist 28-Sep-10 15:36pm View
Because part of your WNDCLASSEX structure is initialized to garbage :)
Alain Rist 28-Sep-10 15:31pm View
Your 'answer' only works by chance. Try changing your project character set to MBCS and see what happens.
Alain Rist 18-Sep-10 18:51pm View
Try WNDCLASSEX wcex = {0}; it should take you one step further.
Alain Rist 18-Sep-10 2:59am View
I certainly don't say that. The CFullScreenImpl::SetFullScreen(bool bFullScreen) code resolves to Win32 API calls. cheers.
Alain Rist 18-Sep-10 2:42am View
Check ALL differences with mine :)
Alain Rist 18-Sep-10 2:05am View
You can check with my code that it is not enough to fail RegisterClassEx().
Alain Rist 12-Sep-10 3:27am View
See my referenced article :)
Just reverse :
- Set original menu
- Set original styles
- Set original position
That's all :)
Alain Rist 11-Sep-10 5:38am View
The double colons let you paste the code without name clash even when you are (for instance) deriving from ATL::CWindow which defines members with the same names, but different signatures :)
Alain Rist 9-Sep-10 3:13am View
Sorry, my edit was stupid. Please comment in the answer comment area, don't ask new questions as answers to yours :)
Alain Rist 9-Sep-10 3:06am View
See my edited answer, cheers
Alain Rist 9-Sep-10 2:46am View
Use dumpbin on your library file to get the "exported name" and use it as in my answer.
Alain Rist 5-Sep-10 15:00pm View
Use float, double or decimal C# types to get an usable value :)
Alain Rist 5-Sep-10 13:36pm View
I look forward to see it in your answer, without typedef it will be beautiful :)
Alain Rist 5-Sep-10 12:40pm View
You need to cast the GetProcAddress() returned value :)
Alain Rist 10-Aug-10 2:09am View
Unfortunately the IO routines are handled differently by WinCE and Windows. Check your device SDK IO support (it's not a Windows Mobile device and should have a matching SDK).
On a WinMobile 5 smartphone, I got that working with a reader thread reading 1 char at time until '$' signalling then a listener thread which would store the sentence post a message to the app main window, reset the read buffer and restart the reader thread. Worked OK for hours or days.
Alain Rist 29-Jul-10 17:00pm View
See the allowed characters for lpComputerName in MSDN: It will work in all scenarios. cheers
Alain Rist 12-Jun-10 5:51am View
It was a constructive and useful discussion at least for me :)
The ANSI extra 2 lines get rid of the annoying size_max.
Alain Rist 11-Jun-10 4:45am View
It's compiling here on VC2010 Warning level 4 (native C++ standard library). But yes, problem at least on
VC 2008.
There are zillion of discussions on std::string contiguous implementation but today (June 2010) it is a de facto standard.
What is overcomplicated?
Alain Rist 10-Jun-10 16:31pm View
See my last update :)
Alain Rist 8-Jun-10 20:43pm View
Right, it was VC6 not C++ :) Now corrected.
Alain Rist 8-Jun-10 17:16pm View
std::basic_string<>::assign() does NOT throw (or it is undocumented).
With my solutions the resource contents are only copied once (and converted in the short version, which would be necessary anyhow.
Returning the length allows the usual constructs as if(!LoadString(mystr, ID_MYSTR)) mystr = "Default Value";
Last, as I said in the post, passing the dest reference to the function makes the code usable in UNICODE or MBCS builds.
Alain Rist 8-Jun-10 17:01pm View
Added handling of (improbable but not impossible) new failure.