|
Lots of helper functions here[^] (look for toWideString()).
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
i am making a application as follows:
there is one main dialog and then i am calling a component that is also dialog and i want to set the position of componet dialog to main dialog.
now i have successfully set the button which are actually creating in component and set at main dialog but i want to whole dialog to main dialog
can anybody tell me what i have to do for the same.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Bankey Khandelwal wrote: now i have successfully set the button which are actually creating in component and set at main dialog but i want to whole dialog to main dialog
Huh?
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
Hi Bankey Khandelwal
You want to set position from dialog?
|
|
|
|
|
now its done
thank you
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Hi
I have problem related to singelton class....
I have to design a singelton claa such that if the user try to create second object then it should direct to first instance of class.
Please suggest me that how to implement such class
Thanks
|
|
|
|
|
1.Make the constructor of the class private.
2.Write a static function that return the object of this class. In that function create a static object of the same class and return the reference of that object. Thus instead of creating a object directly, call this function to get an instance of the class.
eg:-
class single
{
private:
single()
{
}
public:
static single& Instance()
{
static single Obj;
return Obj;
}
};
here every application should call single::Instance() to get an instance of the class single
|
|
|
|
|
I think Instance() should be public, right?
- NS -
|
|
|
|
|
Thanks Naveen
Will this code ensure that when we are going to create second object of the class then it will point to the first one.
Please explain how.
Thanks
|
|
|
|
|
Ya.. since the constructor is private, u cannot create an object directly. You have to call the Instance() function to get the one and only one object of that class.
eg :-
single a;// causes error since the constructor is private.
single &a = single::Instance(); // reference to the one and only one object.
nave
|
|
|
|
|
Hi!
I use Johan Rosengren's Files "Controls-in-controls: A line-numbering edit box" for line numbering in an SDI application.
I have changed it to CEditView to get it working.
The problenm is: After the visible area of the edit-control doesn't apprear a vertical scroolbar. Instead the cursor jumps into a new line. And also if I make the whole window smaller, the text which doesn't have enough place jumps into a new line.
How can I make a scrollbar in this case?
I hope you know what I mean, my English isn't the best.
|
|
|
|
|
Hi there,
I have a CTreeCtrl as a child of a docking window (CMyBar). In my docking window class I set a handle just like this:
(CMyBar.cpp)<br />
ON_NOTIFY(TVN_SELCHANGED, ID_TREE, OnTreeChange) .. .
The declaration of the function is
(CMyBar.h)<br />
afx_msg void CMyBar::OnTreeChange(NMHDR *hdr, LRESULT *NotUsed)<br />
I had to explicity add the ON_NOTIFY handler because the Visual Studio6 ClassWizard doesn't show the ON_NOTIFY event for my docking class (CMyBar), (don't know why?).
As far as I know CTreeCtrl does send ON_NOTIFY notifications to it's parent (CMyBar). Spying++ CMyBar window class shows CMyBar gets WM_NOTIFY messages...
Now all this crap doesn't work (OnTreeChange never gets called), and I'm to figure out what's going on and what's wrong with it.
Would be really happy if someone can answer this question...
Thank you!
|
|
|
|
|
I have two C++/WinAPI (non-MFC) classes which draw buttons. One simply uses default drawing; the other implements custom drawing.
Recently, I added a manifest for CommCtrl6 to get the "XP Styles".
The control class that uses custom drawing is working fine -- it recognizes whether themes are present and if so, uses DrawThemeBackground (with the appropriate parameters) to produce the desired results. [otherwise it used DrawFrameControl].
However, the control that uses purely default drawing isn't behaving as I'd expect. The control draws the approriate XP-Style button, but it always frames it with a 1-pixel black rectangle. I've inspected the button's style and extended style flags, and neither BS_DEFPUSHBUTTON nor WS_BORDER is set.
Why is the control being framed and how do I get rid of it??
Rick Aurbach
|
|
|
|
|
Dear all,
I have a simple problem, i hope to get your valuable opinions on it.
Okey, so i have built an MFC application. The main application has a modeless child dialog that is only created when a menu item is clicked.
the modeless child dialog has edit controls which receive input from the user. Now, user input will be used to modify some global variables in the parent class to be used for some purposes.
Let's assume the parent class has the following global variables : xParent, yParent.
the modeless child dialog has two edit controls and one button "Set". the two edit controls save the input to xChild and yChild.
When the user clicks "Set", the variables of the parent [xParent, yParent] should be set to [xChild, yChild] respectively.
How can i do that ? I am thinking to declare an instance of the parent class within the child class and modify the parents variable within the click event of the "Set" button.
Do you think its the best approach to solve this problem ?
Thanx
llp00na
|
|
|
|
|
Try sending a message (WM_USER + N) to the child / parent ...
Maxwell Chen
|
|
|
|
|
would you please clarify more.Whats the purpose of the message (WM_USER + N)???
llp00na
|
|
|
|
|
Please read this[^].
Maxwell Chen
|
|
|
|
|
reinterpret_cast<cmyframewnd *="">(AfxGetApp())->xParent = 5;
|
|
|
|
|
//By this you can set the value of parent member variable from child window.
reinterpret_cast<cmyframewnd *="">(AfxGetApp())->xParent = 5; // AnyValue
|
|
|
|
|
I tried using this method but its giving me a compilation error
llp00na
|
|
|
|
|
llp00na wrote: When the user clicks "Set", the variables of the parent [xParent, yParent] should be set to [xChild, yChild] respectively.
The child will need two variables to hold the values of xChild and yChild . These variables will exist even after the modeless child dialog is dismissed. The parent can access them whenever it needs to.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
yes, but i wana set the parent's variables within the "Set" button's click event in the child dialog.
How do i do that ?
The question really, is how to access the parent's variables from the child dialog !!!
llp00na
-- modified at 10:19 Monday 17th April, 2006
|
|
|
|
|
llp00na wrote: The question really, is how to access the parent's variables from the child dialog !!!
You don't. This is very bad OO practice. For example, if I want to access something in your home, I don't just help myself to it. I send you the proper message and you then get it for me. Read each of these for a better understanding of what you are looking for:
http://flounder.com/badprogram.htm[^]
http://flounder.com/dlgctl.htm[^]
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
put two pointers in the child dialog class, that will poin to xParent, yParent (lets say pXParent,pYParent)..
Before calling the child dialog initialize them with the address of the xParent, yParent
something like
childDlg.pXParent = &xParent;
childDlg.pYParent = &yParent;
childDlg.DoModal();
In childDlg class in the onSet(or whatever name you have for the pushing of the Set button) out something like this
*pXParent = xChild;
*pYParent = yChild;
....
now the xParent,yParent will have the values of xChild, yChild
|
|
|
|
|
Hi all,
I want to capture the screen (using GDI -if it is possible and better than DC).
and Then compare the picture with another one.
please send me the code or a good article(s).
Thanks.
Every new thing you learn,Gives you a new personality.
|
|
|
|