Click here to Skip to main content
15,886,806 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: 《programming game AI by example》 Pin
leon de boer19-Jul-17 20:51
leon de boer19-Jul-17 20:51 
GeneralRe: 《programming game AI by example》 Pin
bestbear21-Jul-17 2:12
bestbear21-Jul-17 2:12 
QuestionHelp with Heap Corruption "Critical error detected c0000374" Pin
ForNow19-Jul-17 13:47
ForNow19-Jul-17 13:47 
AnswerRe: Help with Heap Corruption "Critical error detected c0000374" Pin
leon de boer19-Jul-17 20:16
leon de boer19-Jul-17 20:16 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
ForNow19-Jul-17 21:42
ForNow19-Jul-17 21:42 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
leon de boer19-Jul-17 22:05
leon de boer19-Jul-17 22:05 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
ForNow20-Jul-17 6:43
ForNow20-Jul-17 6:43 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
leon de boer20-Jul-17 17:29
leon de boer20-Jul-17 17:29 
Yep in the sample these are the key lines

dlg.InitModalIndirect((DLGTEMPLATE*)pBuffer);
dlg.DoModal(); // tadaaa! this is the line everyone's been waiting for!!!

I loved the tadaa in the source comments and it's because at that moment the penny should drop that the template has just been sitting in memory and wont do anything until you execute those two lines. It's much kinder on windows especially in a threaded app and less chance of making mistakes.

So when you get the message from your ethernet port all you have to do is execute those two lines and dialog flies out of memory and up on screen. You can actaully do everything else before that any earlier time.

Not sure how MFC does this but there is an lParam value that is part of the indirect and usually you pass a struct with your data you want loaded in the dialog handler in as well. It saves having to carry a global with your data.In your case I would imagine it would be a pointer to your payload data recieved. Again saves copy or moving any data.

It stuns me dlg.InitModalIndirect doesn't take a second parameter which is what I was expecting and where you would pass in your data pointer. So bit of mystery to me how you do that under MFC. Oh I wonder does dlg.InitModalIndirect have overrides and used as a shim on the indirect call to cater for that. In which case there will be a form of that you can pass a second parameter on.
In vino veritas


modified 21-Jul-17 0:11am.

GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
ForNow21-Jul-17 2:47
ForNow21-Jul-17 2:47 
GeneralRe: Help with Heap Corruption "Critical error detected c0000374" Pin
leon de boer21-Jul-17 3:35
leon de boer21-Jul-17 3:35 
AnswerRe: Help with Heap Corruption "Critical error detected c0000374" Pin
Jochen Arndt19-Jul-17 21:36
professionalJochen Arndt19-Jul-17 21:36 
GeneralCards.dll Pin
Member 1171866719-Jul-17 1:40
Member 1171866719-Jul-17 1:40 
AnswerRe: Cards.dll Pin
Jochen Arndt19-Jul-17 3:29
professionalJochen Arndt19-Jul-17 3:29 
GeneralRe: Cards.dll Pin
Richard MacCutchan19-Jul-17 4:59
mveRichard MacCutchan19-Jul-17 4:59 
GeneralRe: Cards.dll Pin
leon de boer19-Jul-17 5:54
leon de boer19-Jul-17 5:54 
GeneralRe: Cards.dll Pin
Richard MacCutchan19-Jul-17 6:58
mveRichard MacCutchan19-Jul-17 6:58 
QuestionCompiler generated code Pin
ForNow13-Jul-17 14:43
ForNow13-Jul-17 14:43 
AnswerRe: Compiler generated code Pin
leon de boer13-Jul-17 16:43
leon de boer13-Jul-17 16:43 
GeneralRe: Compiler generated code Pin
jschell15-Jul-17 7:34
jschell15-Jul-17 7:34 
AnswerRe: Compiler generated code Pin
Peter_in_278013-Jul-17 16:44
professionalPeter_in_278013-Jul-17 16:44 
QuestionInterprocess communication in C without pipes or disk Pin
Chris Maunder12-Jul-17 13:14
cofounderChris Maunder12-Jul-17 13:14 
AnswerRe: Interprocess communication in C without pipes or disk Pin
Espen Harlinn12-Jul-17 14:03
professionalEspen Harlinn12-Jul-17 14:03 
GeneralRe: Interprocess communication in C without pipes or disk Pin
leon de boer12-Jul-17 18:49
leon de boer12-Jul-17 18:49 
AnswerRe: Interprocess communication in C without pipes or disk Pin
Randor 13-Jul-17 14:08
professional Randor 13-Jul-17 14:08 
GeneralRe: Interprocess communication in C without pipes or disk Pin
Chris Maunder19-Jul-17 6:01
cofounderChris Maunder19-Jul-17 6:01 

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.