Hello,
i have create a dialog box
Dialog "Dialog With Icon", "Tahoma", 9, \ ; caption,font,pointsize
WS_OVERLAPPED or DS_CENTER or WS_VISIBLE, \ ; style
3, \ ; control count
0,0,166,70, \ ; x y co-ordinates
1024 ; memory buffer size
DlgStatic "MASM32 Pure And Simple Dialogs",0,8,8,150,9,100
DlgEdit WS_BORDER or WS_TABSTOP,8,18,150,12,1000
DlgButton "OK",WS_TABSTOP,8,33,150,15,IDOK
invoke GlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT, 32
CallModalDialog hInstance,h_window,DlgProc, eax
invoke GlobalFree, eax
when the OK Button is presst i want to get the text from the EDIT Item
maybe so:
DlgProc proc hWin:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
; COMMAND
.if uMsg == WM_COMMAND
; OK BUTTON
.if wParam == IDOK
invoke SendMessage, ????????, WM_GETTEXT, NULL, NULL
; SAVE TEXT [..]
invoke EndDialog,hWin,0
.endif
; CLOSE
.elseif uMsg == WM_CLOSE
invoke EndDialog,hWin,0
.endif
xor eax, eax
ret
DlgProc endp
but what is the handle for the edit item to get the text with invoke SendMessage, ????????, WM_GETTEXT, NULL, NULL
GetDlgItem (http://msdn.microsoft.com/en-us/library/ms645481(VS.85).aspx) will return the handle of the item given it's ID
invoke GetDlgItem, hDlg, 1002
mov hControl, eax
This dialog is from a resource file, but I can't get the column to add.
DlgCarsProc proc hWnd:HWND, iMsg:DWORD, wParam:WPARAM, lParam:LPARAM
;===================================================================
LOCAL lvc:LV_COLUMN
.if iMsg == WM_INITDIALOG
invoke GetDlgItem,hWnd,IDC_LSV_CARS
mov hLV, eax
mov lvc.imask, LVCF_TEXT + LVCF_WIDTH
mov lvc.pszText, offset chDlgCarsHeading1
mov lvc.lx, 150
invoke SendMessage, hLV, LVM_INSERTCOLUMN, 0, addr lvc
.elseif iMsg == WM_CLOSE
invoke EndDialog, hWnd, NULL
.else
mov eax, FALSE
ret
.endif
mov eax, TRUE
ret
DlgCarsProc endp
Quote from: donkey on February 26, 2009, 08:37:23 PM
GetDlgItem (http://msdn.microsoft.com/en-us/library/ms645481(VS.85).aspx) will return the handle of the item given it's ID
...provided the dialog was created with DialogBoxParam and not CreateDialogParam... ::)
If you're familiar with the OllyDbg debugger, load the executable into that, scroll down to a few lines before the call to GetDlgItem, press F2 to place a breakpoint there, press F9 to execute to the breakpoint, then press F8 to step through the call to GetDlgItem. You might be getting this result:
(http://img29.imageshack.us/img29/7117/controliderr.th.png) (http://img29.imageshack.us/img29/7117/controliderr.png)
No luck. I tried debugging as was suggested, but it looks fine. The dialog opens, but there is no heading.
[EDIT]
Per MSDN: "Columns are visible only in report (details) view."
I mistakenly thought this was the default. I'm back on track now.