|
This is getting a lot more complicated than I thought.
In case you haven't noticed, I'm pretty new to Windows programming. heh.
My next question, how can I change the size of the child window after dynamically adding more controls? The scrolling size will have to change as I add more. If you see the code from the original scrolling child windows example, the scrolling ratio is fixed to the size of the child window as it appears in the resource editor.
|
|
|
|
|
I am having trouble using GetParent().
Here is my code that I put in the child dialog. I am trying to access functions and variables of the parent class.
CWnd* pParentWindow;
pParentWindow = GetParent();
pParentWindow->SomeFunction();
x = pParentWindow->TempInt;
The error is "SomeFunction() is not a member of CWnd" and "TempInt is not a member of CWnd".
|
|
|
|
|
You need to cast the CWnd pointer down to the parent window class.
The safest is using dynamic_cast. Enable RTTI (run time type info) in your project and do
something like this...
CMyParentWndClass* pParentWindow = dynamic_cast<CMyParentWndClass*>(GetParent());
if (pParentWindow)
{
pParentWindow->SomeFunction();
x = pParentWindow->TempInt;
}
If you're absolutely positive of the parent window's class type you can use static_cast:
CMyParentWndClass* pParentWindow = static_cast<CMyParentWndClass*>(GetParent());
if (pParentWindow)
{
pParentWindow->SomeFunction();
x = pParentWindow->TempInt;
}
or a regular C++ cast
CMyParentWndClass* pParentWindow = (CMyParentWndClass*)GetParent();
if (pParentWindow)
{
pParentWindow->SomeFunction();
x = pParentWindow->TempInt;
}
|
|
|
|
|
I get the error that CMyParentWndClass (well for me it's CMainDlg) is an undeclared identifier. Is there any other method?
Thanks
|
|
|
|
|
Add a #include directive to include the header file containg your CMainDlg class declaration:
#include "MainDlg.h"
|
|
|
|
|
Oh, I'm an idiot, I didn't think you have to include that if it's a child window.
So how about changing the size and the scrolling ratio when I have dynamically generated controls? How is that done?
Thanks.
|
|
|
|
|
acerunner316 wrote: Can you also elaborate on passing pointers from parent window to child window?
Forgot that one That was just one way to do it - by having the child dialog "pull" the info
from the parent. The way you are doing it ("pushing" the data to the child from the parent) is
just fine too. See my other reply for why you're getting the error.
Mark
|
|
|
|
|
how would one place a staus bar docked to the bottom of a dialog window, under a horozontal scrollbar? Internet Explorer uses this type of Status Bar setup. Looks really nice.
|
|
|
|
|
Care to be more specific? I'm not sure what part of IE you're talking about.
--
For proper viewing, take red pill now
|
|
|
|
|
Well,, it's the status bar at the bottom of IE. If you place you mouse over a link, it shows the html address in it.. etc.
And if you shink internet explorer (so that you have to scroll sideways to see the whole page) the status bar is placed under the horizontal scroll bar.
How would one put a status bar like this on a dialog window. I've had sucess with puttin status bars on my dialog, but they alwayse pop up above the horozontal scroll bar. I think the way IE does it looks much better.
|
|
|
|
|
I am using the MFC dialog application.
There are 3 edit box, add1, add2 and sum
and a button "add",
when exectuing, I input add1, add2, and use the "add" function dlg.m_sum=dlg.m_add1+dlg.m_add2
how to make the sum appears in the "sum" edit box? Do I have to add a view class or how to modify the OnPaint?
I now only have add.cpp and addDlg.cpp
|
|
|
|
|
Call UpdateData(FALSE) or SetDlgItemText
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan
|
|
|
|
|
bloodwinner wrote: how to make the sum appears in the "sum" edit box?
By using CWnd::SetWindowText() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
To put result in editbox you can simply use SetWindowText( LPCTSTR lpszString ) method
-----------
Mila
|
|
|
|
|
And if they are int you can use of SetDlgItemInt
|
|
|
|
|
I have created an application(run on win2k) where i communicate with a pci device. Within this application i establish communication by creating a handle to the device. After I've completed the tasks i've set out to do in the application i do:
CloseHandle(hdevice);
i know that: "CloseHandle invalidates the specified object handle,..."
to debug i do:
if(!CloseHandle(hdevice))<br />
AfxMessageBox(_T("DEBUG: Handle ::hndlPciAlt:: not closed!"));
but i never see this message.....
however, from debugging it seems as thought the application was not successful at closing the handle to the device(even when i exit my application). (unless something else is happening...)
the reason i say this is when i use a separate test application provided by the manufacturer to reload and reset the FPGA on the device the registers are not being reset.
if anyone has any insight on this issue, please advice...
thanks in advance,
-- modified at 8:58 Friday 3rd November, 2006
Kitty5
|
|
|
|
|
Hi,
I have been asked to write an application to compare about 5,000,000,000 or more records each of which containing at least 2 groups of 14 digit data, and removes records with repetitive numbers.
All the data are stored in plain text files. I have also told that I have permission to use an IBM Mainframe computer. I don't know the specifications yet, I just know it has a hard disk with around 7 terabytes of capacity(I have never seen such a thing before ).
What I was wondering, was that:
- Is there any one who has any experience using these machines? Do I write my application in Win32? or mainframes have different architecture?
- How to tune up processing time? Which algorithm do you prefer? (I wish data was stored on a SQL Server and I was going to write just a 'group by')
- If I needed to store data, then I prefer using MS. SQL Server. In this case should I buy a special version for the mainframe, or usual (IA32 ) versions will work fine?
Thank you very much in advanced.
//This is not a signature
while (I'm_alive) {
printf("I Love Programming");
}
|
|
|
|
|
Hamed Mosavi wrote: Do I write my application in Win32?
Not unless the mainframe is running Windows!
Hamed Mosavi wrote: or mainframes have different architecture?
If it's an IBM, it could be an AS/400 running OS/400.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
There are also many mainframes running different types of unix. depends on the manufacturer and on the administrator.
Don't try it, just do it!
|
|
|
|
|
OS/400
So what compiler can I find there? Is there a C++ compiler available??
I'm a bit afraid. I have never seen AS/400.
Does it have a 'sql dbms' equivalent?
Do I have to use a version of Oracle? Oh, no. I have not been working with any of these.
-- modified at 2:01 Friday 3rd November, 2006
//This is not a signature
while (I'm_alive) {
printf("I Love Programming");
}
|
|
|
|
|
Hamed Mosavi wrote: OS/400
So what compiler can I find there?
My co-worker uses RPG (mostly), Cobol, and C.
Hamed Mosavi wrote: Is there a C++ compiler available??
Does it have a 'sql dbms' equivalent?
Do I have to use a version of Oracle?
I have no idea.
All that aside, if you have a good algorithm, what you want can be accomplished on a decent-speed PC.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: All that aside, if you have a good algorithm, what you want can be accomplished on a decent-speed PC.
You might be right, but this is the job that they might do frequently, perhaps once a week. They want to make sure it will not take a long time (More than 1 hour or 2, perhaps).
I didn't calculate yet, but I'm sure it's a lot of processes. However I do agree that a good algorithm can convert hours of process to minutes or seconds. I experienced that already! But best algorithms should think a bit when it comes to 5,000,000,000 and more records of data.
//This is not a signature
while (I'm_alive) {
printf("I Love Programming");
}
|
|
|
|
|
Hi.
Find out what IBM system that you have access to. If it is an S390/ZOS or S390/Z-VM system, then you can easily write an EXEC employing PIPELINES to remove records that contain duplicate data. PIPELINES was specifically designed to handle this kind of situation; processing huge amounts of data easily and efficiently.
For more information, check the IBM website for 'CMS PIPELINES', this will tell you everything that you need to know. If you do not have any joy or need further help, let me know.
Regards.
James.
-- modified at 15:19 Friday 3rd November, 2006
|
|
|
|
|
Thank you for your informative information.
Within next week I'll travel to the city where everything is located. I'll soon check everything out and come back to code project, to ask more questions!
Now, I'm tring to find out some information about "CMS PIPELINES". Thank you very much again.
(I have heard something about pipe lines already. If I'm not wrong, it was the capability to convert one process to multiple processes and do multiple process simultaneously).
Thanks again, Mr. James.
-- modified at 22:35 Friday 3rd November, 2006
//This is not a signature
while (I'm_alive) {
printf("I Love Programming");
}
|
|
|
|
|
I need to Write a function that will, given an input string containing many words, split that string into individual words. For each word, the function should output the word, its starting index in the string, and its length to the console without using stream extraction operator.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string sval = " The quick brown fox jumps over the lazy dog";
int cnt=1;
int nsep = sval.find(" ");
while (nsep > 0) {
cout << "Word " << cnt << "="
<< sval.substr(0,nsep) << endl;
cnt = cnt + 1;
sval = sval.substr(nsep+1);
nsep = sval.find(" ");
}
cout << "Word " << cnt << "=" << sval << endl;
#ifdef WIN32
system("pause");
#endif
return(0);
}
Thats where i am so far, it will just split it into words but will not work if it begins with a space or if there is more than 1 space between words. I believe i need s.find_first_not_of but not sure how to incorprate it or if thats even my problem
any help?
|
|
|
|