|
Hello -
This may be a very dumb question, but I've struggled with it a long time. I have two text boxes and I'm trying to control their visibility and enabled/disabled state, but no matter what I do I keep getting this or something like it with different commands:
VestExample error C2228: left of '.ShowWindow' must have class/struct/union type
Here is some of the code:
In header file (Dialogue Data):
int m_partnum; // text box
int m_degrees; // text box
In .cpp file:
DDX_Text(pDX, IDC_PARTNUM, m_partnum);
DDX_Text(pDX, IDC_DEGREES, m_degrees);
Lines causing error:
m_partnum.ShowWindow(SW_HIDE);
m_partnum.ShowWindow(SW_SHOW);
m_degrees.EnableWindow(true);
I have various buttons that respond just fine to these commands (defined in class wizard) and the text boxes are defined in the class wizard too. Thanks in advance for any help.
-- modified at 16:02 Monday 5th December, 2005
|
|
|
|
|
show us the code for that particular line of code ( with as much contextual info as possible .
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Thanks for your reply. Here is the code:
In header file (Dialogue Data):
int m_partnum; // text box
int m_degrees; // text box
In .cpp file:
DDX_Text(pDX, IDC_PARTNUM, m_partnum);
DDX_Text(pDX, IDC_DEGREES, m_degrees);
Lines causing error:
m_partnum.ShowWindow(SW_HIDE);
m_partnum.ShowWindow(SW_SHOW);
m_degrees.EnableWindow(true);
Thanks again for any help!
|
|
|
|
|
int m_partnum;
int m_degrees;
but those are not Control member variables, they are int ; make certain that you define variables for your controls, or do something like :
CWnd* pWnd = GetDlgItem( ID_OF_CONTROL );
pWnd->ShowWindow(SW_HIDE);
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
damn !
maximilien already answered, but i'd really like to say this.
error C2228: left of '.ShowWindow' must have class/struct/union type
isn't the compiler message explicit enough ?
ok, you're a "newbie". let's start back.
left of '.ShowWindow' : m_partnum.ShowWindow(SW_HIDE);
i hope so you see that the compiler talks about m_partnum.
but you declared it as an integer (int m_partnum; ).
int is NEITHER (as the message tells) a class nor a struct nor a union but a native type of the language (here C++)
so you cannot apply the '.' operator to an int variable in which no such operator is defined.
moreover, what you what to do is applying this on a control (showing or hiding a particuliar control). you must have a variable or the type (or subtype) in which the ShowWindow() member function is defined (here CWnd).
almost all the controls inherits from CWnd, so a CEdit, a CButton, a CComboBox will also have their ShowWindow() Method...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
newbie5345 wrote: VestExample error C2228: left of '.ShowWindow' must have class/struct/union type
What does the line in question look like? In the context of what type of object is ShowWindow() being called?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Thanks for your reply. Here is the code:
In header file (Dialogue Data):
int m_partnum; // text box
int m_degrees; // text box
In .cpp file:
DDX_Text(pDX, IDC_PARTNUM, m_partnum);
DDX_Text(pDX, IDC_DEGREES, m_degrees);
Lines causing error:
m_partnum.ShowWindow(SW_HIDE);
m_partnum.ShowWindow(SW_SHOW);
m_degrees.EnableWindow(true);
Thanks again for any help!
|
|
|
|
|
newbie5345 wrote: int m_partnum; // text box
int m_degrees; // text box
Should be:
CEdit m_partnum;
CEdit m_degrees; newbie5345 wrote: DDX_Text(pDX, IDC_PARTNUM, m_partnum);
DDX_Text(pDX, IDC_DEGREES, m_degrees);
Should be:
DDX_Control(pDX, IDC_PARTNUM, m_partnum);
DDX_Control(pDX, IDC_DEGREES, m_degrees);
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
|
Hello,
I'm trying to create an automated build process for a Visual Studio 6 project. When I call nmake (C:\Program Files\Microsoft Visual Studio\VC98\Bin\NMAKE.EXE) and specify my makefile (exported from VS6) Visual Studio 2003 is launched and I'm asked to "convert the project".
What's the story? Why is VS2003 butting in? Why isn't nmake just making the taget file?
I'm new to the automated build stuff. Any help would be greatly appreciated.
Thanks!
-Ian
-- modified at 14:35 Monday 5th December, 2005
|
|
|
|
|
I know just enough programming to get in trouble, I am starting to get into programming motion controllers that use C++, does anyone know of any good self-training books,
Thanks
|
|
|
|
|
Hello,
There are a lot of books that you can learn from, but the book that is right for you depends on your background. Since you say that you already know a little bit of programming, I can recommand "The C++ programming Language" by Bjarne Stroustrup. He's the creator of C++ and his book covers everything you need to know for getting a solid understanding of the language.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hello all and thanks in advance. I have a multiple dialog MFC app. On several of these dialogs there are many (20+) settings that could be changed. I am implementing an Apply button than becomes enabled when any of the controls are changed. Currently I'm handling a change event for every item, but I was wondering if there is a general message that I could handle on the dialog level that would be sent by all of the controls if a change occured. Then I could handle one event instead of many.
Thanks!
Jim
|
|
|
|
|
How about ON_NOTIFY_RANGE() ?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
yes I think this will work! Thanks Dave. I think I'll have to set a few message maps up because there are three different types of controls (dropdown, textbox and spin). I'll just point them all to the same function.
And I might have to rearrange the IDs in the resource file so same-type controls are continguous. But beyond that I think this work.
I'll post a followup.
Thanks, Jim
|
|
|
|
|
Before posting my code, I'm wondering if I'm missing something obvious here...
I have a small C++ app that interacts with the Windows Scheduler to schedule small tasks that interact with the serial port. These tasks are being installed using the SYSTEM account. When I run these tasks manuall (i.e. right-click > Run), everything works great. However, when the task runs at its specified time, it crashes when trying to send an EscapeCommFunction(...) command that controls the DTR & RTS lines. The call to CreateFile(...) on the port returns a valid file handle.
Any thoughts? Thanks!
|
|
|
|
|
Dear all,
I developed a little program and I wish to run it using a script file. I want to run it (standby)but not to start processing until it receives the file. Any help on how to do this?
|
|
|
|
|
islheg wrote: I want to run it (standby)but not to start processing until it receives the file.
This makes no sense (at least to me it doesn't). Can you be a bit more specific?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
This is a network traffic analyzer. I created it using winpcap library and MFC. I don't want the program to start traffic analysis until it receives a script file.
|
|
|
|
|
islheg wrote: I don't want the program to start traffic analysis until it receives a script file.
Ok, so how does it receive such a file?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
That what I am asking about.
|
|
|
|
|
"Accepting a file" really makes no sense without some sort of context. I'm not sure how others could be expected to know how your application is handling files. Provide some more information.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I have tab control with many property pages, I want to update only selected property page at a time when it is visible.
What message have to handle from the property page class when the page is selected?
Is it possible to handle any message from the property page class, not from the tab control class, which hold the page?
thanks.
|
|
|
|
|
The only thing I am aware of is CPropertyPage::OnSetActive() .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|