|
I am creating a static library.
In that i am linking to a third pary lib named xyz.lib.
LNK1241: resource file xyz.lib(abc.res) already specified
How to resolve this error?
|
|
|
|
|
KASR1 wrote: How to resolve this error?
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi all..
i need a help regarding editbox in MFC....
i've been trying to make a simple exe for entering some text and then save it in a text format...
The string size for member variable which i've given is around 1000... after entering 255 characters the cursor moves to the top of edit box and allows to enter there until it completes 1000 characters.. but then iam not able to select using cursor.. it jumps automatically to the start position...
iam very new to VC++ .. plz help out to solve this pblm..
thanks is advance.....
|
|
|
|
|
sonualex wrote: plz help out to solve this pblm..
This is not default behavior, so whatever code you've added for setting the cursor position within the edit control needs to be removed/changed.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
thanku so much David for the response..
actually i havnt written any code for edit box because all the data entered in edit box are assigned to the memeber variable of string type via class wizards..
so i dnt knw what to add for setting cursor and where..
Iam saving my data to a text file after also...
|
|
|
|
|
sonualex wrote: ...all the data entered in edit box are assigned to the memeber variable of string type via class wizards..
Use a CEdit member variable instead.
sonualex wrote: so i dnt knw what to add for setting cursor and where..
Your requirements do not indicate a need to set the cursor.
All you need to do is call m_edit.SetLimitText(1000) in the dialog's OnInitDialog() method. When you are ready to get the text to write to the file, just call m_edit.GetWindowText() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
thanks again david..
lemme make it some more clear now.. i have already assigned the member variable to CString and iam appending the text to another CString...
i tried ur method but den realised the above mentioned pblm.. how can i solve that....
iam putting my piece of code for saving the text here.. plz do check...
void CNoteDlg::OnSave()
{
UpdateData(TRUE);
static char BASED_CODE szFilter[] = "Text files (*.txt)|*.txt||";
char nextline[3];
nextline[0] = 0x0D;
nextline[1] = 0x0A;
nextline[2] = 00;
CString S1;
CFile flEdit;
CFileDialog FileDlg(FALSE, ".txt","Prioritynotes",
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);
if( FileDlg.DoModal() == IDOK )
{
if( flEdit.Open(FileDlg.GetFileName(), CFile::modeCreate | CFile::modeWrite) == FALSE )
return;
S1 += "Critical****";
S1 += nextline;
S1 += "--------------------------";
S1 += nextline;
S1 += m_sedit1;
S1 += nextline;
S1 += nextline;
S1 += "Important***";
S1 += nextline;
S1 += "--------------------------";
S1 += nextline;
S1 += m_sedit2;
S1 += nextline;
S1 += nextline;
S1 += "Less Important**";
S1 += nextline;
S1 += "--------------------------";
S1 += nextline;
S1 += m_sedit3;
S1 += nextline;
S1 += nextline;
S1 += "Normal*";
S1 += nextline;
S1 += "--------------------------";
S1 += nextline;
S1 += m_sedit4;
S1 += nextline;
flEdit.Write(S1.GetBuffer(S1.GetLength()), S1.GetLength());
flEdit.Close();
}
else
return;
}
|
|
|
|
|
sonualex wrote: i tried ur method but den realised the above mentioned pblm.. how can i solve that....
What problem?
sonualex wrote: CFile flEdit;
Should you be using CStdioFile instead?
sonualex wrote: flEdit.Write(S1.GetBuffer(S1.GetLength()), S1.GetLength());
What's wrong with just:
flEdit.Write(S1, S1.GetLength()); sonualex wrote: else
return;
Unnecessary.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
hii david...
how can i assign the CEdit m_edit variable with the string which we add in edit box ??
With the previous code how can i modify and make it work....
|
|
|
|
|
sonualex wrote: how can i assign the CEdit m_edit variable with the string which we add in edit box ??
SetWindowText() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
hi david..
i tried with SetWindowText too.. but i cant find any change ...
can u plz mention where exaclty i have to add these changes for making this work..
anythng to be changed in class wizards ?
thanku so much
|
|
|
|
|
sonualex wrote: can u plz mention where exaclty i have to add these changes for making this work..
You call SetWindowText() wherever you want the contents of the edit control changed.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
thanks david for ur help...
SetLimitText is giving an assertion failure once i keep it in OnInitDialog()...
SetWindowText and GetwindowText as per my understanding should be kept where we change the text in edit box.. as i told earlier i have not created any function for editbox...
my understanding is the text we enter in editbox is
m_sedit1 = _T("") which is in
CNoteDlg::CNoteDlg(CWnd* pParent /*=NULL*/): CDialog(CNoteDlg::IDD, pParent)
and the ::DoDataExchange(pDx)
DDV_MaxChars(pDX, m_sedit1, 1000);
plz letme knw if im not giving u the correct picture of my code...
hope u wud continue helping me..
thanku so much
|
|
|
|
|
sonualex wrote: SetLimitText is giving an assertion failure once i keep it in OnInitDialog()...
What does the suspect code look like?
sonualex wrote: SetWindowText and GetwindowText as per my understanding should be kept where we change the text in edit box.. as i told earlier i have not created any function for editbox...
I'm not sure what a "function for editbox" is.
sonualex wrote: my understanding is the text we enter in editbox is
m_sedit1 = _T("") which is in
I indicated here that you should use a CEdit object instead.
sonualex wrote: plz letme knw if im not giving u the correct picture of my code...
I know exactly what you are doing, but you have to be willing to implement my suggestions.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi david ...
Iam following ur suggestions truely...thanku so much for ur patience...
Asserion faliure is showing in AFXWIN2.lnl line 881....
Dont know how to solve that...
OnInitDialog is not allowing to keep CEdit m_edit1;
m_edit1.SetLimitText (1000); in it....
What i meant by function is if we click on EN_CHANGE it will ask for add function OnChangeEdit1()..
Presently iam stuck with CEdit SetlimitText,SetWindowText and GetWindowText..
plz bear with me
|
|
|
|
|
sonualex wrote: Iam following ur suggestions truely...thanku so much for ur patience...
Asserion faliure is showing in AFXWIN2.lnl line 881....
Dont know how to solve that...
You should start by looking at line #881 of afxwin2.inl. It is asserting that a valid window handle exists, which obviously does not.
sonualex wrote: OnInitDialog is not allowing to keep CEdit m_edit1;
Are you declaring this variable in OnInitDialog() ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
hello david .. im in right track now.. thanks for ur immense support..
now im able to limit the text.. cursor pblm is solved..
but at the same time.. i have been using CString for saving and opening the contents in edit box now how can i do that using CEdit..
hope u remembr my piece of code for OnSave and OnOpen earlier posted ....
|
|
|
|
|
sonualex wrote: ...i have been using CString for saving and opening the contents in edit box now how can i do that using CEdit.
By using SetWindowText() and GetWindowText() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
thanks a lot David... it worked perfectly...
thanku so much...
|
|
|
|
|
hi der David... it worked perfectly...
thanku so much... thanks a ton
|
|
|
|
|
I have written Installation using Visual Studio 2008 Setup project. I have created a GUI for installing specific product (using check box dialog). but I need the same gui for uninstallation also.
Means if unchecked that product should be uninstalled. all other products should remain same. any suggestion how to do it in Visual Studio 2008 setup project.I used only C++ base installation. No .net dependencies.
|
|
|
|
|
Hi,
I have been using DDX_CONTROL to Attach My Cricheditctrl to my resource multiline edit control
For some reason this stops the CRichedit.Streamin from working
With ::Create no problem
Was wondering if anybody had any insights
As I always like to know the reason why things work or Don't
thankx...
|
|
|
|
|
Please explain what you mean by "stops from working". Does it crash, does it stop on an assert, does it simply not load the content? How and where did you try to use it?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
The content doesn't load
Maybe the FrameWork expects me to use DDX
to read and write data after connecting the
resource item to the CRichEditctrl object don't
know
but If I do CRichedictrlptr *CRicheditrl =
CDialog.GetDlgItem(IDC_RICHEDIT)
I able to populate the Richedit using the
Streamin method
|
|
|
|
|
ForNow wrote: Maybe the FrameWork expects me to use DDX
to read and write data after connecting the
resource item to the CRichEditctrl object
I highly doubt that.
Could it be that maybe you are trying to load that content before DoDataExchange runned?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|