|
Hi Jetli,
Thanks for the responce. I tryed with that code i am getting error
<br />
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(<dilogs handle="" hwnd=""> , IDC_PATH, szDir);
Refer MSDN.
If u can Dream... U can do it
|
|
|
|
|
Hi krishna,
I am using Win 32 Application.
|
|
|
|
|
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
|
|
|
|
|
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.
|
|
|
|
|
Hi Prasad,
Its working thank you very much.
|
|
|
|
|
Most welcome !
Actually , I overseen your second question. But CPallini has answered that.
|
|
|
|
|
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,
BOOL bEnable
);
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);
EnableWindow(hEdit,FALSE);
and
EnableWindow(hEdit,TRUE);
|
|
|
|
|
Hi Prasad,
Thank you once again its working.
|
|
|
|
|
Hi All,
The MeasureItem is called for owner draw menu at the time of creation. But how can I invoke it again (for some size changes)?
Thank you.
- NS -
|
|
|
|
|
it will be automatically called when the menu needs to shown (in the case menu item). if it is a main menu try invalidating the main window.
If u can Dream... U can do it
|
|
|
|
|
krishnadevank wrote: it will be automatically called when the menu needs to shown
No, it will be called, when menu is created, just once.
|
|
|
|
|
u r right prasad . But i found a solution. U can just add items again. so that measure message will be sent again. in this case reload all items will work , i think.
If u can Dream... U can do it
|
|
|
|
|
I am discussing about context menu. And SendMessage to which window? Please explain.
- NS -
|
|
|
|
|
Do you mean SendMessage WM_MEASUREITEM? Then what about the wParam and lParam?
As per MSDN this message is sent by the system. Please explain.
- NS -
|
|
|
|
|
I have a ownerdrawn menu which is already created. But i need to change the text after some time. If the text is larger than the previous one it will be clipped. So need to update the menu size. Thats all.
- NS -
|
|
|
|
|
How you are setting this text ?
One solution could be, Keep member variable of type CString for youe menu class.
Keep a function, that will set this text. And while setting this text, use CDC::GetTextExtent to calculate string size. and Use CWnd::MoveWindow for changing its size.
void CMyMenu::SetText(CString& sText)
{
CPaintDC dc(this);
CSize szSize = dc.GetTextExtent(sText);
..logic to decide menu size
MoveWindow(..);
}
I've not tested this code.
|
|
|
|
|
Try adding a new item to combo.
-- modified at 9:13 Thursday 28th December, 2006
if u want to calcualte the size of items , try adding all items again. I check it with combox with style Variable.
This time measure items will be called .
Happy coding.
If u can Dream... U can do it
|
|
|
|
|
I need help regarding windows registry.
I want to list all the subKeys under a root Key using VC++ 6.0.
-VIKRAM
Trainee (Extenprise E Soln)
www.extenprise.com
|
|
|
|
|
look RegEnumKeyEx in MSDN .(samples also avilable)
If u can Dream... U can do it
|
|
|
|
|
Thanks ..
|
|
|
|
|
|
its help ful .. thanks..;P
|
|
|
|