|
Please give me any tips of how to do that? Thanks in advance
NastradamuS
|
|
|
|
|
and what is a transporter agent supposed to be please ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi,
I have a problem with window painting...
The parent window has the layered property and it has some transparency settings also. The program use multiple desktops. This window is in the default desktop.
From another desktop I invoke some dialogs(which are completely ownerdrawn). These dialogs contains some special control(like ownerdrawn buttons, text display control derived from CWnd for showing some text, etc).
Problem is the dialog comes in the default desktop with out painting... a black window... sometimes. But when I click in it it will paint itself. Same is to the button.
When I remove the Layered Attributes settings, there is no problem.
Are there any special things to do to child dialogs if Layered Attributes settings are used?
Expecting valuable replays...
Thank you.
- NS -
|
|
|
|
|
have you tried InvalidateRect(), RedrawWindow(), something like that?
My articles
BlackDice
|
|
|
|
|
|
I need help making the menu and the title bar be written in a some other font, then it is by default.
NastradamuS
-- modified at 6:53 Wednesday 16th November, 2005
|
|
|
|
|
|
how to use:
SetFolderImageList(const int folder, CImageList * pImageList, int nImageList)?
how to set multi-outlookbar folder image?
|
|
|
|
|
I have code like this
<br />
fun1(){<br />
CEdit* pEdit=new CEdit;<br />
pEdit->Create(...);<br />
}<br />
fun2(){<br />
CEdit* pEdit=new CEdit;<br />
}<br />
fun3(){<br />
pEdit->SetWindowText("Bla Bla");<br />
}<br />
But I have problems in fun3() because sometimes the pEdit object isn't created.
What function I could use, to test pEdit, in fun2 to know if the object is created or not?
Thanks
|
|
|
|
|
( I assume that what you wrote in your question is what you have in your real code )
Well, you should go back to to your C++ books ...
in fun1 you create a local variable pEdit which will leak memory when the function ends; same thing in fun2
in fun3 you access a variable that is not allocated yet, so it will crash.
NOW, assuming that what you wrote is not actually your real code and that you pass pEdit as a parameeter to fun3 , check to see if pEdit is NULL before trying to access it :
fun3( CEdit* pEdit )
{
if ( pEdit )
pEdit->SetWindowText("...");
}
If when calling fun3 your not certain that pEdit is Create ed, you can check with CWnd::GetSafeHwnd ( or something similar ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
SORRY.
Of course, the sintax wasn't correct.
This probally is better.
<br />
CEdit* pEdit=NULL;<br />
InitType1(){<br />
pEdit=new CEdit;<br />
pEdit->Create(...);<br />
}<br />
InitType2(){<br />
pEdit=new CEdit;<br />
}<br />
DoSomething(){<br />
pEdit->SetWindowText("Bla Bla");<br />
}<br />
Now.
if(pEdit) pEdit->SetWindowText("Bla Bla");
doesn't work because we could think that pEdit is always !=NULL.
if(pEdit->GetSafeHwnd()!=NULL) pEdit->SetWindowText("Bla Bla");
Looks interesting, and I think that could work.
So, Thank you
-- modified at 7:50 Wednesday 16th November, 2005
|
|
|
|
|
Matteo_78 wrote: if(pEdit) pEdit->SetWindowText("Bla Bla");
doesn't work because we could think that pEdit is always !=NULL.
Well, we would not... and checking the pointer validity is always a good thing, either with ASSERT or by if
...
BTW, why do you new pEdit twice ? is pEdit a class member variable ? in DoSomething , which pEdit are you referencing ? the one allocated in InitType1 or in InitType2 ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
The code that I've posted was only an example, in my program the situation isn't so simple.
Yes, I'm checking pEdit before entering in this instructions.
About InitType1 and InitType2 and the doubled 'new': these are 2 different type of initalization functions of pEdit. And you could be sure that only one of InitType* was runned before DoSomething .
Thank you for your help;)
|
|
|
|
|
I use something like
if( ::IsWindow(pEdit->m_hWnd) ){
to verify that the window that the object references has been created and still exists.
GetSafeHwnd() will protect against the NULL this pointer and return the m_hWnd, but it won't let you knwo if the window exists, prior to sending a message.
Maybe you want soemthing like this:
if( pEdit && ::IsWindow(pEdit->m_hWnd) ){
|
|
|
|
|
did you look into the MSDN[^] ?
MSDN tells us :
CEdit::Create()
Creates the Windows edit control and attaches it to the CEdit object.
Return Value
Nonzero if initialization is successful; otherwise 0.
i think you'll find you hapinness there, won't you ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
CEdit* pEdit=NULL;
pEdit = new CEdit();
fun3()
{
if(pEdit!=NULL)
pEdit->SetWindowsText("Bla Bla");
}
Bye
Cool Ju
Vote for Cool Ju
|
|
|
|
|
how to indicate sorting icon in the list control on clicking column header.
knarasimharao
|
|
|
|
|
Check this[^]...
In CP one C# atricle is there on this ....
See this[^]....
Hope this will help you....
|
|
|
|
|
I have to write a program which shows a dialog when click on a button. After that, when click outside this dialog, it will be closed.
I've tried to use OnKillFocus function to check whether this dialog should be closed or not but it doesn't work.
Could u suggest me another solution to to this task?
Thanks in advance.
THE_TIME
|
|
|
|
|
OnActivate? (assuming you use MFC)
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I don't know how to use OnActivate function, could u tell me more detail?
Many thanks to your help.
Trunghd
|
|
|
|
|
trunghd wrote: I don't know how to use OnActivate function
MSDN[^] is your friend buddy...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I just tested this, OnActivate won't work for you. Since it's a modal dialog (which I assume it is) it won't receive OnActivate messages when you click outside the dialog. Similarly, you won't get any WM_LBUTTONDOWN or the likes when the user clicks outside your dialog. Instead, you must handle the WM_NCACTIVATE message:
In your dialog class header, put
<br />
afx_msg BOOL OnNcActivate(BOOL bActive);<br />
and put
<br />
ON_WM_NCACTIVATE()<br />
in the dialog class' message map.
in CYourDialog::OnNcActivate handle the case bActive==FALSE, this is when the user clicks outside the client area. Dismiss your dialog in whatever way is appropriate.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
trunghd wrote: but it doesn't work
What does not work ? You do not catch the WM_KILLFOCUS message, or does the message not get send when you click outside the dialog ?
Three possibilities here (from the best to the least good, IMO):
1- Catch the WM_ACTIVATE message( MFC using afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized ); and WA_INACTIVE as nState). In the message handler, dismiss your dialog.
2- Catch WM_KILLFOCUS, i still do not understand why this should not work
3- Handle WM_LBUTTONDOWN and WM_RBUTTONDOWN, check if the clicked position is inside the area of your dialog, if not, dismiss the dialog.
Hope this helps
~RaGE();
|
|
|
|
|
This program I have to write is very similar to the Undo button in MS Visual C++ 6.0. When click on a button, a new dialog which have a listbox within it appears. We can choose item in listbox. When we click outside the dialog, it will be closed.
I use Create()& SetWindowPos functions to put the new dialog at the bottom of this button.
Firstly, I've tried to use OnKillFocus to check when the dialog lost focus but I always get WM_KILLFOCUS message immediately after SetWindowPos function. So the dialog disappear immediately after appear.
Second, I've tried to catch WM_ACTIVATE message but I don't know how to check WA_INACTIVE or WA_ACTIVE in the WM_ACTIVATE message. Do I have to override OnActivate function to handle WM_ACTIVATE message.
Could u tell me more detail?
Many thanks for your help. It's very precious.
Trunghd
|
|
|
|