News:

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

Sending Messages

Started by drjr, July 25, 2007, 01:59:15 AM

Previous topic - Next topic

drjr


I am using the easy code  and I have 1) a Window of course. 2) A button. 3) a WindowEdit1 control

My  intention is send a messge to de edit1 control when the user push the button.


.data

mytext  db " Good morning....",0

This is my code

       Window1Edit1 Proc Private hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM

   Return FALSE
               Window1Edit1 EndP


Window1Button1 Proc Private hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM

                lea edx,mytext
   Invoke SendMessage, hWnd, WM_SETTEXT, 0, Edx

   Return FALSE
Window1Button1 EndP

But here I donĀ“t know which is the value for hWnd. The Edit1 control was made by drag and drop from the toolbox.

Best regards

TNick

I don't have much experience with EasyCode, but I will assume that you are creating a dialog and some controls within. If this is the case, then the return value from CreateDialogParam will be the handle of main window, and to get the hWnd (Window handle) for any controls, you may use GetDlgItem, with first argument set to the main window's handle and second filled with the ID of the control (most probablly in design mode, in Properties window you can find this value). However, just to get or set the text in a control you can use GetDlgItemText and SetDlgItemText instead of WM_...

Regards,
Nick

ragdog

#2
hi

try this

   invoke GetDlgItem,hWnd,1000 ;id to your edit1
    mov edi,eax ;the handle of your edit

   lea edx,mytext
   Invoke SendMessage, edi, WM_SETTEXT, 0, edx


greets

ragdog