What's the theory behind PROC and all functions in masm?

Started by CoR, March 06, 2007, 10:18:05 PM

Previous topic - Next topic

Ratch

CoR,

     You might find the links below...interesting.  I too have used Petzold's 5th edition for learning Windows programming, and have converted most of the C programs within into MASM without using PROCs at all.  Some people can't get along without PROCs, but I detest them.  The choice is yours.  Ratch

http://www.masm32.com/board/index.php?topic=5916.0
http://www.masm32.com/board/index.php?topic=4650.0
http://www.masm32.com/board/index.php?topic=3783.0

CoR

Shantanu Gadgil,

I have seen that "one ret at the end of proc" and I wondered why people use it. I honestly thought about option that uMsg can have more than one value and we should check for all WM_xyz possibilities at one pass through whole WndProc  :dazzled: And I really don't like what I do not understand!

For now I want to learn to write as "clean" as possible. It's not too hard to look for every WM_xxx in win32hlp and read what should I return. I'll remember WM_'s better and WndProc will have 30-50 CPU ticks less to process (depending of the number of WM_'s before DefWindowProc).
   I even reorder WM_'s! Ones that are most likely to be called are at front, and ones that are called only once are at the bottom of WndProc  :toothy
I know it saves only a few CPU ticks but it puts my mind at ease  :wink

Ratch,
I am sorry but I can not tell heads and tails of your examples. Asm is still one big puzzle to me. Iczelion tute is familiar to me because I have previous knowledge of C/C++. But as soon as I see:
mov eax, [esp+2*4]
push [esp+16]
MOV EAX, [ESP+DWORD]
SUB EAX, DWORD
CMP B[EAX+0*BYTE],0
call dword ptr[ebp]+PostQuitMessage  ;instead of normal push var, call procedure
I am completely lost  :(
I started at "Campus". Now I am at "The Workshop" level. The Laboratory is light years away.

However if you are willing to write some "in detail, in depth, fully explained, for beginners" example... I'll gladly read it! And do my best to understand it. I need to learn much more if I want to understand what are you guys talking about in "The Lab".

Btw, I don't know if you have seen this, but maybe it can help you in some way: http://www.masm32.com/board/index.php?topic=6825.0