|
May be you could have an overloaded constructor for your second dialog, which accepts a pointer to a string.
Step 1: In your first dialog:
#include "NewDlg.h"
CString cst;
CNewDlg cnd(&cst);
if(cnd.DoModal() == IDOK);
AfxMessageBox(cst);
Step 2: Overloaded constructor of the new dialog:
CNewDlg::CNewDlg(CString *str, CWnd *pParent):
CDialog(CNewDlg::IDD, pParent), m_str(str)
{
}
Step 3: In the OnOK() handler of the second dialog:
CString szVal;
m_edit.GetWindowText(szVal);
*m_str = szVal;
CDialog::OnOK();
A crude way, but it works.
|
|
|
|
|
Hi,
I have many dialog windows in my program.Some of them are child window.I want to know that which button has the focus in a certain time.Actually,I want to do that the button will be pressed which has the focus in a certain time.How can I do that?
Thanks,
ibrahim
|
|
|
|
|
The solution is not as straight forward as seems to be. My first approach was to handle WM_SETFOCUS, but it will not work. But I have faced a similar situation my requirement was different. So let me give you the solution, just override OnCommand & check for notification code of WPARAM.
|
|
|
|
|
hi
this is my code ..its working good in 3digit sorting algorithm.
#define next(i) ((i) < 5 ? (i) + 1 : 1)
#define previous(i) ((i) > 1 ? (i) - 1 : 1)
int main()
{
unsigned long i, aux, j, cnt;
for (i=1 ; i<6 ; i++)
{
for (aux = next(i) ; aux != previous(i) ; aux = next(aux))
{
cout << i << aux << next(aux) << endl;
}
}
return 0;
}
But, i replaced 5 into 100 ..its showing wrong sorting why?
#define next(i) ((i) < 100 ? (i) + 1 : 1)
#define previous(i) ((i) > 1 ? (i) - 1 : 1)
int main()
{
unsigned long i, aux, j, cnt;
for (i=1 ; i<101 ; i++)
{
for (aux = next(i) ; aux != previous(i) ; aux = next(aux))
{
cout << i << aux << next(aux) << endl;
}
}
return 0;
}
Thanks and Regards
Nisha.S
|
|
|
|
|
That is because you didn't try to get into the code you were given yesterday (that works with 3 digits) . It would be better for you to understand the algorithm for 3 digits before you move ahead to implement the second one. BTW what happens when you try and debug your new code?
And the error displayed is...........................
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Use netstat.
netstat -p TCP /b to list all opened TCP ports along with the exe's name.
or
see telnet
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hello everyone,
I have successfully setup remote debugger for Visual Studio. My question is about how it works internally to match remote execution binary to source codes on host machine. Any points for how it does the match? Do I need to deploy the same PDB to both remote and host machine?
thanks in advance,
George
|
|
|
|
|
|
Because none of those make sense used on a class member.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
but when we write like
class a
{
int i;
};
then obviously by default data type of i is auto int
my question is why compiler don't accept this,and why none of those make sense as you wrote.
if u have any link related to this question please send me
thank u in advance
|
|
|
|
|
rajneshmalik wrote: then obviously by default data type of i is auto int
No, it isn't. i is a class member.
auto variables have a local lifetime - the lifetime of i is determined by the
lifetime of the object it is in.
register - same thing. You've only declared i. Until there's an instance of an "a" object,
i doesn't exist. How, then, can you give i a storage specifier?
extern? Makes NO sense. How can a member of an object be somewhere else - some external location?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all..
I want to compare two xml files using vc++ and store the output in the xml format...
When i searched in MSDN .I got the tool..i.e XML Diff and Patch GUI Tool...
Can i use the tool in my program..I am using Visual Studio 6.0...or it supports only .net framework
If yes means how can i use it..
should i install anything or
i should include anu dlls or
include any .h files.
I went through msdn..but i got confused a bit..please can anyone brief me how to use it..
If i got some example..it will well and good....
else brief about so that i can understand and use it..
thank you
manju
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
The code is written in C# so it's better to use Managed code itself to get teh required functionality from this library. Otherwise you will have to port the code to C++.
There are some tweaks to call C# code from native C++.
Exposing .NET Components to COM[^]
Calling C# code from C++[^]
.NET COM IOP[^]
Anyway I've never tried this out. Please check it.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Hi..
Thanks for your reply..
Is there any tool to compare two xml files using vc++...
or else can u provide me a any links where i can get some vc++ code examples to compare two xml files
thank you
manju
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
I have a dialog based application.I use a text box in it.what i want is write the details from that text box into a text file.
when i wrote the code ,the data written into the file was as follows..??a??????ý????ý
My code is,
CString str;<br />
GetDlgItemText(IDC_EDIT1,str);<br />
fstream f;<br />
f.open("C:\\myfile.txt",ios::app);<br />
f.write((LPCTSTR)str,10);<br />
f.close();<br />
|
|
|
|
|
str is uninitialized and therefore the value displayed in the edit box is a garbage value.
Initialize the str to something meaningful.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
initialized it to spaces.-> CStraing str="";
But it still doesn't work.
|
|
|
|
|
CString str="";
GetDlgItemText(IDC_EDIT1,str);
fstream f;
f.open("C:\\myfile.txt",ios::out|ios::app);
f.write((LPCTSTR)str,str.GetLength ());
f.close();
This will help
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
yes,now that works.
what if i want to write the new value in the edit box in newline.now all the data are written in single line.
|
|
|
|
|
Append \r\n in the string where you want a line break
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
i tried f<<endl .that worked.Thanks...
|
|
|
|
|
projectip wrote: f.write((LPCTSTR)str,10);
I think this statement makes the problem. give proper length of the source buffer. If the string length less than 10, this problem may occur.
Please try with this.
f.write((LPCTSTR)str,str.GetLength());
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
projectip wrote: f.write((LPCTSTR)str,10);
Why the unnecessary cast?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I followed this link for embedding manifest in the exe.
http://msdn.microsoft.com/en-us/library/bb756929.aspx
I could see RT_MANIFEST markup in the exe(using resourcehacker).
But yesterday when i rebuilt my application (both in vista and windows 2003 server) i am not able to see RT_MANIFEST markup in the exe. Instead i saw a number 24 under that my manifest file is there.
Are some settings changed? I am not able to figure it out. Can any one help me?
Regards
|
|
|
|