News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

MIDI in routines with callback?

Started by AndyR, March 11, 2005, 09:54:44 AM

Previous topic - Next topic

AndyR

Hi all,

I'm new to windows ASM programming so treat me gently!

I wonder if anybody knows of any examples of a MIDI IN program with a callback process in MASM32. I found one in C and converted it, but the callback routine is declared as type CALLBACK and don't quite know what to do with it! How do I create it in ASM?

Grateful for any advise, examples or links etc.

Thanks

Andy.

Tedd

You don't actually need to do anything special with the callback function. The CALLBACK type is just a C thing, there's no need for it in asm.
So just define the function as normal, and as long as you give the address to the registration function, then it should all work fine (assuming everything else is correct :bdg)
No snowflake in an avalanche feels responsible.

AndyR

Hi all, :wink :wink
Thanks for that Tedd. The reason for asking the question was that I've already tried running the prog, but it seems unstable, so I thought that the CALLBACK thing might have something to with it. I must have something not quite right.
I would be nice to have an example.  :wink


sluggy

Are you sure that the original C code was not buggy? Are you using global variables in the callback function, or are you calling out to other functions from the callback?


MichaelW

And are you sure that your callback is preserving the values in EBP, EBX, EDI, or ESI.
eschew obfuscation

mariø

if you can post your code maybe some can help you (i think that all people that know masm understand any hight level language)

pbrennick

Hi AndyR,
Just to amplify, you better make sure you are pushing and popping those registers mentioned by Michael if you are using them.  Or else you can include a 'uses' statement in the procedure declaration.  Anything else will cause Windows to hiccup or worse.

Paul

AndyR

Hi all,

Sorry for the late reply, my phone line came down in a storm, they've only just fixed it.
Yes, you were all right, I figured it out for myself in the end, a couple of pushes and pops and it burst into action.
Thanks to all for your help.

Andy.