Comparison between DirectInput & catching windows messages

Started by
0 comments, last by Arnau 20 years ago
I''m working with managed directx, in c#, and my question is: What is better to use, DirectInput or get the windows messages by overriding the WndProc procedure? If I use the DirectInput, is it necessary to call the Applications.DoEvents? I''ve read in an article that the Applications.DoEvents call allocates each time a lot of memory! Which one do you think is more efficient?? I think that you have to poll every frame the DirectInput API to see if something has changed, is that correct? Using windows messages, that wouldn''t be needed, as I would only receive the messages when a key is pressed or the mouse changes its state. What''s your opinion? Thanks!
Advertisement
quote:What is better to use


simple: whichever suits you best. Our project uses DI for keyboard input, and WndProc for mouse - just proved to work out as easy and more intuitive for the user to let the WndProc do everything based on the Windows settings.

quote:Applications.DoEvents call allocates each time a lot of memory


Can''t say for sure, but all languages I''ve used that have this sort of feature tend to use it to signal the Virtual Machine indicating it can swap threads/processes. I don''t see why it''d have any need to allocate (noticably) large amounts of memory.

quote:poll every frame the DirectInput API to see if something has changed, is that correct?


I haven''t used Managed DI since VB6, but you used to be able to set up a standard callback mechanism for event based input. Look up the SDK docs for info.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement