Working With Edit Control
-
Hi Jetli, Thanks for the responce. I tryed with that code i am getting error
SetDlgItemText(IDC_PATH,szDir);
error C2660: 'SetDlgItemTextA' : function does not take 2 parameters Error executing cl.exe.Which type is your application ? if it is a MFC dialg based app the paramter to SetDlgItemText is correct , otherwise u need to provide the HWND of your dialog in SetDlgItemText function. SetDlgItemText( , IDC_PATH, szDir); Refer MSDN.
If u can Dream... U can do it
-
Which type is your application ? if it is a MFC dialg based app the paramter to SetDlgItemText is correct , otherwise u need to provide the HWND of your dialog in SetDlgItemText function. SetDlgItemText( , IDC_PATH, szDir); Refer MSDN.
If u can Dream... U can do it
-
So where you placed the edit control ? dialog or window ? and which function you using for showing dialog(DialogBox() ) ? you will get the hwnd of dialog in dialog Proc. if it is dialog put your dialogs handle in SetDlgItemText Hopes this helps
If u can Dream... U can do it
-
Hello all, I have one Edit Control IDC_PATH , and some path in (LPARAM)szDir variable. Now I want to set the value of szDir in the IDC_PATH edit box , how to do this ?? Please can anyone tell me hw to do this .
SendDlgItemMessage(hwnd,IDC_PATH,(LPARAM)szDir,0,0);
I tried with this code its not working. What will be the error ? Edit/Delete Message And also I want to know how to disable and enable edit box ??? Thanking you, Suresh HC.Suresh H wrote:
SendDlgItemMessage(hwnd,IDC_PATH,(LPARAM)szDir,0,0);
You passing wrong value as third parameter, it should be message to send(WM_SETTEXT in this case). Modify your code to,
SendDlgItemMessage(hwnd,IDC_PATH,WM_SETTEXT,0,(LPARAM)szDir);
You can use
SetDlgItemText
either.Prasad Notifier using ATL | Operator new[],delete[][^]
-
Hello all, I have one Edit Control IDC_PATH , and some path in (LPARAM)szDir variable. Now I want to set the value of szDir in the IDC_PATH edit box , how to do this ?? Please can anyone tell me hw to do this .
SendDlgItemMessage(hwnd,IDC_PATH,(LPARAM)szDir,0,0);
I tried with this code its not working. What will be the error ? Edit/Delete Message And also I want to know how to disable and enable edit box ??? Thanking you, Suresh HC.Change
Suresh H wrote:
SendDlgItemMessage(hwnd,IDC_PATH,(LPARAM)szDir,0,0);
To
SendDlgItemMessage(hwnd,IDC_PATH, WM_SETTEXT, 0, (LPARAM)szDir);
Suresh H wrote:
And also I want to know how to disable and enable edit box ???
use:
BOOL EnableWindow(
HWND hWnd, // handle to window
BOOL bEnable // flag for enabling or disabling input
);If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
Suresh H wrote:
SendDlgItemMessage(hwnd,IDC_PATH,(LPARAM)szDir,0,0);
You passing wrong value as third parameter, it should be message to send(WM_SETTEXT in this case). Modify your code to,
SendDlgItemMessage(hwnd,IDC_PATH,WM_SETTEXT,0,(LPARAM)szDir);
You can use
SetDlgItemText
either.Prasad Notifier using ATL | Operator new[],delete[][^]
-
Most welcome ! :) Actually , I overseen your second question. But CPallini has answered that.
Prasad Notifier using ATL | Operator new[],delete[][^]
-
Change
Suresh H wrote:
SendDlgItemMessage(hwnd,IDC_PATH,(LPARAM)szDir,0,0);
To
SendDlgItemMessage(hwnd,IDC_PATH, WM_SETTEXT, 0, (LPARAM)szDir);
Suresh H wrote:
And also I want to know how to disable and enable edit box ???
use:
BOOL EnableWindow(
HWND hWnd, // handle to window
BOOL bEnable // flag for enabling or disabling input
);If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
Hi Pallini , Thank you very much its working. I did not understand how to enable and disable the edit box. Can u please tell me how to disable the edit box IDC_PATH ?
Suresh H wrote:
Can u please tell me how to disable the edit box IDC_PATH ?
HWND hEdit = GetDlgItem(hDlg,IDC_PATH);//hDlg handle to dialog
EnableWindow(hEdit,FALSE);//disables window
and
EnableWindow(hEdit,TRUE);//enables windowPrasad Notifier using ATL | Operator new[],delete[][^]
-
Suresh H wrote:
Can u please tell me how to disable the edit box IDC_PATH ?
HWND hEdit = GetDlgItem(hDlg,IDC_PATH);//hDlg handle to dialog
EnableWindow(hEdit,FALSE);//disables window
and
EnableWindow(hEdit,TRUE);//enables windowPrasad Notifier using ATL | Operator new[],delete[][^]