|
Does any one know a good article (preferably with source) about creating and reading group policies ?
|
|
|
|
|
Joaquín and Christian...my appologies for asking a rtti question again, but I still don't have quite enough experience with it to fully understand whats going on despite numerous teaching attempts from both of you.
Anyways.
I have an dynamic array of CWnd's which I would like to be able to act, look and feel like CButton, CEdit, CComboBox etc...
m_pControls = new CWnd[m_nControls];
dynamic_cast< CButton >(m_pControls[0]).Create(this, CRect(0,0,100, 20));
Someone wanna show how I do this properly..?
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Well, I think you have some misunderstandings about what kind of things one is supposed to do with dynamic_cast .
First of all, dynamic_cast only works for pointers or references. Your last sentence cannot work because you are tyring to use it to cast to CButton instead of CButton * . There are a lot of other reasons why it won't work, however.
Suppose you have a inheritance hierarchy like this
A
|
-------
| | |
B C D Now you're given a pointer to A and you want to know whether the object pointed to is really a B:
A * pA;
...
B * pB=dynamic_cast<B *>(pA); At this point, if pA was actually pointing to a B (which is legitimate, as B derives from A ), pB will be non-null. Otherwise, pB is null, menaing that pA points to a C , a D or something else. In this way, dynamic_cast lets you peep into the actual nature of an object referred to from its base class. What dynamic_cast does not do is create objects of derived classes on demand, as your code seems to assume. Hope this helped clariy things a bit more.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ummm...sorta...RTTI is proving to be the most difficult thing for me to understand fully. I'll probably have to hit the books again for a while.
I did however find another way around my problem, which actually is easier and less overhead. I hate it when I do that, try to solve a simple problem with a difficult solution. One day i'll learn.
Thanx again
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
The coordination in client rect is like this:
------------->+
|
|
|
|
|
|
|+
(I mean Y increase when it goes down)
Is there any way to change this rule and it increaze when it goes up?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Pass a negative y value into SetWindowExt() .
Simon
There's one for you, nineteen for me
Sonork ID 100.10024
|
|
|
|
|
I have created a Multiple Documents MFC project, using Internet Explorer Rebars for my toolbars instead of normal MFC toolbar.
When I put a control in my IDR_MAINFRAME dialog (the dialog bar), the control remains disabled even if I associated it with a member function for the message BN_CLICKED.
How can I do to enable my control?
|
|
|
|
|
- Put in an ON_UPDATE_COMMAND_UI() handler for it.
- Make sure the ON_UPDATE_COMMAND_UI() handler gets called - it must be in the toolbar OWNER window class.
Good Luck!
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
How would I go about creating a triple pane setup using splitters...?
Would I create a split window normally, then in the OnCreateClient of one of the child splits repeat the process...?
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I think there is one in CP,Did you search ?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I'm aware of the triple pane CSplitterWndEx 'T' control, but it's not what I need unfortunately.
Thanx anyways!
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
The CSplitterWndEx class can create virtually any splitter layout you wish. Want do you want done differently?
Simon
There's one for you, nineteen for me
Sonork ID 100.10024
|
|
|
|
|
I've used that class before, it's a great time saver!
But it's to much extra overhead and i'm curious as to what the best approach would be, without a third party class.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
You can split the main frame into two views. Then split the right split into two views to get an OE like 3-pane view.
I used to do it slightly different for some time.
I used to split the main frame into two. The left split is a view and the right split is another frame window. This frame window, I again split into two
The difference is that now the splitters are distinct. Means there are two splitters. There is a slight difference in look and feel. Also in resizing.
Regards
Nish
My most recent CP article :-
A newbie's elementary guide to spawning processes
www.busterboy.org
|
|
|
|
|
Thanx Nish!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi ,
Can anyone tell me where can I download ATL.DLL ( ANSI Version ) for Win95/98.
Thanks,
Sansky
God is Good all the Time,
All the Time God is Good
|
|
|
|
|
Does anyone know a REALLY GOOD class tutorial???
Like one that explains everything about static and virtual and public and private and the passing of variables and how to arrange it all, and perhaps the most important the communication between one class and your main application's class.
I just dont understand much of it (i've been having a tendancy of making everything global lately, which really isn't a solution for me...)
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Hi Kuniva. A good book for starters (though not exactly a tutorial, it's pretty long) is Bruce Eckel's Thinking in C++, that you can download from the net for free. Also, a very good FAQ about C++ is Marshall Cline's C++ FAQ Lite. If you invest some time reading these two resources and practising a bit I'm sure you'll get much more profficient at C++ in a matter of weeks. Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
wow thanks, it's like you're always helping me out
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
You are welcome. I wish there were places like this when I was your age and struggling with BASIC and Z80 assembler.
I hope you'll strike back with some fabulous article featuring that Winsock class of yours once it's up and running, won't you?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hey Joaquin,
lol, well actually... i'm not writing a winsock class, and if i have to read 878 pages first to learn OOP it wont be for this year lol.
I'm actually writing a class that will serve as a chat engine for www.spinchat.com. I always go to this chat and it's easy to write Bots for it because it works with non-encrypted text commands
I already started writing two bots but never used classes and that took too long so now i'm trying to write a class i can just reuse everytime.
I don't know if i'll be posting it on the Codeproject because others also made bots but in Delphi and VB so i wanted to do it better but if i post the class then they'll be able to write one as easily as in VB (probably even easier) so... i'm not sure, maybe i'll leave a few 'special' functions out so i still have something to call my own . Anyways, i'm sure i'll be writing more articles and contribute to the codeproject throughout my findings.
Greets - K.
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
hi,
....I am addicted to using SendMessage instead of using functions.I mean suppose I have to paint the screen in custom color if Left button double click,
earlier- I used to put a function for painting in OnLBDblClk
now-I use SendMessage(MYM_PAINT,...) for that just as in his message related article.
This has become a habit for every action.
Is it BAD?
Please help by telling me good and bad techniques.
Waiting.
|
|
|
|
|
Bad? Well it depends on your definition of bad. If it works, it works...
Wasteful? Very.
It takes a fair amount of overhead to send a message to a window. Much easier just to invoke a function. Functions are a LOT more versatile too.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
In the example you gave I think you would be better off to set some state variables that tell your program the screen needs to be a custom color, then Invalidate the window in question and place logic in your OnPaint handler to deal with this.
Personally, I don't see the use of SendMessage as all that bad because a huge number of the MFC methods are just wrappers around SendMessage calls anyway. I am not familiar with the article you are referring to but I have written a fairly wide variety of apps and I have never required a user defined message code that I can recall. This is just my opinion though.
|
|
|
|
|
Hi,
Just a little question (not very important... just to know ;o))) :
I compiled the following code in VC++ (no MFC) :
// Test.cpp
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Hello World", "Hello", MB_OK);
return 0;
}
And the EXE size is 36 ko ! I often saw EXE's of 5-10 ko, is there a way to reduce the size ?? (I mean, without compressing the EXE with UPX or other executable packers..).
|
|
|
|