Click here to Skip to main content
16,012,223 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Temporal coding. Pin
hogan31-Oct-07 8:02
hogan31-Oct-07 8:02 
GeneralOLE Pin
Lutosław19-Sep-07 1:36
Lutosław19-Sep-07 1:36 
GeneralRe: OLE Pin
NormDroid19-Sep-07 3:33
professionalNormDroid19-Sep-07 3:33 
GeneralRe: OLE Pin
Lutosław19-Sep-07 3:58
Lutosław19-Sep-07 3:58 
GeneralRe: OLE Pin
Pete O'Hanlon19-Sep-07 3:35
mvePete O'Hanlon19-Sep-07 3:35 
GeneralRe: OLE Pin
Mike Dimmick19-Sep-07 4:35
Mike Dimmick19-Sep-07 4:35 
GeneralRe: OLE Pin
Patrick Etc.19-Sep-07 8:21
Patrick Etc.19-Sep-07 8:21 
GeneralRe: OLE Pin
Mike Dimmick19-Sep-07 9:37
Mike Dimmick19-Sep-07 9:37 
The good: it allows other events to occur, so they don't end up massively queued up with your application unresponsive while you perform some complex task.

The bad: it allows all other events to occur, so you can end up re-entering the current block of code and ultimately end up with stack overflow. Also, if you happen to include it in a COM callback, or a paint handler when you've already made a COM call to another process, and one of the events that fires tries to make a COM call to another process, you get a 'cannot call out within message filter' error.

That one caused a lot of head-scratching, I can tell you. You end up having to break up your big routine littered with DoEvents into lots of little event handlers and somehow have a way of transferring control between them by some other object raising an event. Timers work, of course, but the minimum timer duration is about 15ms on Windows XP, which is eons in computing time. (I wrote a component in C++ which merely posts a message back to a hidden window, and raises an event when this occurs, cutting that down to tiny amounts.)


DoEvents: Generating unexpected recursion since 1991

GeneralRe: OLE Pin
NormDroid20-Sep-07 1:08
professionalNormDroid20-Sep-07 1:08 
GeneralRe: OLE Pin
AEternal1-Oct-07 9:50
AEternal1-Oct-07 9:50 
GeneralRe: OLE Pin
NormDroid1-Oct-07 20:27
professionalNormDroid1-Oct-07 20:27 
GeneralRe: OLE Pin
Judah Gabriel Himango21-Sep-07 11:48
sponsorJudah Gabriel Himango21-Sep-07 11:48 
GeneralRe: OLE Pin
KarstenK24-Sep-07 1:43
mveKarstenK24-Sep-07 1:43 
GeneralIf at first you don't succeed... Pin
sushicw18-Sep-07 7:32
sushicw18-Sep-07 7:32 
GeneralRe: If at first you don't succeed... Pin
Pete O'Hanlon18-Sep-07 10:56
mvePete O'Hanlon18-Sep-07 10:56 
GeneralRe: If at first you don't succeed... Pin
PIEBALDconsult18-Sep-07 11:30
mvePIEBALDconsult18-Sep-07 11:30 
GeneralRe: If at first you don't succeed... Pin
Liam O'Hagan18-Sep-07 13:30
Liam O'Hagan18-Sep-07 13:30 
GeneralRe: If at first you don't succeed... Pin
PIEBALDconsult18-Sep-07 14:56
mvePIEBALDconsult18-Sep-07 14:56 
GeneralRe: If at first you don't succeed... [modified] Pin
DavidNohejl18-Sep-07 22:55
DavidNohejl18-Sep-07 22:55 
GeneralRe: If at first you don't succeed... Pin
Steve Hansen18-Sep-07 21:18
Steve Hansen18-Sep-07 21:18 
GeneralRe: If at first you don't succeed... Pin
sushicw19-Sep-07 8:41
sushicw19-Sep-07 8:41 
GeneralRe: If at first you don't succeed... Pin
John R. Shaw21-Sep-07 17:57
John R. Shaw21-Sep-07 17:57 
GeneralRe: If at first you don't succeed... Pin
StevenWalsh23-Sep-07 16:41
StevenWalsh23-Sep-07 16:41 
GeneralTell me... Pin
etkid8418-Sep-07 6:24
etkid8418-Sep-07 6:24 
JokeRe: Tell me... Pin
Big Daddy Farang18-Sep-07 6:35
Big Daddy Farang18-Sep-07 6:35 

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.