|
Your problem is that you are running out of GDI resources because you are not deleting your brushes in your calls to the CTLCOLOR messages. The best way to handle that is to create a member variable in your window class or a global variable that gets initialized and holds the brush. Then you just hand out that same brush over and over.
Good luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
THanks. I have done that. Well I did one more thing last night and it made the application to work fine.
I used this code to handle WM_NCPAINT
<br />
case WM_NCPAINT:<br />
if(hwndDlg==m_hwndMain)<br />
{ <br />
hDC=BeginPaint(hwndDlg,&paint);<br />
paint.fErase=FALSE;<br />
EndPaint(hwndDlg,&paint);<br />
ReleaseDC(hwndDlg,hDC);<br />
}<br />
return FALSE;<br />
break;<br />
If I dont use it I dont get my title bar drawn and if I use it it works fine. Dont actually know why is it working with that. Must be inside of my code.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
When i create a new Class.
I want to do it base as the class CFindReplaceDialog.
But i can't choose it.
Why?
how to do it ?
i feel good.
|
|
|
|
|
But you can do it by hand!
If you really HAVE TO use the wizard, simply make the class derived from something else (CDialog might be OK when ypu design a dialog), then in the header change the #include line of the header-file to that of CFindReplaceDialog .
Then you only need to change every occurence of CDialog in your header and code files to saying CFindReplaceDialog and you are done.
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
your mean is frist choose the CDialog as the Base Class?
and then replace the CDialog to CFindReplaceDialog in the cpp and h file?
is right?
let me try it.
thanks.
go on...
i feel good.
|
|
|
|
|
i have tried it .
but it is failed.
i find that if only replace the CDialog to CFindReplaceDialog is not the all
.
must be change more:
------------------------
<br />
#include "stdafx.h"<br />
#include "CFindTest.h"<br />
#include "MyFindDlg.h"<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
<br />
IMPLEMENT_DYNAMIC(CMyFindDlg, CFindReplaceDialog)
<br />
CMyFindDlg::CMyFindDlg(BOOL bFindDialogOnly, LPCTSTR lpszFindWhat,<br />
LPCTSTR lpszReplaceWith, DWORD dwFlags, CWnd* pParentWnd )<br />
: CFindReplaceDialog()
{<br />
}<br />
<br />
<br />
BEGIN_MESSAGE_MAP(CMyFindDlg, CFindReplaceDialog)<br />
END_MESSAGE_MAP()<br />
<br />
-------------------------------------
<br />
#if !defined(AFX_MYFINDDLG_H__0F4D5405_8798_432C_91D0_46FB54833CE7__INCLUDED_)<br />
#define AFX_MYFINDDLG_H__0F4D5405_8798_432C_91D0_46FB54833CE7__INCLUDED_<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
class CMyFindDlg : public CFindReplaceDialog<br />
{<br />
DECLARE_DYNAMIC(CMyFindDlg)
public:<br />
CMyFindDlg( BOOL bFindDialogOnly,
LPCTSTR lpszFindWhat,<br />
LPCTSTR lpszReplaceWith = NULL,<br />
DWORD dwFlags = FR_DOWN, <br />
CWnd* pParentWnd = NULL );<br />
protected:<br />
DECLARE_MESSAGE_MAP()<br />
};<br />
#endif // !defined(AFX_MYFINDDLG_H__0F4D5405_8798_432C_91D0_46FB54833CE7__INCLUDED_)<br />
---------------------
that is my NEW Class CMyFindDLg.
i use it in the CMainFrame ,but it has Failed.
void CMainFrame::OnFind() //a new
{
// TODO: Add your command handler code here
CMyFindDlg dlg; // i want to declare the Class CMyFindDlg object .
}
but have a error:
: error C2512: 'CMyFindDlg' : no appropriate default constructor available
how i will do ?????
thanks.
i feel good.
|
|
|
|
|
zhdleonid wrote:
CMyFindDlg dlg; // i want to declare the Class CMyFindDlg object
First, MSDN says: "CFindReplaceDialog objects are constructed on the heap with the new operator".
Maybe doing so with your class may help?
CMyFindDlg* pDlg = new CMyFindDlg(); Second, you cant make a CMyFindDlg without parameters, because you have no constructor defined that uses no parameters. This is what the compiler is saying here:
": error C2512: 'CMyFindDlg' : no appropriate default constructor available". Call your constructor with any constructor arguments you need, construct the CFindReplaceDialog without parameters (as you do) and store the parameters in member vars of CMyFindDlg until you need them.
Third, as the MSDN states in the article about CFindReplaceDialog ,
you show the dialog using the Create() -function.
Do this when calling your dialog (and override this function as neccesary).
Hope this helps
--
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
Thanks all you say.
i know why it has an error.
but i don't konw how to make it right.
i try :CMyFindDlg* pDlg = new CMyFindDlg();
but it isn't right.
so i will do as it have parameters.
for example:
if I New a class CMyFindDlg base on the class CFindReplaceDialog
when i use the new class CMyFindDlg to define a object in the CMainFrame.
i will do :
void CMainFrame::OnFind()
{
// TODO: Add your command handler code here
CMyFindDlg dlg(...) //here ,how to write? can you help me?
}
wait you.
i feel good.
|
|
|
|
|
Try something like this:
void CMainFrame::OnFind()
{
CMyFindDlg* pDlg = new CMyFindDlg(..you parameters..);
pDlg->Create(..parameters that CFindReplaceDialog::Create needs..);
} This Way you first construct your Object, giving it the parameters it needs, and later display it, using the parameters that create needs.
You did #include < afxdlgs.h > ? MSDN says there are the headers for CFindReplaceDialog.
Hope this helps
--
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
but i don't how to over write the CFindReplaceDialog::Create
in the NEW Class CMyFindDlg.
i try:
//in CMyFindDlg.hF
BOOL Create(BOOL bFindDialogOnly,
LPCTSTR lpszFindWhat,
LPCTSTR lpszReplaceWith = NULL,
DWORD dwFlags = FR_DOWN,
CWnd* pParentWnd = NULL);
//in CMyFindDlg.cpp
CMyFindDlg::Create(BOOL bFindDialogOnly, LPCTSTR lpszFindWhat,
LPCTSTR lpszReplaceWith, DWORD dwFlags, CWnd* pParentWnd )
{
return TRUE;
}
when i use :
void CMainFrame::OnFind()
{
// TODO: Add your command handler code here
CMyFindDlg* pDlg = new CMyFindDlg();
pDlg->Create( TRUE, "", "", FR_DOWN, this );
}
to do
it run CMyFindDlg::Create() ,not the CFindReplaceDialog::Create.
-------------------------------------------------------------------
i feel good.
|
|
|
|
|
zhdleonid wrote:
error C2512: 'CMyFindDlg' : no appropriate default constructor available
This means you're trying to build your object, somewhere, but do not provide a constructor that has no arguments. Actually I thought the compiler wrote you one if you did not provide it, so it's more likely the default constructor is private, meaning you cannot access it.
zhdleonid wrote:
: CFindReplaceDialog()
Of what use is this, seeing as you don't pass in anything ? Does CFileReplaceDialog have a default constructor ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
dose the class CFindReplaceDialog defined in
#include <afxdlgs.h>????
i feel good.
|
|
|
|
|
It's an MFC dialog, it will be defined in the MFC source, which comes with VC. Do a find in files for CFindReplaceDialog:: and you'll find the source.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Instead of using (c) in the About box I used the real symbol ©.
On my machine and a lot of others it is perfectly visible.
But, I have a colleague (who runs XP) who doesn't see that symbol
in the about box. Instead he sees a '?'.
Also, when he opens my project in MSDEV, he can't see the ©,
but again sees a '?' instead.
When he looks e.g. at the about box of Outlook the © is perfectly visible.
Any ideas on how to solve this?
Thanks.
|
|
|
|
|
What font are you using?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Hi Rickard,
I'm using the standard MS Sans Serif (size 8).
So, it's not that this symbol doesn't exist in that font.
Thanks for your reaction.
Geert.
|
|
|
|
|
strange, perhaps have a look into your .rc file ? any strange things or unwanted code page (language local)?
|
|
|
|
|
Nothing suspicious.
Language is English (U.S.) and the © character is perfectly visible.
Must be something with XP I guess.
Geert.
|
|
|
|
|
How can I make a DialogBase Program with no TaskBar Button.
I can make it by StatusBar icon;). But i can't remove it's TaskBar button .
Plaese guid me how do I it.
THANKS.
|
|
|
|
|
have a look at this[^] article
Cheers
Kannan
|
|
|
|
|
hi,
I'm not able to execute script using IHtmlWindow2 as execScript function fails..for e.g thr following code returns failed..
BSTR bstrCode = ::SysAllocString(L"MsgBox \"Hello there\"");
BSTR bstrLanguage = ::SysAllocString(L"vbscript");
VARIANT var;
VariantInit(&var);
hr = pWindow->execScript(bstrCode, bstrLanguage, &var);
if(SUCCEEDED(hr))
AfxMessageBox("success!!");
else
AfxMessageBox("failed !!");
Can anyone Help me with this?The IHTMLWindow2 is successfully created and its other functions like pWindow->alert(.. work correctly in this same code.
thanx in advance,
viraj
|
|
|
|
|
Hi,
I've Created an ActiveX container application by selecting container in the third step of the Wizard of to make an SDI Application. I'm able to Insert ActiveX Objects into the Application. they look real great. The problem is the window Messages like Left Mouse Button Click MouseMove etc.. are not being sent to the control as a result it just appears to be doing nothing but appear as images. is there any method that would enable the controls to recieve User Interface messages. Would be very thankful for helping out.
Thank You
|
|
|
|
|
Hi,
I've Created an ActiveX container application by selecting container in the third step of the Wizard of to make an SDI Application. I'm able to Insert ActiveX Objects into the Application. they look real great. The problem is the window Messages like Left Mouse Button Click MouseMove etc.. are not being sent to the control as a result it just appears to be doing nothing but appear as images. is there any method that would enable the controls to recieve User Interface messages. Would be very thankful for helping out.
Thank You
|
|
|
|
|
I have a drop-down list style combo box control in my program, with about 10 items in it. In XP, when it is dropped down, it shows all the items at once, like I want it to. But in 98, it only shows one item, with tiny up and down scrollbars to show the other items. Why does it do that? How can I make it show all the items at once?
Thanks!
|
|
|
|
|
Did you try extending the Combo Box's drop down length at design time.
By default it displays the tiny scrollbar as if there is only one item.
Cheers
Kannan
|
|
|
|