|
As per classes, the header defines a class, which in truns encapsulates some data as members. You're not declaring data in the header directly; the header still only contains type definition, which is class in this case.
TheinstruTara wrote: Then, in Dialog2.cpp I access it this way pDlg->area + somethng ... where pDlg is a CDialog1 object;
So i have been doing it wrong?
No. This actually explains the class definition well. Your Dialog2 accesses "area" through the 1st Dialog object "pDlg", which is most likely declared as a member of Dialog2 in your header.
Best,
Jun
|
|
|
|
|
Thanks.
In conclusion, if I am making a module, I must not do it the same way as I do it for classes. But for simple class, I can declare variables in the header.
Fortitudine Vinsinues!
|
|
|
|
|
Jun Du wrote: In essense, header is about definition not declaration.
Header (.h) files contain declarations, while source (.cpp) files contain definitions. Declarations can be seen multiple times by the compiler, while definitions can only be seen once by the compiler. A definition is also a declaration, but a declaration is not also a definition.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Header (.h) files contain declarations, while source (.cpp) files contain definitions.
I have a feeling that the source file (.cpp) contains class implementation, not definition. The header contains the definition.
Best,
Jun
|
|
|
|
|
Jun Du wrote: I have a feeling that the source file (.cpp) contains class implementation, not definition. The header contains the definition.
For creating your own class, yes, but the scope of this thread was limited to using an existing object.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Thank you. That is what I was looking for.
Fortitudine Vinsinues!
|
|
|
|
|
I've looked and looked, but i can't seem to find any good articles on pointers....
its all so confusing to me....
I would appriecate if anyone could point (he he) me to a good article or something you read that you though was good on pointers and references..
It would help a lot thanks...
"C++ will solve any problem."
|
|
|
|
|
What level do you want the literature to be technically, beginner or more advanced?
Best,
Jun
|
|
|
|
|
If you could find both...both,
but beginner for starters would help....
"C++ will solve any problem."
|
|
|
|
|
Ok, a beginner's first: this CP article.
Search CP for "pointers" and you'll get tone of articles and code snippets.
Best,
Jun
|
|
|
|
|
|
Thanks!
"C++ will solve any problem."
|
|
|
|
|
You can also check out (and I recommend reading anyway), "The C++ Programming Language", "Effective C++", "Effective STL", and "Exceptional C++". While they all cover far more topics than just pointers, they will give you a good start to learning the language as a whole.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
#hackC++ wrote: I've looked and looked, but i can't seem to find any good articles on pointers....
http://c-faq.com/ptrs/index.html[^]
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is there a way to detect when a 3rd party application displays a messagebox?
|
|
|
|
|
Write a system wide hook for WH_CBT or something of your choice go through hooks .
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
Probably not, as a message box is nothing but a dialog (#32770 class). Any application can have one of those displayed.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
For my purposes even counting the number of dialogs created would probably work since the case I'm looking for is the app spitting up an error on startup. I'm working primarily in .net though, and the framework only allows global hooks to be set for keyboard and mouse events. Writing a c++ launcher app's probably more effort than the issue justifies.
|
|
|
|
|
As FarPointer said, a CBT hook is probably the easiest way to do it, since that hook is specifically designed to let an app monitor window creation.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
VB > soccer
|
|
|
|
|
Hello,
I am having some trouble controlling where my buttons in my dialog go when I resize the window. I want a certain group of buttons towards the right of the dialog to sort of move right when the dialog is expanded, however, I can't figure out how this is done in the properties. Can anyone point me in the right direction? Thanks!
|
|
|
|
|
See the code snippet in the Extras section of this article.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Greetings all!
I'd like to create a bar which will have a mixture of the tool buttons and controls (combo, pushbutton, edit, etc).
The CToolBar class will work for the tool buttons but the job of implementing the controls is too involved.
The CDialogBar class will work for the controls but how do I get the tool buttons to work? I've tried a standard button with the BS_ICON style; two problems: 1) button is 16x16, icon is 16x16 but the display lops off part of the icon and 2) how do I get the button to stay "depressed"? I've tried a standard button with the BS_BITMAP style but it: 1) loses the 'transparency' feature of icons, and 2) I still cannot get the button to stay "depressed". The BS_PUSHLIKE style does cause the button to appear to be pushed in on mouse click but does not remain pushed in.
The CReBar class will allow for the wrapping of a CToolBar in one band and the CDialogBar in another band but I'd really like to mix the tool buttons and controls in a more logical order.
So, the upshot is, I'd like to use the CDialogBar with BS_ICON style if the following problems can be fixed:
1) how do I display the full (standard sized) icon?
2) how do I simulate the icon being "depressed"?
Regards,
Kylur.
|
|
|
|
|
- set BS_OWNERDRAW style, and draw yourself in CButton::DrawItem overridden function (you need in this case to create your own class derived from CButton), or an easier alternative is to use CBitmapButton class.
- add BS_AUTOCHECKBOX and BS_PUSHLIKE styles.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks! I appreciate the advise.
Regards,
Kylur
|
|
|
|