|
yes because you need to caption or NULL
m_ok.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);
to
m_ok.Create(NULL or "text",WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);
|
|
|
|
|
#include "stdafx.h"
#include "DesktopSearch.h"
#include "CreateDlg.h"
#include "UpdateDlg.h"
#include "FoldersDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCreateDlg dialog
CCreateDlg::CCreateDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCreateDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCreateDlg)
m_summary = -1;
//}}AFX_DATA_INIT
}
void CCreateDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCreateDlg)
DDX_Control(pDX, IDC_FolderSelect, m_FolderSelect);
DDX_Control(pDX, IDC_Enter_Location, m_Enter_Location);
DDX_Control(pDX, IDC_Enter_Name, m_name);
DDX_Control(pDX, IDC_OK, m_ok);
DDX_Radio(pDX, IDC_Summary_only, m_summary);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCreateDlg, CDialog)
//{{AFX_MSG_MAP(CCreateDlg)
ON_BN_CLICKED(IDC_FolderSelect, OnFolderSelect)
ON_BN_CLICKED(IDC_OK, OnOk)
ON_BN_CLICKED(IDC_Cancel, OnCancel)
ON_EN_CHANGE(IDC_Enter_Name, OnChangeEnterName)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCreateDlg message handlers
extern TCHAR szDir[MAX_PATH];
void CCreateDlg::OnFolderSelect()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
HWND hWnd = GetSafeHwnd();
CFoldersDialog objFD;
CString s1;
m_Enter_Location.GetWindowText(s1);
objFD.BrowseFolder(hWnd,s1);
m_Enter_Location.SetWindowText(szDir);
UpdateData(FALSE);
}
void CCreateDlg::OnOk()
{
// TODO: Add your control notification handler code here
int iResults; // This variable will capture the button selection
// Ask the user
iResults = MessageBox("Would u like to add documetns to the index now",
"Desktop Search",MB_YESNO | MB_ICONQUESTION);
// Determine which button the user clicked
// Give the user a message showing which button was clicked
switch (iResults)
{
case IDYES: // The Yes button?
//call the Update dialog window if user press yes
m_dUpdateDlg.DoModal ();
break;
case IDNO: // The No button?
OnOK();
break;
}
}
void CCreateDlg::OnCancel()
{
// TODO: Add your control notification handler code here
OnOK();
}
BOOL CCreateDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
// m_Enter_Location = "C:\\DesktopSearch\\Index\\";
UpdateData(FALSE);
CButton *pButton = (CButton*)this->GetDlgItem(IDC_OK);
pButton->EnableWindow(FALSE);
GotoDlgCtrl(GetDlgItem(IDC_OK));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCreateDlg::OnChangeEnterName()
{
CButton *pButton = (CButton*)this->GetDlgItem(IDC_OK);
pButton->EnableWindow(TRUE);
CString m_Test1;
CString m_Test2;
//ERROR!!! IT SAYS CREATE CANNOT HAVE 4 PARAMETERS
//m_ok.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);
// m_Enter_Location.Create(WS_CHILD|WS_VISIBLE,CRect(0,50,100,23),this,1);
m_Test1="C:\\DesktopSearch\\Index\\";
m_ok.SetWindowText(m_Test1);
m_ok.GetWindowText(m_Test2);
m_Enter_Location.SetWindowText(m_Test2);
}
for create it says create function cant have 4 parameters.
and to solve browsefolder problem i assigned a cstring object and passed it to browsefolder function(pls check the code)
during compilation it works fine. when i run it says "DEBUG ASSERTION FAILED"
what is wrong with my logic.pls check the code and let me know.
Thanks
|
|
|
|
|
I made changes as per ur suggestion. the following is the code
#include "stdafx.h"
#include "DesktopSearch.h"
#include "CreateDlg.h"
#include "UpdateDlg.h"
#include "FoldersDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCreateDlg dialog
CCreateDlg::CCreateDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCreateDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCreateDlg)
m_summary = -1;
//}}AFX_DATA_INIT
}
void CCreateDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCreateDlg)
DDX_Control(pDX, IDC_FolderSelect, m_FolderSelect);
DDX_Control(pDX, IDC_Enter_Location, m_Enter_Location);
DDX_Control(pDX, IDC_Enter_Name, m_name);
DDX_Control(pDX, IDC_OK, m_ok);
DDX_Radio(pDX, IDC_Summary_only, m_summary);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCreateDlg, CDialog)
//{{AFX_MSG_MAP(CCreateDlg)
ON_BN_CLICKED(IDC_FolderSelect, OnFolderSelect)
ON_BN_CLICKED(IDC_OK, OnOk)
ON_BN_CLICKED(IDC_Cancel, OnCancel)
ON_EN_CHANGE(IDC_Enter_Name, OnChangeEnterName)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCreateDlg message handlers
extern TCHAR szDir[MAX_PATH];
void CCreateDlg::OnFolderSelect()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
HWND hWnd = GetSafeHwnd();
CFoldersDialog objFD;
CString s1;
m_Enter_Location.GetWindowText(s1);
objFD.BrowseFolder(hWnd,s1);
m_Enter_Location.SetWindowText(szDir);
UpdateData(FALSE);
}
void CCreateDlg::OnOk()
{
// TODO: Add your control notification handler code here
int iResults; // This variable will capture the button selection
// Ask the user
iResults = MessageBox("Would u like to add documetns to the index now",
"Desktop Search",MB_YESNO | MB_ICONQUESTION);
// Determine which button the user clicked
// Give the user a message showing which button was clicked
switch (iResults)
{
case IDYES: // The Yes button?
//call the Update dialog window if user press yes
m_dUpdateDlg.DoModal ();
break;
case IDNO: // The No button?
OnOK();
break;
}
}
void CCreateDlg::OnCancel()
{
// TODO: Add your control notification handler code here
OnOK();
}
BOOL CCreateDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
// m_Enter_Location = "C:\\DesktopSearch\\Index\\";
UpdateData(FALSE);
CButton *pButton = (CButton*)this->GetDlgItem(IDC_OK);
pButton->EnableWindow(FALSE);
GotoDlgCtrl(GetDlgItem(IDC_OK));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCreateDlg::OnChangeEnterName()
{
CButton *pButton = (CButton*)this->GetDlgItem(IDC_OK);
pButton->EnableWindow(TRUE);
CString m_Test1;
CString m_Test2;
//ERROR!!! IT SAYS CREATE CANNOT HAVE 4 PARAMETERS
//m_ok.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);
// m_Enter_Location.Create(WS_CHILD|WS_VISIBLE,CRect(0,50,100,23),this,1);
m_Test1="C:\\DesktopSearch\\Index\\";
m_ok.SetWindowText(m_Test1);
m_ok.GetWindowText(m_Test2);
m_Enter_Location.SetWindowText(m_Test2);
}
for create it says create function cant have 4 parameters.
and to solve browsefolder problem i assigned a cstring object and passed it to browsefolder function(pls check the code)
during compilation it works fine. when i run it says "DEBUG ASSERTION FAILED"
what is wrong with my logic.pls check the code and let me know.
Thanks
-- modified at 3:48 Thursday 13th April, 2006
|
|
|
|
|
If you add a EN_CHANGE handler for the first control, you can then read the changed text, put it on the end of location text, and update the location edit control.
ON_EN_CHANGE is the key you are looking for, I think.
Iain.
|
|
|
|
|
hi all,
I am using the following code to mute the speaker control.But i am not able to disable the speaker control.Can anyone please tell me how to do it.Disable in the sense that user should not be able to access the speaker control.
|
|
|
|
|
Sorry ,i forgot to put the code.The code is as shown below::
MMRESULT result;
HMIXER hMixer;
result = mixerOpen(&hMixer, MIXER_OBJECTF_MIXER, 0, 0, 0);
//obtain a handle to the mixer device.
if(result!=MMSYSERR_NOERROR)
{
::MessageBox(NULL,"Mixer could not be opened","1",MB_OK);
return;
}
//we need to get the speaker line of the mixer device
MIXERLINE ml = {0};
ml.cbStruct = sizeof(MIXERLINE);
ml.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
result = mixerGetLineInfo((HMIXEROBJ) hMixer,&ml, MIXER_GETLINEINFOF_COMPONENTTYPE);
//we need to get the volume control of the speaker line.
MIXERLINECONTROLS mlc = {0};
MIXERCONTROL mc = {0};
mlc.cbStruct = sizeof(MIXERLINECONTROLS);
mlc.dwLineID = ml.dwLineID;
mlc.dwControlType = MIXERCONTROL_CONTROLTYPE_MUTE;
mlc.cControls = 1;
mlc.pamxctrl = &mc;
mlc.cbmxctrl = sizeof(MIXERCONTROL);
result = mixerGetLineControls((HMIXEROBJ)hMixer,
&mlc, MIXER_GETLINECONTROLSF_ONEBYTYPE);
//we set the mute and unmute values
MIXERCONTROLDETAILS mcd = {0};
MIXERCONTROLDETAILS_UNSIGNED mcdu = {0};
mcdu.dwValue = 65535; //0 for unmute and //65535 for mute.
mcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mcd.hwndOwner = 0;
mcd.dwControlID = mc.dwControlID;
mcd.paDetails = &mcdu;
mcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
mcd.cChannels = 1;
result = mixerSetControlDetails((HMIXEROBJ)hMixer,
&mcd, MIXER_SETCONTROLDETAILSF_VALUE);
|
|
|
|
|
ashwath2005 wrote: mcdu.dwValue = 65535; //0 for unmute and //65535 for mute.
Your comment is wrong.
So what's not working? What is the value of result ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Sorry,Mute and Unmute are working fine.I have written the following code to disable the mute control,but it is not working.
MIXERCONTROL mc = {0};
mc.fdwControl=MIXERCONTROL_CONTROLF_DISABLED;
Please Help.
|
|
|
|
|
ashwath2005 wrote: Please Help.
I'd like to but without knowing what those functions are returning, it's not possible.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi,
I have written the following code for disabling the MUTE control,
MMRESULT result;
HMIXER hMixer;
result = mixerOpen(&hMixer, MIXER_OBJECTF_MIXER, 0, 0, 0);
//obtain a handle to the mixer device.
if(result!=MMSYSERR_NOERROR)
{
::MessageBox(NULL,"Mixer could not be opened","1",MB_OK);
}
//we need to get the speaker line of the mixer device
MIXERLINE ml = {0};
ml.cbStruct = sizeof(MIXERLINE);
ml.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
result = mixerGetLineInfo((HMIXEROBJ) hMixer,&ml, MIXER_GETLINEINFOF_COMPONENTTYPE);
if(result!=MMSYSERR_NOERROR)
{
::MessageBox(NULL,"mixerGetLineInfo failed","1",MB_OK);
}
//we need to get the volume control of the speaker line.
MIXERLINECONTROLS mlc = {0};
MIXERCONTROL mc={0};
mc.fdwControl=MIXERCONTROL_CONTROLF_DISABLED;
mlc.cbStruct = sizeof(MIXERLINECONTROLS);
mlc.dwLineID = ml.dwLineID;
mlc.dwControlType = MIXERCONTROL_CONTROLTYPE_MUTE;
mlc.cControls = 1;
mlc.pamxctrl = &mc;
mlc.cbmxctrl = sizeof(MIXERCONTROL);
result = mixerGetLineControls((HMIXEROBJ)hMixer,
&mlc, MIXER_GETLINECONTROLSF_ONEBYTYPE);
if(result!=MMSYSERR_NOERROR)
{
::MessageBox(NULL,"mixerGetLineControls failed","2",MB_OK);
}
//we set the mute and unmute values
MIXERCONTROLDETAILS mcd = {0};
MIXERCONTROLDETAILS_UNSIGNED mcdu = {0};
mcdu.dwValue =lVal; //0 for unmute and //65535 for mute.
mcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mcd.hwndOwner = 0;
mcd.dwControlID =mc.dwControlID;
mcd.paDetails = &mcdu;
mcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
mcd.cChannels = 1;
result = mixerSetControlDetails((HMIXEROBJ)hMixer,
&mcd, MIXER_SETCONTROLDETAILSF_VALUE);
if(result!=MMSYSERR_NOERROR)
{
::MessageBox(NULL,"mixerSetControlDetails failed","3",MB_OK);
}
The above code does not disable the MUTE control.
I have checked all the return values,all of them return MMSYSERR_NOERROR as the return value.
Kindly help me to fix this problem.
|
|
|
|
|
ashwath2005 wrote: Kindly help me to fix this problem.
What exactly are you expecting this code to do, disable the Mute all checkbox? If so, see here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi,
I want the code to GRAY the "Mute all" Check box so that user does not have access to it.
|
|
|
|
|
Then you'll need to get a handle to that control (id = 0x3e8) and call EnableWindow(FALSE) .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi,
How should i get the handle to the control.Which API should i use.
Please Help
Thanks,
-- modified at 10:23 Tuesday 11th April, 2006
|
|
|
|
|
ashwath2005 wrote: How should i get the handle to the control.Which API should i use.
Try FindWindow() and/or FindWindowEx() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi,
I used the following code to GRAY the "Mute all" check box,but it is not working.Is there any other method.
HWND hwnd1=::FindWindow(NULL,"Volume Control");
HWND hwnd=::GetDlgItem(hwnd1,0x3e8);
::EnableWindow(hwnd,FALSE);
|
|
|
|
|
ashwath2005 wrote: I used the following code to GRAY the "Mute all" check box,but it is not working.
Your code snippet worked fine for me.
ashwath2005 wrote: Is there any other method.
No. What you have will work.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi,
I am using Windows XP machine.Which system are you using.May be it does not work on XP system.
|
|
|
|
|
hi,
It worked for me also ,but it works only when the "Volume Control" window is opened and then you execute the code snippet.What should happen is that even when the "Volume Control" window is closed and then you excute the code snippet,it should work.
|
|
|
|
|
ashwath2005 wrote: ...but it works only when the "Volume Control" window is opened
Of course. What else would you expect? The Mute all checkbox does not exist otherwise.
ashwath2005 wrote: What should happen is that even when the "Volume Control" window is closed and then you excute the code snippet,it should work.
Lots of luck to you. It's impossible to manipulate a window/control that does not exist.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi,
ok then is there a way to GRAY the volume control icon in the task bar.
|
|
|
|
|
Why would you even consider doing this? Do you not think that the user would be somewhat annoyed that they could not change the volume on their computer? How friendly would that be?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi,
There is such a requirement in my project.I should do it.
Could you help please.
|
|
|
|
|
ashwath2005 wrote: There is such a requirement in my project.
Just because it is a requirement does not make it a good idea. Please explain what you are doing and maybe we could could come up with an alternative solution that is more practical.
ashwath2005 wrote: Could you help please.
I just made eight posts to this thread. Don't you think I would have helped if I could? Do you think that I am purposely withholding information?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi,
In our project there is an option to Control the Volume of audio of the system,so when the user does control the volume through our software,he should not be allowed to go and change the volume through the system.
|
|
|
|
|