|
what does the method ExitInstance()'d actually do?
Thanks ,
V
|
|
|
|
|
Hi,
I am working on an MDI application, and I want to add a progress dialog box to a member function of a class (which is generic). I used the ProgressDlg automatically created by Visual C++ components. It has a Create function (btw, it is not overwriting the CDialog Create), that looks like this:
<br />
BOOL CProgressDlg::Create(CWnd *pParent)<br />
{<br />
m_pParentWnd = CWnd::GetSafeOwner(pParent);<br />
<br />
<br />
if((m_pParentWnd!=NULL) && m_pParentWnd->IsWindowEnabled())<br />
{<br />
m_pParentWnd->EnableWindow(FALSE);<br />
m_bParentDisabled = TRUE;<br />
}<br />
<br />
if(!CDialog::Create(CG_IDS_PROGRESS_CAPTION,pParent))<br />
{<br />
ReEnableParent();<br />
return FALSE;<br />
}<br />
<br />
return TRUE;<br />
}<br />
I thought that it was fair to create this dialog with a NULL parent window. But its weird that the call to CWnd::GetSafeOwner(NULL) returns a valid parent window, and then the CDialog::Create crashes.
So, I tried passing AfxGetMainWnd() but that crashes too. Is it because I am in an MDI app??
Does anyone know how to successfully create an object of this derived CDialog class?
I would appreciate any help.
Thanks
|
|
|
|
|
Have you stepped into CDialog::Create() to see exactly which statement is "crashing?"
When I make a modeless dialog, I use:
class CProgressDlg : public CDialog
{
public:
enum { IDD = IDD_PROGRESS_DIALOG };
virtual void PostNcDestroy();
};
CProgressDlg::CProgressDlg(CWnd* pParent)
: CDialog(CProgressDlg::IDD, pParent)
{
Create(IDD);
}
void CProgressDlg::PostNcDestroy()
{
delete this;
CDialog::PostNcDestroy();
} To use it:
CProgressDlg *pDlg = new CProgressDialog;
pDlg->ShowWindow(SW_SHOW);
pDlg->DestroyWindow(); Does that help?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
There is an ASSERT failure ... This is how the Create for dialog works....
The assertion is caused when CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd* pParentWnd, HINSTANCE hInst) is called and lpDialogTemplate is NULL.
<br />
CDialog::Create(LPCTSTR lpszTemplateName, CWnd* pParentWnd)<br />
{<br />
.....<br />
BOOL bResult = CreateIndirect(hTemplate, pParentWnd, hInst);<br />
<br />
}<br />
<br />
<br />
BOOL CDialog::CreateIndirect(HGLOBAL hDialogTemplate, CWnd* pParentWnd,<br />
HINSTANCE hInst)<br />
{<br />
ASSERT(hDialogTemplate != NULL);
<br />
LPCDLGTEMPLATE lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);<br />
BOOL bResult = CreateIndirect(lpDialogTemplate, pParentWnd, NULL, hInst);
UnlockResource(hDialogTemplate);<br />
<br />
return bResult;<br />
}<br />
<br />
<br />
BOOL CDialog::CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd,<br />
void* lpDialogInit, HINSTANCE hInst)<br />
{<br />
ASSERT(lpDialogTemplate != NULL);<br />
<br />
if (pParentWnd == NULL)<br />
pParentWnd = AfxGetMainWnd();
m_lpDialogInit = lpDialogInit;
<br />
return CreateDlgIndirect(lpDialogTemplate, pParentWnd, hInst);<br />
}<br />
<br />
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,<br />
CWnd* pParentWnd, HINSTANCE hInst)<br />
{<br />
ASSERT(lpDialogTemplate != NULL);<br />
....<br />
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,<br />
pParentWnd->GetSafeHwnd(), AfxDlgProc);
<br />
<br />
<br />
}<br />
<br />
Swati
-- modifed at 14:43 Thursday 25th August, 2005
|
|
|
|
|
|
Further to your message, I'll restate the problem:
I am using a class CProgressDlg which is derived from CDialog. I am creating a modeless dialog in a generic class, so I use something like this:
CProgressDlg dlg;
dlg.Create(NULL);
where the Create function is as shown in the first email. This function throws an ASSERT failure. I think the problem is due to the fact that CDialog creates a dialog with parent wnd as AfxGetMainWnd() which returns a CMDIFrameWnd() as opposed to CMainFrame() in an SDI app. I have used this CProgressDlg class before in an SDI app and had no problems, and the only difference I can see is this.
Am I clearer now?
Swati
|
|
|
|
|
C
swati24 wrote:
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd* pParentWnd, HINSTANCE hInst)
{
ASSERT(lpDialogTemplate != NULL);//ASSERTION FAILURE
....
}
Sorry I misquoted the above, lpDialogTemplate is not NULL.
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd* pParentWnd, HINSTANCE hInst)
{
....
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,
pParentWnd->GetSafeHwnd(), AfxDlgProc); //CAUSES ASSERTION FAILURE
//pParentWnd is not NULL
...
}
|
|
|
|
|
Hi,
Firstly, yes it helps.
You see earlier I had this function called:
<br />
BOOL CProgressDlg::Create(CWnd* pParent)<br />
{<br />
CDialog::Create(CProgressDlg::IDD, pParent);<br />
}<br />
and this crashed when I did:
<br />
CProgressDlg* pDlg = new CProgressDlg();<br />
pDlg->Create(NULL);<br />
But now I got rid of Create function and added Create(IDD) in the constructor and it works. Do you know why?
Swati
|
|
|
|
|
Hi,
The user have an ability to change a Windows font size and type(Display Properties/Apperance/Font Size: Normal, Extra Large, Large), and those changes affect my application fonts, dialog boxes, some controls, etc...
I just need an advice, what the best way to handle it in the GUI.
And another question.
Can I some how to preserve my application's default font(MS Sans Serif size 8) from overriding by Windows?
Thanks.
|
|
|
|
|
Hi,
Does anyone know which sytem colour is used for the background of the task pane shown on the left hand edge of Windows Explorer windows in XP?
Thanks
Joel Holdsworth
|
|
|
|
|
Not exactly. But you can use the Display applet's Appearance tab (rundll32 shell32.dll,Control_RunDLL desk.cpl,,2) in Control Panel and GetSysColor() to figure it out.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-- modifed at 14:02 Thursday 25th August, 2005
|
|
|
|
|
Yeah that's the funny thing... I can't figure it out. I don't think I'm being stupid, but I can't find where this colour comes from! I think it comes from the theme itself somehow, but I'm not sure!
Joel Holdsworth
-- modified at 3:53 Friday 26th August, 2005
|
|
|
|
|
Hello,
I am trying to build a download accelarator (a program which downloads a file through several connections to increase the speed).
I have created four threads. Each thread downloads the file from diffrent offset and finallly I join al this parts.
The problem is that when I use one thread( without changing the thread's code) it much faster. It like the additional threads are slowing one another.
In each thread I initialize the connection (CInternetSession->CHttpSession) and later in the thread I have put a loop which downloads the files.
The initialization part is in a critical section.
Can anyone tell whats wrong. Did anyone encountered similar problem?
Sincerely yours
Y.R.
|
|
|
|
|
Y_R wrote:
It like the additional threads are slowing one another.
how many CPUs does your computer have ?
( for that matter, how many internet connections does it have ? )
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I have one cpu and one internet connection (750 k). But it should not matter because when one is downloading file from a server that is slow multiple http connections to this server will raise the overall speed like many existing download accelators(e.g. Get Right, DAP, etc..)
I think the problem is in my multithreading part.
Sincerely yours
Y.R.
|
|
|
|
|
Hi there,
Does ne1 know what type of control is used in Skype chat for the Contacts?
How can i mimick it? ie. There is a name and when i click on it it expands revealing more details?
Thanks a million
|
|
|
|
|
Hey,
I'd like to print out a line create with
<br />
CPen pen(PS_DASHDOT,1,RGB(0,0,0))<br />
and MM_LOMETRIC MapMode.
When I look at the preview all works fine, but after printing there is a solid line on the paper.
What can I do?
Greetings
AnTri
|
|
|
|
|
Hello All,
Does anybody know how to find out interfaces exposed by a driver (.sys file)?
Thanks in advance
|
|
|
|
|
Hi all,
I am doing a project for uni which basically get images from a logitech quickcam pro 4000 camera, and the guy in our group who compiled our current software has stopped doing the subject and left us with a server/client package that streams the video fine, but encodes using H.263 mpeg encryption not MJPEG and i have absolutely no idea how to convert from one to the other. I found the library used for encryption that he wrote/borrowed and i was wondering if i could email this library to someone, then they tell me which parts to change and i could post the parts that need changing so others can see it as well, as i know that is the policy here, there is just too much code to display in the one message. Any help would be appreciated as I have been left in the deep end here.
regards,
Jordan
If you eat porridge every day you will get sick of it.
|
|
|
|
|
Would it be of any benefit to look at the MJPEG format at www.wotsit.org[^]?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-- modified at 10:42 Sunday 28th August, 2005
|
|
|
|
|
I had a look at witsit.org and it said the page is under construction so i couldnt get any MJPEG information from there. Are there any other sites where i can see sample code of MJPEG implementations?
If you eat porridge every day you will get sick of it.
|
|
|
|
|
I have found some code which is here: www.morgan-multimedia.com/downloads/codec.c and i was wondering if anyone can have a look at it and tell me how to implement the code like which function do what etc. It would help me a lot,
Jordan
If you eat porridge every day you will get sick of it.
|
|
|
|
|
Try that link again.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Sorry my bad there is no 's' in download, here is the link again:
http://www.morgan-multimedia.com/download/codec.c
Jordan
If you eat porridge every day you will get sick of it.
|
|
|
|
|
I meant for you to re-try the link I provided.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|