|
Cedric Moonen wrote: No, just go to hell"
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Why not just right-click his name, and select View Source from the context menu?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
I want to change the caption of the button in a property sheet. I have use the following code to get OK, Cancel and Help button,
MyPropSheet.m_psh.dwFlags |= PSH_NOAPPLYNOW | PSH_PROPTITLE ;
MyPropSheet.m_psh.pszCaption = "Simple";
Now I want the caption of the OK button to be "Submit" or "Go"... How to change the caption?
|
|
|
|
|
Use this code:
GetDlgItem(IDC_YOURBUTTONID)->SetWindowText("Text");
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
The problem I am facing is button is not created by me, so unable to get the ID. Its the default button of property sheet. (Just like the OK button in MessageBox).. I have tried the same code with a button ID IDOK but its not working.
|
|
|
|
|
Try out EnumChildWindows(Provided that the property sheet doesnt have many child controls) then check for the text if its the one you want to change then change the text of that control with your one.
Regards,
FarPointer
|
|
|
|
|
Aryan S wrote: I have tried the same code with a button ID IDOK but its not working.
What code are you using, and where?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Hi DavidCrow,
The same code means GetDlgItem(nId)->SetWindowText(szString);
But I am unable to change the caption of the default OK button.
|
|
|
|
|
What is the value of nId ? Where is this code called from?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
The value of nID is IDOK. The code is called in OnInitDialog(), I have tried the same code in OnSetActive() also. Should I call this code from some other function?
|
|
|
|
|
Aryan S wrote: The code is called in OnInitDialog()...
Of the sheet or a page?
Aryan S wrote: ...I have tried the same code in OnSetActive() also.
Which obviously won't work as the buttons belong to the sheet.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
This[^] article explains how to do it.
The ID is IDOK BTW - I noticed in another response you said you tried GetDlgItem(IDOK)->SetWindowText("Submit"); or something, and it didn't work - make sure you're calling GetDlgItem on the correct object, as that will work - I've just checked, as I've done it myself
- Dy
|
|
|
|
|
The problem here is I have not created any class which is derived from CPropertySheet. I am using the follwing code in OnOK function of the previous dialog,
CPropertySheet CPrinterProperties("Hello");
CPropPage stylePage;
CPrinterProperties.AddPage(&stylePage);
CPrinterProperties.m_psh.dwFlags |= PSH_NOAPPLYNOW;
And I have created the PropertyPage differently. Now how can I change the caption of the button.
|
|
|
|
|
Aryan S wrote: The problem here is I have not created any class which is derived from CPropertySheet.
You need to. You can use the following basic object to do what you're trying to do:
class CMyPropertySheet : public CPropertySheet
{
public:
CMyPropertySheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
CMyPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
public:
virtual BOOL OnInitDialog();
};
CMyPropertySheet::CMyPropertySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
}
CMyPropertySheet::CMyPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
}
BOOL CMyPropertySheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
CWnd *wnd = GetDlgItem(IDOK);
ASSERT(wnd);
if (wnd)
wnd->SetWindowText("changed");
return bResult;
}
Now to use it, change the code you supplied to read:
CMyPropertySheet CPrinterProperties("Hello");
CPropPage stylePage;
CPrinterProperties.AddPage(&stylePage);
CPrinterProperties.m_psh.dwFlags |= PSH_NOAPPLYNOW;
CPrinterProperties.DoModal();
- Dy
|
|
|
|
|
|
I need to create a Graphical User Interface with vc++ for a Neural Net program while i am just familiar with vc++, so i need a detailed fast guide,
thanks
|
|
|
|
|
This question is so vague that it's seems impossible to give any sensible answers. Can you be more specific?
Steve
|
|
|
|
|
there is a NN program,i need to have a GUI for entering the input parametrs such as number of hidden layers,number of neurons ,learning rate ,... actually i must have a window for entering all input parametrs then the usr press start to run the program and recieve the minimal error for test set
|
|
|
|
|
really i need to creat an apllication or exe,i think
|
|
|
|
|
http://www.codeproject.com/cpp/gestureapp.asp
http://www.codeproject.com/library/Fann.asp
There is a search box on top of each page, why don't you use it first ?
Kochise
In Code we trust !
|
|
|
|
|
|
Hi,
I want to run the Application at system startup( when ever its start/boots up) without placing its EXE in startup folder.
Any idea / link ?
Thanks
Regards.
|
|
|
|
|
you can start it by creating new string key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run ( for all users )
or
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run ( execute only if current user login again) in registry, which should contain the path to your application. you can give any name to this key
-Sarath
|
|
|
|
|
Put the Full path of the Application (.exe)into the registry under
for local machine accessible for all users
HKLM\Software\microsoft\windows\CurrentVersion\Run
for the particular user
HKCU\Software\microsoft\windows\CurrentVersion\Run
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
There are 2 places in the registry that you can use for this:
If you only want to run your application once on the next startup then add a new key to
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\"
If you want your exe to run every time windows is started then make a new key in
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\"
Don't think you are, know you are...
custom hardware & software - olloc.be
|
|
|
|