|
Hi waldermort ,
(Do you find your answer?LNK2005)
please tell me why you said this is easy?
It's not easy because
example:
(I'm new to visuall c and then I have question similar to this)
well Is this easy for me?
|
|
|
|
|
WhiteSky wrote: (Do you find your answer?LNK2005)
Yes I found the answer to my LNK1169 thanks to the help of some better experienced forum users. Though I don't see how this relates to the OP's question.
OK, granted, the question may be a little difficult for some people. After all you need to be a brain surgeon to type in 'registry' to the MSDN search box. I stand by my answer in that the OP should search before posting, which if he had done he could either have tried the function and asked for help with his errors, or simply state that he does not understand them.
If you re-read my LNK1169 thread, I think you will find I had stated exactly what I had coded, how I had tried to fix and that I still couldn't understand why, hence my post. I did not simply write "I have a link error how can I fix it?".
|
|
|
|
|
|
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 have a edit box named as NAME and a OK button in a dialog box.initially when the dialog box is loaded the OK button will be disabled. when i enter a character in edit box the OK button shud be enabled. if the edit box is empty then OK button must be disabled.
Also i have one more edit box called as "location" which contains some text. as and when i type sumthing in "NAME" edit box,it shud be appended with text in "location" edit box.how do i do this and where shud i add the code.
pls help
Thanks
|
|
|
|
|
sudeep_br wrote: i have a edit box named as NAME and a OK button
Handle EN_CHANGE message for your edit box in your appplication..for reteriving value from edit box using GetWindowText api, based on it value either append it in location box using GetWindowText and SetWindowText or Disable the Edit Box using EnableWindow(...) if empty value has been entered
|
|
|
|
|
ThatsAlok wrote: Handle EN_CHANGE message for your edit box in your appplication..for reteriving value from edit box using GetWindowText api, based on it value either append it in location box using GetWindowText and SetWindowText or Disable the Edit Box using EnableWindow(...) if empty value has been entered
when i enter sum text in edit box the OK button is enabled but when i delete the entered text,the ok button shud be disabled again. how to do this?
ALSO
i have 2 radio buttons in a dialog box. i want to either of them to be checked(ie t shud be selected) when dialog box is first loaded. pls help.
Thanks
|
|
|
|
|
sudeep_br wrote: when i enter sum text in edit box the OK button is enabled but when i delete the entered text,the ok button shud be disabled again. how to do this?
same way after seeing the length of text disable with EnableWindow Api
|
|
|
|
|
Its better u read VC++ in 21 days
|
|
|
|
|
parichaybp wrote: Its better u read VC++ in 21 day
Nice book!
|
|
|
|
|
Something like:
void CMyDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EDIT, m_edit);
DDX_Control(pDX, IDOK, m_ok);
}
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
ON_EN_CHANGE(IDC_EDIT, OnChange)
END_MESSAGE_MAP()
void CMyDialog::OnChange()
{
m_ok.EnableWindow(m_edit.GetWindowTextLength() > 0);
}
"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
|
|
|
|
|
DavidCrow wrote: void CMyDialog::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMyDialog) DDX_Control(pDX, IDC_EDIT, m_edit); DDX_Control(pDX, IDOK, m_ok); //}}AFX_DATA_MAP} BEGIN_MESSAGE_MAP(CMyDialog, CDialog) //{{AFX_MSG_MAP(CMyDialog) ON_EN_CHANGE(IDC_EDIT, OnChange) //}}AFX_MSG_MAPEND_MESSAGE_MAP() void CMyDialog::OnChange() { m_ok.EnableWindow(m_edit.GetWindowTextLength() > 0);}
when i entered the above code i got the following error
" error C2039: 'GetWindowTextLengthA' : is not a member of 'CString'"
pls tell me the solution for this
Thanks
|
|
|
|
|
You should not be using a CString object for an edit control. Use CEdit instead.
"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
|
|
|
|
|
DavidCrow wrote: void CMyDialog::OnChange() { m_ok.EnableWindow(m_edit.GetWindowTextLength() > 0);}
I am getting this error "'GetWindowTextLengthA' : is not a member of 'CString'"
u suggested Cedit instead of Cstring for edit box but when i go to class wizard and then to member variable name i only have cstring as variable type option apart from int, bool etc. theres no option Cedit. what should i do?
Regards
|
|
|
|
|
sudeep_br wrote: ...but when i go to class wizard and then to member variable name i only have cstring as variable type option apart from int, bool etc. theres no option Cedit. what should i do?
Change the Category from Value to Control.
"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 all ,
i want to get the path for ping.exe which will be in \\Windows\\System32\\Ping.exe but i cant specify a particular drive(C,D...) because the OS can be installed in any drive.I need to get the exact path of ping.exe .
Please suggest me how do i look for it.
|
|
|
|
|
|
|
hi all
I am not able to find the short cut keys which enables us to toggle from workspace window to .cpp window ..in VC IDE.
Does anyone know please?
redindian
|
|
|
|
|
to go to Solution explorer Ctrl + Alt + L
to go to resource view ctrl + shift + e
|
|
|
|
|
I have a visual c++ program, it worked nicely for data processing.
Recently I added a edit box and add more code in the "next" subroutine.
The program is complied and generated *.exe successfully. This routine
should be invocated by pressing "Next" button.
Now when I run the program and push the "Next" button, I got:
<data_proc mfc="" application="" has="" encountered="" a="" problem=""
and="" needs="" to="" close.="" we="" are="" sorry="" for="" the="" inconvenience.="">
I tried to display some variable values at the right beginning of
the subroutine Next, it seems the program even not reach the point.
I do not know how to fix this. I need a help.
Thanks
-- modified at 23:56 Sunday 9th April, 2006
|
|
|
|
|
hi there
paste the code which is called in the event handler ..
redindian
|
|
|
|
|
#include <string>
#include "stdafx.h"
#include "data_vib_proc.h"
#include "feature_display.h"
#include "data_vib_procDlg.h"
#include "test_window.h"
#include "cmath"
using std::string;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CData_vib_procDlg dialog
CBlast_vib_procDlg::CBlast_vib_procDlg(CWnd* pParent /*=NULL*/)
: CDialog(CBlast_vib_procDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CData_vib_procDlg)
m_linklist_file_Name = _T("");
m_monitors_coord = _T("");
m_output_file_name = _T("");
m_seed_waveform_input = _T("");
m_predicted_waveform_output = _T("");
m_prediction_monitor_no = 1;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
....
....
....
void CData_vib_procDlg::Next()
{
FILE *f_ptr1;
FILE *f_ptr2;
FILE *f_ptr3;
FILE *f_ptr4;
FILE *f_ptr5;
const int MAX=15;
CString title_seed_file;
// ifstream f_ptr3;
float f0 = 30.0;
int nz,nz1,ndeck2;
float ppv_pred, ppa_pred, pi = 3.1415926f;
char buffer[MAX];
CBlast_vib_procDlg rr;
feature_display ff;
test_window twindow;
// TODO: Add your control notification handler code here
//
twindow.m_test_variable = int(1.5);
twindow.DoModal();
UpdateData(false);
UpdateData();
if(m_linklist_file_Name == "" || m_monitors_coord == ""||m_output_file_name=="" || m_si_waveform_input == ""||m_predicted_form_output=="")
{
MessageBox("All file names have to be typed in !");
rr.m_linklist_file_Name = m_linklist_file_Name;
rr.m_monitors_coord = m_monitors_coord;
rr.m_output_file_name = m_output_file_name;
rr.m_si_form_input = m_si_form_input;
rr.m_predicted_form_output = m_predicted_form_output;
rr.m_prediction_monitor_no = m_prediction_monitor_no;
rr.DoModal();
UpdateData(false);
}
// open linklist data file
if((f_ptr1 = fopen(m_linklist_file_Name,"r")) == NULL) {
MessageBox("Linklist file open problems !");
rr.m_linklist_file_Name = m_linklist_file_Name;
rr.m_monitors_coord = m_monitors_coord;
rr.m_output_file_name = m_output_file_name;
rr.m_si_form_input = m_si_form_input;
rr.m_predicted_form_output = m_predicted_form_output;
rr.m_prediction_monitor_no = m_prediction_monitor_no;
rr.DoModal();
UpdateData(false);
}
// open monitor coordinates data file
.....
.....
|
|
|
|
|
Set a breakpoint in the Next() method and single-step through it from that point.
mrby123 wrote: twindow.DoModal();
Is this dialog displayed?
mrby123 wrote: UpdateData(false);
UpdateData();
Consider removing these. Used incorrectly, which it looks as though they are, can lead to all sorts of unwanted problems.
What does the message map for CData_vib_procDlg look like?
"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
|
|
|
|