rsala,
I was looking at the easycode manual, and I noticed that it said you do not have to save edi, esi, ebx registers in a
visual project if you use them in your procedure.
So easycode will take care to save these registers for you even in your own procedures in the visual
project?
I Have been saving them on entry to my procedures and restoring them. I assume from what I read I do not
need to do this?
Thanks
greco558
Hi greco558,
When the code execution comes to a window procedure, Ebx, Edi and Esi registers have been saved and they will be restored at the end of the proc. Also they are saved when calling an Easy Code method in visual projects. However, in your own procedures you are the responsible for saving them if you want to keep their values in any part of your code (saving them or not has no effect on EC). As said before, when the code execution returns to EC the values for Ebx, Edi and Esi are restored to the values they had when the window procedure was called.
Fo example:
Window1Procedure Proc Private hWnd:HWND, ...
.If uMsg == WM_CREATE
Invoke GlobalAlloc, GPTR, 1024
Mov Ebx, Eax
Invoke YourProc, ...
Invoke GlobalFree, Ebx
.EndIf
Return FALSE
Window1 EndP
In the example above, if you are going to modify Ebx in YourProc, you must save it as it contains the address of the allocated memory that has to be freed later.
Regards,
Ramon