|
Which of these two best describes the relationship between the two dialogs?
Are both dialogs owned by the same parent:
parent
/ \
dlg 1 dlg 2 Or does one dialog own the other:
parent
|
dlg 1
|
dlg 2
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
parent
|
dlg 1
like this
in parent there is a variabel
in
dlg
there is a function who wil get the variabel frome the parent
void CChildDialog::OnBUTTONproblem()
{
geting data frome dlg1
}
how is this manegd
thank's verry much for helping
|
|
|
|
|
There are several ways to do this. The easiest, although not considered good OO practice, is to mark the variable as public in the parent class. Then in the child, simply call GetParent() . Or, mark the variable as private and use a get/set method instead.
Also, you could add the same type of variable to the child, mark it as public , and assign it a value before calling the dialog's DoModal() method.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
m_TestOutput is in main window and is public
this is standing in dialog 1 under buttonproblem
void CChildDialog::OnBUTTONproblem() <br />
{<br />
CWnd *CParentWindow = GetParent();
<br />
m_waardeChild = CParentWindow->m_TestOutput;
<br />
<br />
UpdateData(FALSE); <br />
}
get folowing error
--------------------Configuration: comunication between variabel of 2 windows - Win32 Debug--------------------
Compiling...
ChildDialog.cpp
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(54) : error C2039: 'm_TestOutput' : is not a member of 'CWnd'
c:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(1899) : see declaration of 'CWnd'
Error executing cl.exe.
comunication between variabel of 2 windows.exe - 1 error(s), 0 warning(s)
thank's verry much for helping
-- modified at 17:11 Wednesday 9th November, 2005
|
|
|
|
|
can any one help me whit this problem im a beginer in this
thank's verry much for helping
|
|
|
|
|
Mathieu Dijkstra wrote: UpdateData(FALSE);
My first suggestion would be to lose the calls to UpdateData() . They are unnecessary and will only confuse you further. Using SetWindowText() and GetWindowText() instead is much cleaner and less error-prone.
Mathieu Dijkstra wrote: m_waardeChild = CParentWindow->m_TestOutput;// dos not work ether
The compiler is telling you exactly what the problem is. Try:
CComunicationbetweenvariabelof2windowsDlg *pParent;
pParent = (CComunicationbetweenvariabelof2windowsDlg *) GetParent();
m_waardeChild = pParent->m_TestOutput;
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
wel i tryd it and it wont work this is wat i dit in the function
--------------------------------------------
void CChildDialog::OnBUTTONproblem() <br />
{<br />
<br />
<br />
<br />
CComunicationbetweenvariabelof2windowsDlg *pParent;<br />
pParent = (CComunicationbetweenvariabelof2windowsDlg *) GetParent();<br />
m_waardeChild = pParent->m_TestOutput;<br />
<br />
<br />
<br />
<br />
UpdateData(FALSE);
}
-------------------------------------------------------------------------------
message by visual c++6 =
--------------------Configuration: comunication between variabel of 2 windows - Win32 Debug--------------------
Compiling...
ChildDialog.cpp
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(60) : error C2065: 'CComunicationbetweenvariabelof2windowsDlg' : undeclared identifier
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(60) : error C2065: 'pParent' : undeclared identifier
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(60) : warning C4552: '*' : operator has no effect; expected operator with side-effect
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(61) : error C2059: syntax error : ')'
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(62) : error C2227: left of '->m_TestOutput' must point to class/struct/union
Error executing cl.exe.
comunication between variabel of 2 windows.exe - 4 error(s), 1 warning(s)
thank's verry much for helping
|
|
|
|
|
Mathieu Dijkstra wrote: c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(60) : error C2065: 'CComunicationbetweenvariabelof2windowsDlg' : undeclared identifier
Again, the compiler is telling you the problem. You have referenced an identifier that has not been declared. You need to include Comunicationbetweenvariabelof2windowsDlg.h at the top of ChildDialog.cpp .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
cool that was the problem
many thanks 4 helping me wit my study on variabels and multy dialogs
problem is solved
i go studithis verry carful becorse i was having a problem whit this over 1 year
many thanks;)
waw you are a supper coder (by the way i had this problem also on a dutch formum but they dit not solve it) thanks agen
|
|
|
|
|
Hi there! I'm writting an app that deals a lot with files (both reading and writting) and that is slowing down my app.
What I need is a fast way to do the following operations on files:
- read
- writte
- append
- open
- close
I'm using c++ but inline assembly is an option.
Thx!
|
|
|
|
|
What APIs are you using for File I/O? Have you done any profiling to see where the bottlenecks are?
Since File I/O is extremly slow compared to memory I/O, I don't think you'll see much difference between C++ and assembly. Without knowing more about you app, it's difficult to give any advice.
Chris
|
|
|
|
|
I am writting a file compressing app.
But, for now, I'm just improving/optimizing the compressing algorithm that I'm using.
This algorithm as to writte a lot of bytes on several files (depending on the original file's size) and I'm using fwrite(), fopen(), fclose(), fseek() and fread() from stdio.h.
bottlenecks - I don't known what that is!
Is this helpfull? Thx!
|
|
|
|
|
|
My app spends most of its time reading from/writing to files. This is the main reason why I need a fast way to read/write files as the rest of the algorithm isn’t much time consuming, I’d say 85% of the time spent in the compressing algorithm is with files.
I need a fast way to read/write files in sequence.
thx.
hint_54
|
|
|
|
|
hint_54 wrote: bottlenecks - I don't known what that is!
It is a metaphor for trying to cram a bunch of work into a small passage. With a bottle, no matter its capacity, there is a physical limit to the amount of liquid that can pass through the neck (which is usually narrower than the bottle itself).
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
A memory-mapped file might save you a small amount of time.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
hhhmmm... You are talking about DMA rigth? I don't know how to use it with files!
Thx!
|
|
|
|
|
|
hint_54 wrote: You are talking about DMA rigth?
No. DMA is a way to access memory independently of the CPU.
hint_54 wrote: I don't know how to use it with files!
A memory-mapped file is a spot in memory that can be accessed (e.g., open, close, read, write, seek) as though it were an actual file. By eliminating file I/O, a speed increase is (normally) realized. See these for examples:
http://www.ecst.csuchico.edu/~beej/guide/ipc/mmap.html
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngenlib/html/msdn_manamemo.asp
http://www.codeproject.com/file/xreverse.asp
http://www.codeproject.com/file/findidaddressbook.asp
http://www.codeproject.com/file/Memory_Mapped_Class___PBD.asp
http://www.codeproject.com/win32/cmemmap.asp
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Yes, I know what you mean but isn’t that memory consuming for larger files?
hint_54
|
|
|
|
|
hint_54 wrote: ...isn’t that memory consuming for larger files?
I guess that depends on your definition of "larger files." I wouldn't think twice about using MMF for files several MB in size. In any case, you can restrict the mapping to only the portion of the file you are interested in.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
There is no definition for larger files because this app is meant to be used by someone else, meaning that I can never know the maximum file size to be used (can be anything! And limiting that size is not an option.) and I can’t load portions of the file because the algorithm reads the file sequentially, woks on data (byte by byte) and stores the output way. But thx anyway
hint_54
|
|
|
|
|
Using MMF can still improve performance, because you do not have to do the manual loading of data into a buffer - the OS basically does it for you. For example, if you were reading the file in 4KB chunks, you would be allocating a 4K buffer, copying from the file into that buffer, and then likely processing the contents of the buffer using the buffer's address. Using a MMF does that work for you.
If you want to impose a limit on the size of the MMF section you want to create, that is fine. Choose a limit, say 2MB (or 4Mb, or 64MB, whatever). If the file is 2MB or smaller, you can MM the entire file. Of not, you can MM 2MB sections of the file one at a time.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Thx! That has been VERY helfull!
|
|
|
|
|
DavidCrow wrote: A memory-mapped file is a spot in memory that can be accessed (e.g., open, close, read, write, seek) as though it were an actual file.
Sorry, but I think that is supposed to be the other way around. Memory-mapping something allows it to be accessed like normal memory (through a pointer). For example, if you had a memory mapped buttons/switches in your hardware (common on arcade games), you would be able to read the state of the switches by reading values from one or more specific memory addresses.
The same goes for files. If you memory-map a file, you get an address that points to some location in the file, and you can then access the contents of that file through the pointer.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|