|
AnithaSubramani wrote: Very Urgent.........
Of course.
BTW this may help [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Perhaps you need to override PreTranslateMessage() like:
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
if (WM_KEYDOWN == pMsg->message)
{
if (VK_UP == pMsg->wParam)
TRACE("You pressed the UP arrow.\n");
else if (VK_DOWN == pMsg->wParam)
TRACE("You pressed the DOWN arrow.\n");
}
else if (WM_KEYUP == pMsg->message)
{
if (VK_UP == pMsg->wParam)
TRACE("You released the UP arrow.\n");
else if (VK_DOWN == pMsg->wParam)
TRACE("You released the DOWN arrow.\n");
}
return CDialog::PreTranslateMessage(pMsg);
}
"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
|
|
|
|
|
How can one be new to MFC and have a very urgent question?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
A word of advice: don't use the word "urgent" when posting! If anything it results in slower responses or anger directed towards you.
Steve
|
|
|
|
|
I have two dialogs in my application.
I get the second dialog when I click on a button.
In the second dialog i have three textboxes,of which the value of only one of them have to be added to a combobox.the combo box resides in the first dialog.
how could i get the value of the textbox in the first dialog box(combo residing in it).Also the value has to be added to the combo only when i click an "add" button
|
|
|
|
|
By using get/set functions in one class and having a pointer of the parent using GetParent(/*params*/); you can access the member of one class in another. It doesn't matter much where you want to add the variable once you have access to it in either of the classes.
Alternatively you can also pass pointer of one class to another if your dialogs don't support parent/child relationship
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I wrote the following code..
CString str;<br />
GetDlgItemText(IDC_EDIT1,str);<br />
CWnd *p=GetParent();<br />
p->SetDlgItemText(IDC_COMBO1,str);
IDC_EDIT1 is in 2nd dialog.
IDC_COMBO1 is in 1st dialog.
|
|
|
|
|
This won't be a good idea. You must use Get/Set member functions to access all the variables of the parent/child class, this helps you making sure that the variables are not accidently modified.
so in child class you can write
p->GetSomeValue(); where GetSomeValue would be a function in the parent class that would be returing a string which is then displayed in the edit box in the child class.
I hope it makes sense to you.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I want it in the revrerse order.i need value of textboxes in child in the parent class.
|
|
|
|
|
Do you want to say that once the value in the text box is changed it should get updated in the combo box in the parent. To implement this you will need event notification mechanism by which you can notify the parent that the text in some control of the child has changed and the value in the parent is to be updated.
An easier way would be, when the user clicks on some button that dismisses the child dialog you can send the value in the parent. For this you need to check the return value from the child dialog in the parent something like
if(IDOK==myChildDlg.DoModal())
{
// Update values in the combo here that are taken from the child
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I added the following code in a button click in the parent dialog:
combodlg cd;<br />
cd.DoModal();<br />
CString str=""; <br />
m_combo.AddString(cd.str2);
and the follwing code in child dialog
GetDlgItemText(IDC_EDIT1,str2);
declared a variable CString str in header file of child dialog.thanks for ur suggestions.
|
|
|
|
|
CFirstDialog::OnInvokeSecondDialog()
{
CSecondDialog dlg;
if(dlg.DoModal() == IDOK)
{
this->ComboBoxString = dlg.TextBoxString;
}
}
ComboBoxString is declared as CString member in CFirstDialog. ( Use this to populate the combo later )
TextBoxString is declared as a CString member in CSecondDialog associated with the EditControl.
modified on Tuesday, July 8, 2008 7:45 AM
|
|
|
|
|
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
|
|
|
|