Click here to Skip to main content
14,733,796 members
This competition has ended

Best C++/MFC article of July 2011

Contribute to CodeProject and you'll automatically be in the running for a monthly prize!

Each month at CodeProject we gather together the best of the articles submitted the previous month and ask our readers to choose the best of the best. Entry is automatic - just submit you articke and we'll do the rest.

Check out the submission guidelines for information on posting articles.

Current Entries

Articles that match the contest criteria are automatically entered. The top 50 entries are shown.

Please Sign up or sign in to vote.
25 Jul 2012
pasztorpisti
2 alternatives  
How to open a console in a non-console C/C++ application or DLL and make printf/scanf work (stdin/stdout/stderr related functions)
Please Sign up or sign in to vote.
18 Jul 2011
Sergey Alexandrovich Kryukov
You can do it: int * p2 = reinterpret_cast(0x22fefc);//C-style cast:int * p1 = (int*)0x22fefc;//easy to check-up: p1==p2, but de-referencing them could be a problem :-)The result depends on the platform. On most modern platforms is would looks like some random...
Please Sign up or sign in to vote.
22 Jul 2011
Arik Poznanski
In this post, we will dive into the ribbon's dynamic structure capabilities, i.e., we will learn about the different ways to change the structure of the ribbon at runtime.
Please Sign up or sign in to vote.
1 Jul 2011
Sugato Pal
I just dont understand what is it..This is not a coaching class.You may be copy pasted your summer vacation hometask...My God!!!So as a solution i can only say please take help from your teacher...or consult any book..
Please Sign up or sign in to vote.
8 Jul 2011
#realJSOP
This should explain it[^]
Please Sign up or sign in to vote.
25 Jul 2011
Sergey Alexandrovich Kryukov
kiranbhatter wrote:Sometimes I really feel like I have chosen a wrong path while learning C, Win32.I think your whole approach is wrong. This is not a "path". There are things you need to know regardless of your "path". However, it depends on what do you want to become. Do you want to reach...
Please Sign up or sign in to vote.
12 Dec 2013
Cloud Hsu
How to remind review in iPhone App
Please Sign up or sign in to vote.
7 Jul 2011
Christian Graus
An abstract class is, well, abstract.This[^] is what I did when I was learning.Why use it ? Because it acts like an interface. It defines what a child class needs to do, but perhaps has no value on it's own. For example, a fruit class might be useless, because you always want a TYPE of...
Please Sign up or sign in to vote.
14 Jul 2011
Pete O'Hanlon
If you don't know C++ (heck, even if you do), I'd recommend buying Effective C++ by Scott Meyers. This is THE book to teach you C++. Don't worry too much at this stage about having to pick a specific flavour of the language. Get the basics under your belt first, and then look to pick up the...
Please Sign up or sign in to vote.
19 Jul 2011
Abhinav S
Well you can start writing some code and practicing.One day, you will get there!
Please Sign up or sign in to vote.
19 Jul 2011
thatraja
Here more than couple of ways to learn things in webEducation Needed[^]Also try to start write from simple "Hello world" code to small, big programs.
Please Sign up or sign in to vote.
22 Jul 2011
Arik Poznanski
In this post, we continue our exploration of the Windows Ribbon Framework, this time focusing on Gallery controls.
Please Sign up or sign in to vote.
22 Jul 2011
Stefan_Lang
Apart from what PrafullaVedante said, you are also needlessly creating a struct on the heap, and then forgot to delete it. Just create it on the stack like this: myvec = new vector; // { myStruct mystr; //
Please Sign up or sign in to vote.
26 Jul 2011
Stefan_Lang
Looks like you defined the functions right in your header. For example, like this:// file foo.hvoid foo() { puts "Hello World!");}// file foo.cpp#include "foo.h"//file bar.cpp#include "foo.h"Note that #include is a preprocessor command, causing the preprocessor to copy the...
Please Sign up or sign in to vote.
30 Jul 2011
«_Superman_»
Add a default constructor to the CExchangeRate class - CExchangeRate(void);
Please Sign up or sign in to vote.
5 Jul 2011
Rajesh R Subramanian
char *p = "hello";char pArr[] = "Hello";The above two are not the same. When you declare it as a pointer and initialize it with a value, the compiler puts it in the Data Segment[^], AND in the "Initialised and read only" area. When you try to change contents stored in this section, it...
Please Sign up or sign in to vote.
8 Jul 2011
CPallini
You would have a minimal code using C++, via, for instance MFC/ATL CImage or directly using GDI+. If you instead want to go 'to the metal' then things are a bit more complex, see, for instance, the following code sample Scaling an image[^].However you try use the following code inside the...
Please Sign up or sign in to vote.
25 Jul 2011
Sergey Alexandrovich Kryukov
Pipes for IPC? Use Named Pipes: http://msdn.microsoft.com/en-us/library/aa365590%28v=vs.85%29.aspx[^].[EDIT]Find some Named Pipe samples here: http://msdn.microsoft.com/en-us/library/aa365799%28v=vs.85%29.aspx[^].[END EDIT]For threading, use Thread functions, see...
Please Sign up or sign in to vote.
24 Jul 2011
OriginalGriff
C and Win32 are used a lot less these days - except for maintenance - C++ and MFC are more common, but also dated.C# or C++ and .NET are a lot more common these days, and may be a better investment.Having said that, if you are good at C and Win32, and can live with maintenance rather...
Please Sign up or sign in to vote.
1 Jul 2011
Christian Graus
You've been asked this as a homework question. You can also just compile and run it to find the output and use the debugger to 'explain' it. We don't do homework for people who won't even try.
Please Sign up or sign in to vote.
3 Jul 2011
#realJSOP
We don't do homework for people - not because we feel like we're elite or too important, but because YOU won't learn anything if we do it for you. If you try to do it and have a problem with a particular part of the code, come back here and ask a question about THAT particular part of the code -...
Please Sign up or sign in to vote.
10 Jul 2011
Christian Graus
Well, a wall clock, goes on the wall. So, you can either buy a clock mechanism and just make the face, or you can go to Switzerland, and learn the fine art of clockmaking. I'm not sure why you think anyone here can help with that. I assume if you meant how to write a program, you'd tell us...
Please Sign up or sign in to vote.
10 Jul 2011
Sergey Alexandrovich Kryukov
When you write "You should write a small webserver…", who should write it? I thing you should. Are you too lazy to re-formulate the text to make a question out of it? It looks like you simply pasted a copy of the text given to you.You need to begin with learning programming,...
Please Sign up or sign in to vote.
7 Jul 2011
Espen Harlinn
If you want to ensure that scanners will be able to read the barcodes, use a barcode printer[^].Otherwise you can use a library like Barcode Image Generation Library[^] Here is some info on scanning: Barcode scanning[^]Best regardsEspen Harlinn
Please Sign up or sign in to vote.
10 Jul 2011
Richard MacCutchan
You should also realise that on return from fun you will be back to your original p1 and p2 which are uninitialised. To achieve what you are trying to do you should send p1 and p2 as references, or add another level of indirection thus:void fun(int*& p1, int*& p2, int&s){int...
Please Sign up or sign in to vote.
13 Jul 2011
Sergey Alexandrovich Kryukov
Most primary concept is being C++; being VC++ is secondary. Think which one do you want to learn. :-)—SA
Please Sign up or sign in to vote.
13 Jul 2011
Richard MacCutchan
Forget VC++, there is no such thing. The language is C++, designed by Bjarne Stroustrup[^]. If you want to learn in depth then all the information you need is on his website. You can also look at the MSDN reference[^], use Google to search for free tutorials, or buy a book.
Please Sign up or sign in to vote.
14 Jul 2011
CPallini
you are using temp.clientData as an array but you didn't allocate memory for it.Namely, in the posted code you should change temp.clientData = new licenseClient*;totemp.clientData = new licenseClient*[3];
Please Sign up or sign in to vote.
15 Jul 2011
«_Superman_»
Here are the documentation links -Scope Resolution Operator: ::[^]Member Access Operators: . and ->[^]Here is a link for all C++ Operators[^].
Please Sign up or sign in to vote.
18 Jul 2011
వేంకటనారాయణ(venkatmakam)
You can pass the command line arguments from the IDE as follows,Goto Project->Properties.1. Expand configure properties section.2. Goto Debug section.3. Give the command line arguments in "Command Arguments" edit box.
Please Sign up or sign in to vote.
20 Jul 2011
Nagy Vilmos
Read. Read a lot.You will gain a great deal just from this site by reading articles, look for highly rated ones by good authors, and working through what was done.Read the documentation for the languages you are interested in so you can understand how and why they are structured that...
Please Sign up or sign in to vote.
24 Jul 2011
Emilio Garavaglia
I's the definition of an overloaded operator[^]
Please Sign up or sign in to vote.
29 Jul 2011
Sayyed Mostafa Hashemi
Code for checking the avilabiltiy of Internet connection.
Please Sign up or sign in to vote.
8 Jul 2011
Christian Graus
1 - please don't press 'answer' to add comments. There's a comment button, see it ? Second, you shouted when you typed all in capitals. That's what was meant, THIS IS SHOUTING. Third, you listed just about every sort of language known to man, that's not a sign that you have any knowledge,...
Please Sign up or sign in to vote.
17 Jul 2011
Espen Harlinn
Nothing short of a rootkit can prevent a programmer from loading dll's into another process on his machine - and a good programmer can circumvent that too. I'm fairly certain that this is not the best way to solve your problem. If this is for an online solution, cheating should be prevented...
Please Sign up or sign in to vote.
24 Jul 2011
Mohibur Rashid
First thing firstCPP is OO and C is structure orientedin general compiler judge the code type with file extension. File with .c extension will not compiled as cpp.Almost all c style code is excepted in cpp.except 1) type casting. example: char *arr; ...
Please Sign up or sign in to vote.
24 Jul 2011
Mohibur Rashid
Dont worry .net seems future. But microsoft knows that they didnt give us the ultimate solution yet, soon they will give you another solution and .net will be back dated again. But C/C++ is immortal, cause its not their ............
Please Sign up or sign in to vote.
6 Jul 2011
Sergey Alexandrovich Kryukov
Here is the sample code solving this problem: http://stackoverflow.com/questions/212528/linux-c-get-the-ip-address-of-local-computer[^].Have you been banned by Google? :-)—SA
Please Sign up or sign in to vote.
10 Jul 2011
Christian Graus
See how what you posted is a list of instructions ? This is because it is your homework. It does not sound to me like beginner homework, are you taking this class ? If you are and you are new to C, that seems insane. Either way, we're not going to do this for you.
Please Sign up or sign in to vote.
13 Jul 2011
CPallini
Read the specifications[^] and go, go!
Please Sign up or sign in to vote.
13 Jul 2011
Joan M
aimdharma... aren't you tired of downvotes and people asking you to work a little bit your questions?Take a look at this link[^]... you will see how to do it there...It seems stupid to me that you son't even bother to search google... At the end you'll be banned and then there won't be...
Please Sign up or sign in to vote.
10 Jul 2011
Sergey Alexandrovich Kryukov
This is not true: "private members doesn't Derive". This is not even false, just makes no sense. :-)A member can not "derive", only a type can. All members are inherited, no exclusions.—SA
Please Sign up or sign in to vote.
12 Jul 2011
Dr.Walt Fair, PE
This[^] should get you started.
Please Sign up or sign in to vote.
12 Jul 2011
Sergey Alexandrovich Kryukov
I think your problem is here: "It's necessity of the programmer to make it public & static, so that it is callable without creating object of class."This is a misconception. To understand it, learn how Singleton design pattern...
Please Sign up or sign in to vote.
13 Jul 2011
Albert Holguin
Here's a decent article that talks about debugging in Studio:Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]There are also several MFC macros that are available for debugging (TRACE being very, very useful):Useful Debugging Macros[^]
Please Sign up or sign in to vote.
13 Jul 2011
John R. Shaw
n = ++i; // #1 : assigns i to n after adding 1 to in = i++; // #2 : assigns i to n before adding 1 to iwhich is better?++i should be preferred over i++; I believe Stroustrup, Myers and others have stated this in various books and/or post.The reason we preferred this in C...
Please Sign up or sign in to vote.
15 Jul 2011
Espen Harlinn
Take a look at ICU:ICU - International Components for Unicode[^]The ICU libraries, provides first class support for Unicode[^], while wchar_t[^] only provides support for wider character encodings.You can encode chineese characters in UTF-8, UTF-16, UCS-32, GB 18030, Code page 936, and...
Please Sign up or sign in to vote.
15 Jul 2011
Pete O'Hanlon
This is such a common requirement for OpenGL that they have provided the glRect that does exactly this. Microsoft have provided several versions of this function[^] that take different data types to specify the bounds of the rectangle.
Please Sign up or sign in to vote.
18 Jul 2011
Richard MacCutchan
See this discussion[^] in MSDN.
Please Sign up or sign in to vote.
18 Jul 2011
OriginalGriff
Combined with your other question How do I know if there is a computer camera?[^] I find myself wondering exactly what you are trying to do. I can't easily see any legitimate application which uses a PC camera and wants to hide.I can however see quite a few illegitimate applications, and...

Current Participants

Those with articles that match the contest criteria are automatically entered.

#realJSOP
Software Developer (Senior) Paddedwall Software
United States United States
I've been paid as a programmer since 1982 with experience in Pascal, and C++ (both self-taught), and began writing Windows programs in 1991 using Visual C++ and MFC. In the 2nd half of 2007, I started writing C# Windows Forms and ASP.Net applications, and have since done WPF, Silverlight, WCF, web services, and Windows services.

My weakest point is that my moments of clarity are too brief to hold a meaningful conversation that requires more than 30 seconds to complete. Thankfully, grunts of agreement are all that is required to conduct most discussions without committing to any particular belief system.
«_Superman_»
Architect
India India
Santosh works as a Technical Architect in God's own Country, Kerala, India. He has been involved with C/C++ since 1996. Started with a few game clones and then went on to commercial software. He started his stint with software training and then went on to professional software development, design and architecture. Unix and C were his favorite in his early days but later grew very fond of Windows especially with the release of Windows NT 4.0 and Visual C++ 6.0. Technologies like COM and .Net fascinate him. He still lurks around Unix once in a while.

Music and the guitar are his second favorites and he manages to impress his friends with these skills when there are nobody better than him around. He is a patient and fun loving character who does not think too much about the future. He hates wasting time and so is working hard (in his dreams) to perfect instant transportation and time travel.

Oh! Yes. He loves Superman. Always did and always will. He would love to become a Superman and rid the world of all evil.

He used to be a Microsoft Visual C++ MVP (October 2009 - September 2013)
Emilio Garavaglia
Architect
Italy Italy
Born and living in Milan (Italy), I'm an engineer in electronics actually working in the ICT department of an important oil/gas & energy company as responsible for planning and engineering of ICT infrastructures.
Interested in programming since the '70s, today I still define architectures for the ICT, deploying dedicated specific client application for engineering purposes, working with C++, MFC, STL, and recently also C# and D.
Abhinav S
Software Developer (Senior)
India India
Albert Holguin
Engineer
United States United States
I'm an angry monkey. Big Grin | :-D
Arik Poznanski
Software Developer (Senior) Verint
Israel Israel
Arik Poznanski is a senior software developer at Verint. He completed two B.Sc. degrees in Mathematics & Computer Science, summa cum laude, from the Technion in Israel.

Arik has extensive knowledge and experience in many Microsoft technologies, including .NET with C#, WPF, Silverlight, WinForms, Interop, COM/ATL programming, C++ Win32 programming and reverse engineering (assembly, IL).
Christian Graus
Software Developer (Senior)
Australia Australia
Programming computers ( self taught ) since about 1984 when I bought my first Apple ][. Was working on a GUI library to interface Win32 to Python, and writing graphics filters in my spare time, and then building n-tiered apps using asp, atl and asp.net in my job at Dytech. After 4 years there, I've started working from home, at first for Code Project and now for a vet telemedicine company. I owned part of a company that sells client education software in the vet market, but we sold that and I worked for the owners for five years before leaving to get away from the travel, and spend more time with my family. I now work for a company here in Hobart, doing all sorts of Microsoft based stuff in C++ and C#, with a lot of T-SQL in the mix.
Cloud Hsu
Architect SIS
Taiwan Taiwan
CloudBox cross-platform framework. (iOS+ Android)
Github: cloudhsu
My APP:
1. Super Baby Pig (iOS+Android)
2. God Lotto (iOS+Android)
2. Ninja Darts (iOS)
3. Fight Bingo (iOS)
CPallini
Software Developer (Senior) Biotecnica Instruments S.p.A.
Italy Italy




Debugging? Klingons do not debug. Our software does not coddle the weak. Bugs are good for building character in the user.
-- The Klingon programmer



Beelzebub for his friends [^].




Dr.Walt Fair, PE
Engineer Comport Computing
United States United States
No Biography provided
Espen Harlinn
Architect Ulriken Consulting AS
Norway Norway
Senior Architect - Ulriken Consulting AS.

Specializing in integrated operations and high performance computing solutions.

I’ve been fooling around with computers since the early eighties, I’ve even done work on CP/M and MP/M.

Wrote my first “real” program on a BBC micro model B based on a series in a magazine at that time. It was fun and I got hooked on this thing called programming ...

A few Highlights:

  • High performance application server development
  • Model Driven Architecture and Code generators
  • Real-Time Distributed Solutions
  • C, C++, C#, Java, TSQL, PL/SQL, Delphi, ActionScript, Perl, Rexx
  • Microsoft SQL Server, Oracle RDBMS, IBM DB2, PostGreSQL
  • AMQP, Apache qpid, RabbitMQ, Microsoft Message Queuing, IBM WebSphereMQ, Oracle TuxidoMQ
  • Oracle WebLogic, IBM WebSphere
  • Corba, COM, DCE, WCF
  • AspenTech InfoPlus.21(IP21), OsiSoft PI


More information about what I do for a living can be found at: harlinn.com or LinkedIn

You can contact me at espen@harlinn.no
Joan M
Chief Technology Officer robotecnik
Spain Spain
I'm from Catalonia (in Spain) and a specialist in CNC, PLC, robotics and automation in general.

From 1998 I've been developing software applications for the automation market.

I'm using different technologies in each case to get the proper result, fieldbus communications, special electronics, special laser sensors, artificial vision, robot arms, CNC applications, PLC's...

www.robotecnik.com[^] - robots, CNC and PLC programming
John R. Shaw
Software Developer (Senior)
United States United States
I am a senior software engineer who has been designing and developing software for many years, mostly in C/C++. You might say that I think in code; which is why I am passionate about my first rule of coding: “First do no harm”. So if I get carried away in my explanations, please realize that it is just part of my personality. I enjoy learning new things and, when I have the time, passing that knowledge onto others.
Mohibur Rashid
Software Developer
Japan Japan
I wish, I had a stable hobby.
Nagy Vilmos
President Belligerent Bad Tempered Old Fools Club
United Kingdom United Kingdom
No Biography provided
OriginalGriff
CEO
Wales Wales
Born at an early age, he grew older. At the same time, his hair grew longer, and was tied up behind his head.
Has problems spelling the word "the".
Invented the portable cat-flap.
Currently, has not died yet. Or has he?
Pete O'Hanlon
CEO
United Kingdom United Kingdom
A developer for over 30 years, I've been lucky enough to write articles and applications for Code Project as well as the Intel Ultimate Coder - Going Perceptual challenge. I live in the North East of England with 2 wonderful daughters and a wonderful wife.

I am not the Stig, but I do wish I had Lotus Tuned Suspension.
Rajesh R Subramanian
Software Developer
Australia Australia
Software developer
Richard MacCutchan
Retired
United Kingdom United Kingdom
I was a Software Engineer for 40+ years starting with mainframes, and moving down in scale through midi, UNIX and Windows PCs. I started as an operator in the 1960s, learning assembler programming, before switching to development and graduating to COBOL, Fortran and PLUS (a proprietary language for Univac systems). Later years were a mix of software support and development, using mainly C, C++ and Java on UNIX and Windows systems.

Since retiring I have been learning some of the newer (to me) technologies (C#, .NET, WPF, LINQ, SQL, Python ...) that I never used in my professional life, and am actually able to understand some of them.

I still hope one day to become a real programmer.
Sayyed Mostafa Hashemi
Software Developer (Senior)
Iran (Islamic Republic of) Iran (Islamic Republic of)
I am Mostafa Hashemi.I was born in Tehran. I graduated from IUMS university in 2002 (1381). Although my university field different from programming, but I like it. Since I acquainted with computer, I have been interested in Visual C++. I have been beginning to program in Visual C++ in 2003.
Thanks,
http://www.sischer.ir
Sergey Alexandrovich Kryukov
Architect
United States United States
No Biography provided
Stefan_Lang
Software Developer (Senior)
Switzerland Switzerland
Graduated at TU Darmstadt in Math & CS, with a heavy focus on CAD/CAM

Programming and designing applications in C++ in the areas AI, real-time programming, client-server applications and CAD/CAM since 1985.

Personal interests: AI, computer graphics, games, reading
Sugato Pal
India India
No Biography provided
thatraja
Web Developer
India India
No Biography provided
xenotron
Software Developer (Senior)
United Kingdom United Kingdom
No Biography provided
You must sign in to participate in this contest.
This contest has ended.
1 Jul - 31 Jul 2011