Click here to Skip to main content
15,888,461 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Error Returning CArray Pin
CPallini23-May-12 23:02
mveCPallini23-May-12 23:02 
QuestionReadFile bytes read not equla to bytes requested Pin
evs_bud23-May-12 21:27
evs_bud23-May-12 21:27 
AnswerRe: ReadFile bytes read not equla to bytes requested Pin
CPallini23-May-12 21:37
mveCPallini23-May-12 21:37 
QuestionCreate an incoming connection RAS server with C++ Pin
Member 800297323-May-12 12:56
Member 800297323-May-12 12:56 
AnswerRe: Create an incoming connection RAS server with C++ Pin
Erudite_Eric23-May-12 22:09
Erudite_Eric23-May-12 22:09 
GeneralRe: Create an incoming connection RAS server with C++ Pin
Member 800297324-May-12 5:55
Member 800297324-May-12 5:55 
QuestionCTabCtrl and CRuntimeClass - is there a better way? Pin
Vaclav_23-May-12 6:08
Vaclav_23-May-12 6:08 
AnswerRe: CTabCtrl and CRuntimeClass - is there a better way? Pin
Aescleal23-May-12 6:47
Aescleal23-May-12 6:47 
Even without getting rid of the ifs you could cut down on the amount of reporting code by factoring the whole TRACE/AfxMessageBox malarkey into another function.

And as you've got more arrows than Custer's hat in some of those conditionals it might be worth moving some of them into their own functions. And the casts [1]. And the location of the runtime class object. There's at least one line in there you don't need for getting the runtime class as well. If you do that lot the code might not look so ugly, be easier to read AND modify.

As for runtime class... every time you use something like that you're showing up the fact you've got a missing virtual function. Create a common base class to your views, define a pure virtual function in there to do your disconnection schtick, implement the function in your views, call it where you've got the class name checks now and snip, snip Bob's yer aunty - no more runtime class required and an if statement disposed of.

Anyway the point here is simplify your code, look for places where you branch on type and replace them with virtual function calls.

Cheers,

Ash

[1] Generally loads of arrows in one statement and casting means you're missing member functions of some sort. Objects (with some exceptions) shouldn't expose their data to the world.
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? Pin
Vaclav_23-May-12 7:42
Vaclav_23-May-12 7:42 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? Pin
Vaclav_23-May-12 10:29
Vaclav_23-May-12 10:29 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? Pin
Aescleal23-May-12 23:46
Aescleal23-May-12 23:46 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? Pin
Aescleal23-May-12 23:57
Aescleal23-May-12 23:57 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? Pin
Vaclav_24-May-12 3:39
Vaclav_24-May-12 3:39 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? Pin
Vaclav_24-May-12 7:31
Vaclav_24-May-12 7:31 
Questionnew and free Pin
pix_programmer23-May-12 0:23
pix_programmer23-May-12 0:23 
AnswerRe: new and free Pin
CPallini23-May-12 1:00
mveCPallini23-May-12 1:00 
GeneralRe: new and free Pin
pix_programmer23-May-12 1:13
pix_programmer23-May-12 1:13 
GeneralRe: new and free Pin
CPallini23-May-12 1:48
mveCPallini23-May-12 1:48 
AnswerRe: new and free Pin
«_Superman_»23-May-12 4:54
professional«_Superman_»23-May-12 4:54 
QuestionUnable to write to shared memory Pin
manoharbalu22-May-12 20:20
manoharbalu22-May-12 20:20 
AnswerRe: Unable to write to shared memory Pin
Malli_S22-May-12 20:34
Malli_S22-May-12 20:34 
GeneralRe: Unable to write to shared memory Pin
manoharbalu22-May-12 22:40
manoharbalu22-May-12 22:40 
AnswerRe: Unable to write to shared memory Repost Pin
Richard MacCutchan22-May-12 22:34
mveRichard MacCutchan22-May-12 22:34 
GeneralRe: Unable to write to shared memory Repost Pin
Richard Andrew x6423-May-12 12:08
professionalRichard Andrew x6423-May-12 12:08 
QuestionSyncronisation problem Pin
VCProgrammer22-May-12 20:13
VCProgrammer22-May-12 20:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.