-
May 17th, 2013, 10:58 AM
#1
Help request: QuickTime ActiveX Control Heap Corruption the second time I open a dial
Hello everybody,
I need to write a piece of code that opens a QuickTime VR image into an MFC Dialog.
I drew a Dialog and put an "Apple QuickTime Control 2.0" into it.
Then I created a Control variable in my Dialog class, called QtControl.
In the OnInitDialog I set the file to open, calling the put_FileName of the control.
I tested it by:
- opening a dialog --> worked
- closing it --> worked
- opening again --> crashed. The error was:
"Windows has triggered a breakpoint in TestOcx.exe.
This may be due to a corruption of the heap, which indicates a bug in TestOcx.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while TestOcx.exe has focus.
The output window may have more diagnostic information."
I tried many things and googled a lot, but the only way that I found to avoid this crash was hardcoding a valid URL in the QtControl resources at compile time.
In other words, if I write a valid absolute path to a .mov into the URL property of the QtControl from Visual Studio and compile it, then it works.
Obviously, I can't do this because the absolute Path is valid only on my PC.
What I'm asking you is:
- suggestion to solve this, or
- any website where I can read or,
- at worst, another implementation that is not based on the activeX and takes me 2 days of coding
You may want to download a test application with the problem at this link
Feel free to ask me any other detail, and any hint would be appreciated.
Thanks in advance,
E.Russo
-
May 19th, 2013, 08:31 AM
#2
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
Originally Posted by emarusso
I tried many things
Nowhere do you mention that you tried to debug the problem using the debugger.
Google doesn't solve these problems -- you need to actually debug the issue by launching the application under the debugger.
In other words, if I write a valid absolute path to a .mov into the URL property of the QtControl from Visual Studio and compile it, then it works.
Then that makes it easy if you debug both scenarios and see what different path or what functions are called for each situation.
Regards,
Paul McKenzie
-
May 20th, 2013, 09:06 AM
#3
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
Hello,
here's what I didn't explain in my last post. Every experiment has been done with the debugger attached.
1. In Visual studio, I hardcoded into the URL property of my QuickTime ActiveX control a valid absolute path to a .mov file that was on my PC, say C:\something.mov
in this case it works.
2. I wanted to do something more flexible, so I compiled my program leaving the field empty, and setting it into the OnInitDialog method of the Dialog class that contains the control.
in this case it throws exceptions when I close the dialog. I enabled the Exception flag into the debugger, and it catched the following first-chance one:
First-chance exception at 0x773ac41f in TestOcx.exe: 0x0000071A: Remote procedure call was aborted
this is the Call Stack:
Code:
> KernelBase.dll!773ac41f()
[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]
KernelBase.dll!773ac41f()
rpcrt4.dll!770c0e0b()
rpcrt4.dll!770c0d9a()
winsta.dll!6ae08930()
winsta.dll!6ae08981()
winsta.dll!6ae088ee()
rpcrt4.dll!7704b500()
rpcrt4.dll!7704b4b2()
rpcrt4.dll!7704d8b5()
rpcrt4.dll!7704dbc8()
rpcrt4.dll!7704db45()
rpcrt4.dll!7704de16()
rpcrt4.dll!7704dd5d()
rpcrt4.dll!7704daed()
winsta.dll!6ae08b18()
winsta.dll!6ae0baeb()
winsta.dll!6ae0baa2()
winsta.dll!6ae0ba49()
winsta.dll!6ae0b971()
QTOControl.dll!61bb4e29()
QTOControl.dll!61bb7d84()
QTOControl.dll!61bb0cfc()
Then I passed the exception to the program and the following assert is thrown:
wincore.cpp
Code:
LRESULT CALLBACK
AfxWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
// special message which identifies the window as using AfxWndProc
if (nMsg == WM_QUERYAFXWNDPROC)
return 1;
// all other messages route through message map
CWnd* pWnd = CWnd::FromHandlePermanent(hWnd);
ASSERT(pWnd != NULL);
After ignoring 3 times the assert, the program seems to work.
But sometimes it throws the exception that I mentioned in my first post and the application crashes.
3. I tried to "Shutdown" in some way the quicktime player, by editing the OnClose method of the Dialog, but both didn't solve my problem.
I tried to:
- call the method "QuickTimeTerminate" of the control
- set the URL to empty string
That's it. If you need other info, I'm here... :-)
Regards,
emarusso
-
May 20th, 2013, 12:04 PM
#4
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
Originally Posted by emarusso
2. I wanted to do something more flexible, so I compiled my program leaving the field empty, and setting it into the OnInitDialog method of the Dialog class that contains the control.
And how is this field set in terms of C++?
In other words, a description of what you did is not enough. Show the actual code you claim sets this field. This is especially the case when it comes to strings, as it seems to be the case that too many persons make basic mistakes when it comes to handling string data in C++.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; May 20th, 2013 at 01:37 PM.
-
May 21st, 2013, 02:26 AM
#5
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
The code is here
http://docs.google.com/file/d/0B7Mih...it?usp=sharing
as I wrote in my first post.
Here's the point where I set the URL:
Code:
BOOL CQuickTimeDlg::OnInitDialog()
{
CDialog::OnInitDialog();
HICON hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_QUICKTIME));
SetIcon(hIcon, FALSE);
m_kQtControl.put_FileName(m_strURL);
m_kQtControl.put_FullScreen(m_bFullscreen);
m_kQtControl.put_MovieControllerVisible(m_bMovieControllerVisible);
return TRUE; // return TRUE unless you set the focus to a control
// ECCEZIONE: le pagine delle propriet� OCX devono restituire FALSE
}
where m_strURL is a CString, whose value is written in the CQuickTimeDlg constructor.
-
May 21st, 2013, 04:45 AM
#6
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
Originally Posted by emarusso
m_kQtControl.put_FileName(m_strURL);
And the function prototype for put_FileName is what exactly? Is it this?
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
If so, then a CString is not a BSTR.
http://forums.codeguru.com/showthrea...String-to-BSTR
http://www.flounder.com/cstring.htm#CString%20to%20BSTR
Regards,
Paul McKenzie
Last edited by Paul McKenzie; May 21st, 2013 at 04:48 AM.
-
May 21st, 2013, 08:48 AM
#7
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
Have you checked that the contents of m_strURL.GetBuffer() are correct? What happens if you hardcode the URL as in
Code:
m_kQtControl.put_FileName(_T("MyURL"));
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 21st, 2013, 10:04 AM
#8
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
Originally Posted by 2kaud
Have you checked that the contents of m_strURL.GetBuffer() are correct? What happens if you hardcode the URL as in
Code:
m_kQtControl.put_FileName(_T("MyURL"));
Nothing changes, the error's still there.
-
May 21st, 2013, 12:17 PM
#9
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
Originally Posted by emarusso
Nothing changes, the error's still there.
You are specifying a constant, and now it doesn't work? Before you said it did work when you specify a constant.
Regards,
Paul McKenzie
-
May 21st, 2013, 11:25 AM
#10
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
From your first post
I tried many things and googled a lot, but the only way that I found to avoid this crash was hardcoding a valid URL in the QtControl resources at compile time.
If hardcoding a valid URL in the control at compile does not cause the problem, then IMO the cause of the problem is unlikely to be the control. I would be looking at how I passed the URL to the control.
Where do you hard code the URL? I suggested a test of a hardcoded URL in my post #10 but you replied that this still causes the problem. I don't understand - as in one post you say hardcoding the URL works and in another you say it doesn't.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 22nd, 2013, 02:27 AM
#11
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
Originally Posted by 2kaud
Where do you hard code the URL? I suggested a test of a hardcoded URL in my post #10 but you replied that this still causes the problem.
When I wrote hardcoded I meant that I wrote it in the visual studio resource editor, in the property window.
What you said was to hardcode the string in the function call.
-
May 21st, 2013, 01:46 PM
#12
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
The zip file contains the code from the link.
qt.zip
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 22nd, 2013, 02:30 AM
#13
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
thanks for re-attaching it, I didn't know how to attach it to the thread.
-
May 22nd, 2013, 05:06 AM
#14
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
Originally Posted by emarusso
thanks for re-attaching it, I didn't know how to attach it to the thread.
Then read the Announcement: Before you post....
BTW, is your MFC project a UNICODE or ANSI one? And the same question - about QuickTime ActiveX Control.
Victor Nijegorodov
-
May 22nd, 2013, 05:55 AM
#15
Re: Help request: QuickTime ActiveX Control Heap Corruption the second time I open a
My sample is UNICODE, I tried to compile it multi-byte but the problem's still there.
I don't know wether the ActiveX is UNICODE, and I don't know how to check it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|