News:

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

Scope of variables

Started by AndyR, March 26, 2005, 03:13:18 PM

Previous topic - Next topic

AndyR

Hi all,

I've got a problem with structures in winmm API(or any windows API). I writing a prog to recieve MIDI in sysex messages in which I use a callback routine.
In WndProc, if I declare an instance of the MIDIHDR structure as LOCAL, I can't refer to it in the callback routine. How do I do I get at it in both procs? I realise there's probably a simple answer but I just can't find a way of doing it. I've read the docs and been through loads of tutorials, but haven't found anything yet.

For instance:

a_proc proc

LOCAL midiHdr:MIDIHDR

mov eax,offset sysbuf
mov  midiHdr.lpData,eax

a_proc endp


b_proc proc

mov  eax,midiHdr.lpData   ;Never heard of it!!

b_proc endp

How do I give midiHdr global scope? :red

Thanks,


Andy






mnemonic

Hi Andy,

try putting it in the .data or .data? section and it will be available from anywhere.

Regards
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

AndyR

Hi all,

Thanks mnemonic, I did try that but it threw errors. What format should I use?

Andy

MichaelW

To use the default initializers:

midiHdr MIDIHDR <>

Or to initialize dwBufferiLength to 100:

midiHdr MIDIHDR <,100>

etc

eschew obfuscation

AndyR

Hi all,

That did the job! Thanks  :U

Andy.