|
The parent dialog or window is the one that comes in first and gets out last. It creates other dialogs, windows etc.
My bit-weird way would be:
Make pointer-variables for each of shared variables in the parent.
Assign them the address of the variable in the child dialog when creating the dialog.
E.g.
class CParent
{
int* m_pVariable;
};
CChild* c;
c = new CChild;
m_pVariable = &c->m_Variable;//put the address of the variable in parent when creating the child.
Now...
class CSecondChild
{
int* m_pVar;
};
CSecondChild* cc;
cc = new CSecondChild;
cc->m_pVar = m_pVariable;
Here, the value in CSecondChild::m_pVar is the value of the variable CChild::m_Variable.
When you change m_Variable in CChild, it is reflected in CSecondChild's m_pVar.
My code is confusing I think.
this is this.
|
|
|
|
|
jee haan app ka code is definitly cofusing....dont u think this can be done by making one dialog class parent of another....Ive done this and it works...but the problem is that I want to pass all the values of child dialogs back to the main dialog.
Thanx for the reply
AH
|
|
|
|
|
I don't exacly get your point. Do you have all child dialogs visible at the same time, or is it DoModal() for each child dialog?
If you are using DoModal() for each child, then get the data from each of them:
CChild c;
if (c.DoModal() == IDOK)
{
int a = c.m_Variable; //Do this for all variables you need.
...
}
this is this.
|
|
|
|
|
Respected all
Regards!
the last time i recieved the answers of my query was not a professional way. that's y i m sent again
how i can read data from a data file which has extenstion is *.Dat which is in the follwing format
---------------------------
filename.dat
data file
genertaed from the processing of the control system
dfgdfgdfg cgb fbgd
345345 dgdfg
dgdfg
XLOC YLOC INDIX
45 56 2344
56 67 1245
50 90 4562
45 87 9337
-----------------------------------------------------------------
and in the given data file i have to read only the data of columns under XLOC,YLOC,INDIX and the file always is in this format.
So please guide me.
waiting for + response.
david
|
|
|
|
|
FILE* fp;<br />
char x[20], y[20], index[20];<br />
int i;<br />
int ind;<br />
char buf[200];<br />
int len;<br />
fp = fopen("text1.dat","r");<br />
while (! feof(fp))<br />
{<br />
memset(buf,0,sizeof(buf));<br />
fgets(buf,200,fp);<br />
len = strlen(buf);<br />
if (len == 0)<br />
continue;<br />
<br />
memset(x,0,sizeof(x));<br />
memset(y,0,sizeof(y));<br />
memset(index,0,sizeof(index));<br />
<br />
ind = 0;<br />
i = 0;<br />
while (i < len)<br />
{<br />
if (buf[i] == ' ')<br />
break;<br />
x[ind] = buf[i];<br />
ind++;<br />
i++;<br />
}<br />
i++;<br />
ind = 0;<br />
while (i < len)<br />
{<br />
if (buf[i] == ' ')<br />
break;<br />
y[ind] = buf[i];<br />
ind++;<br />
i++;<br />
}<br />
i++;<br />
ind = 0;<br />
while (i < len)<br />
{<br />
if (buf[i] == ' ')<br />
break;<br />
index[ind] = buf[i];<br />
ind++;<br />
i++;<br />
}<br />
<br />
MessageBox(x);<br />
MessageBox(y);<br />
MessageBox(index);<br />
<br />
}<br />
fclose(fp);
What you need to do is string-processing, not some filing technique.
I hope it works.
this is this.
|
|
|
|
|
a_david123 wrote:
the last time i recieved the answers of my query was not a professional way.
This example works. Why haven't you tried it?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
i am trying to create a windows explorer type application in vc++.i am able to update the TreeView for the directory list. But i am unable to populate the ListView(right pane).i have listed the code below..
void CDirTreeDemoView::OnInitialUpdate()
{
CListView::OnInitialUpdate();
GetListCtrl ().InsertColumn (0, _T ("File Name"), LVCFMT_LEFT, 192);
GetListCtrl ().InsertColumn (1, _T ("Size"), LVCFMT_RIGHT, 96);
GetListCtrl ().InsertColumn (2, _T ("Last Modified"), LVCFMT_CENTER,128);
}
any help plz
thanks
|
|
|
|
|
<br />
BOOL CDirTreeDemoView::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
cs.style |= LVS_EDITLABELS | LVS_REPORT;<br />
return CListView::PreCreateWindow(cs);<br />
}<br />
<br />
void CDirTreeDemoView::OnInitialUpdate()<br />
{<br />
CListView::OnInitialUpdate();<br />
CListCtrl& refCtrl = GetListCtrl();<br />
CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());<br />
refCtrl.InsertColumn(0, _T("File Name"), LVCFMT_LEFT, 192);<br />
refCtrl.InsertColumn(1, _T("Size"), LVCFMT_RIGHT, 96);<br />
refCtrl.InsertColumn(2, _T("Last Modified"), LVCFMT_CENTER, 128);<br />
<br />
DWORD dwExListStyles = LVS_EX_FULLROWSELECT;<br />
GetListCtrl().SetExtendedStyle(dwExListStyles);<br />
}<br />
Maybe this will help
P.
|
|
|
|
|
Nithyb wrote:
But i am unable to populate the ListView
Why? What problem(s) are you having?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hello...
supposed you have two bitmap images in your form, say bitmap1 and bitmap2... how can you get the difference(image subtraction) of the two images...
thank u in advanced....
|
|
|
|
|
First, you need to get the dimensions of the bitmaps, then allocate an appropriate array (wid*hei*bpp/8 bytes). Use the GetBitmapBits function to populate the array. Do the same with the second array. Subtract them byte by byte. Use the SetBitmapBits to fill the CBitmap.
Live long and in prosper
johny74656@gmail.com
|
|
|
|
|
I want to have a reset button on my dialog box which restore the control values to their original values.Any clue which function shud I call in the reset button function??
|
|
|
|
|
I usually keep the default values in a config file..then read in from the file and update to the control values. Not sure if this is the best method.
Aaron
|
|
|
|
|
I'd store the default values in an XML file that you'd load at the beginning
and then you'll have to reset each component one by one. The best automated thing you can do is to group all the edit box to have their resource id consequtive so the you'll be able to do in case you want to reset them:
for(int i = iFirstResId; i <= iLastResId; i++)
SetDlgItemText(i, "");
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Or use the UpdateData function sending in the right parameter (I can never remember if it's TRUE or FALSE). As long as you haven't called it yet to update the variables, calling it with the right parameter will put whatever the variables' value are back in the controls
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
If you've designed it properly, my suggestion would be to simply click the Cancel button and then open the dialog up again. All of the initial (default) values will be present at that point and you will not have had to resort to some "reset" button.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
How do i maintain the focus in a edit box? For example i was typing half-way in the edit box, however an event occur and the focus got changed. How do i set the focus to remain in the edit box.
This is wat i tried to do when the event occurs
<br />
if(m_alarmOn==false)<br />
{ <br />
m_alarmOn= true;<br />
<br />
CWnd* prev = this->SetFocus();<br />
prev->SetFocus();<br />
<br />
CreateThread(0,NULL,CSecurityDlg::playSound,this,0,0);<br />
}<br />
<br />
The above code reside in a OnBtnClick function. So when alarm is on, the button will be auto click....and the alarm sound goes off....
But in the process of these, i might be typing in a editbox. So i will lose the focus...How do i get it to stay?
Aaron
|
|
|
|
|
void APPDlg::OnKillfocusTextBox()
{
//set condtion here to see if the user has finshed typing..
//else do this,
m_TextBox.SetFocus();
}
u can never get out of ur textbox if u dont handle it correctly
V
|
|
|
|
|
Tks. I resolved it using pic control and defining a WM_action message instead. Thought this would be neater.
|
|
|
|
|
How do i include a header files directory of another library to my project's include file path.
|
|
|
|
|
Open the project settings.
Go to the C++ tab.
Use the combobox to go to the Preprocessor entry.
Under 'additional include folder' enter a relative or absolute path.
I prefer to use relative paths from the DSW file, since I might end up with a different drive letter or arrange items into different levels. Less work if things are relocated relatively to each other than a hard coded path to some specific drive in some specific rooted folder hierarchy.
|
|
|
|
|
Suppose im using an open source library borZoi-1.0.2.I copy its folder to my project and the header files r in
borZoi-1.0.2\src directory so what will b the relative path with respect to DSW file
|
|
|
|
|
hi,
i am trying to use the borzoi 1.02 with Visual studio 2008 C# .NET,
i am trying to use the ECC implementation in this library,
so how can i integrate this library and use its functions from within VS 2008 C#.
thanks alot
|
|
|
|
|
|
who can tell me about change the tcp/ip packet on ndis or spi,please give me
the code for example,thanks a lot!!!
riynivke
|
|
|
|