|
Hi there,
I am developing a piece of code to grab images from Video files. Is the Video For Windows API still the way to go? As a side note, does anyone know how easy it is to grab images from DVDs?
AJ
|
|
|
|
|
I am trying to store top score (CString and int) (name and score) values to the registry
They are declared in the CMainFrame Class and initialized with the default values and in OnCreate from the stored values from the registry i debugged it and seen that they are okay till the end of the OnCreate function;
Used WriteProfileInt & WriteProfileString In OnClose and
Used GetProfileInt &GetProfileString In OnCreate
I wanted to update the values when the game is over and when game is over i post a message using PostMessage in The CView and in the handler function i use
((CMainFrame*)AfxGetApp())->m_strTopScore => now this value is null
((CMainFrame*)AfxGetApp())->m_iTopScore => now this value is 512
But As I said earlier the m_strTopScore was assigned a default value of "New Player"
and the m_iTopScore=0;
and when i try assign the m_strTopScore with new value
((CMainFrame*)AfxGetApp())->m_strTopScore="New String";
i get an ASSERT in line that says
_AFX_INLINE CStringData* CString::GetData() const
{ ASSERT(m_pchData != NULL); return ((CStringData*)m_pchData)-1; }
I used regedit and seen the stored default values in OnCreate i.e "NewPlayer" and 0
Why is the Value of 0 changed to 512 and NewPlayer to null
There is no place this variables are modified ??????? Any Ideas???????
|
|
|
|
|
Your question is a little confused.
Are you storing your data in your CFrameWnd derived class (CMainFrame) or in your CWinApp derived class.
AfxGetApp() returns a point to a CWinApp class and not your CMainFrame
You need to use AfxGetMainWnd to get a pointer to your CFrameWnd derived class.
Michael
CP Blog [^]
|
|
|
|
|
you should also be able to use CView::GetParentFrame()
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
My articles[^]
bdiamond
|
|
|
|
|
Sorry, I didn't mean GetParentFrame(), I meant GetParent(). This is a line of code that I use in one of my applications:
CMainFrame* pFrame = (CMainFrame*)GetParent();
then use
pFrame->m_strTopScore ;
make sure your variables are in the public section of your class definition for CMainFrame and make sure you #include "Mainfrm.h" in your view's .cpp file.
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
My articles[^]
bdiamond
|
|
|
|
|
Hi,
When I press a push button on one dialog box ,other dialog box or form should be displayed.How Can I do that?
Also please tell me how can we start an application B from other application A( eg. by pressing push button on application A).
Drushti
|
|
|
|
|
|
Thakyou Michael , it really helped in my application.
Drsuhti
|
|
|
|
|
to start another application, use ShellExecute()
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
My articles[^]
bdiamond
|
|
|
|
|
Hi bdiamond,
How to use Shellexecute to switch to other application in VC++ by just clicling a push button?? Can u please elaborate on this ?
Thankyou in advance.
Drushti
|
|
|
|
|
ShellExecute(NULL, "open", "myapplication.exe", NULL, NULL, SW_SHOWNORMAL);
that will open an application and start it called "myapplication.exe", of course you'd have to replace that with the real name of your app. However if an application is already open, you would probably have to use something like FindWindow() to get the window's hWnd, then call SetForegroundWindow() or something like that.
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
My articles[^]
bdiamond
|
|
|
|
|
Hello,
I have a program program that is leaking memory. I commented out all the code that possibly could cause the leak, but the leak is still there. The following code is all there is left:
<br />
int main()<br />
{<br />
return 0;<br />
}<br />
And when I run this code I get the following leaks:
Detected memory leaks!
Dumping objects ->
{46} normal block at 0x00A42760, 792 bytes long.
Data: <september> 53 65 70 74 65 6D 62 65 72 00 CD CD CD CD CD CD
{45} normal block at 0x00A44C70, 448 bytes long.
Data: <thu mbe="" wed=""> 54 68 75 00 6D 62 65 00 57 65 64 00 6D 62 65 00
{44} normal block at 0x00A446F8, 1328 bytes long.
Data: <%a %b %e %H:%M:%> 25 61 20 25 62 20 25 65 20 25 48 3A 25 4D 3A 25
{43} normal block at 0x00A425C8, 344 bytes long.
Data: <pm wed="" m:%=""> 50 4D 00 CD CD CD CD CD 57 65 64 00 4D 3A 25 00
{42} normal block at 0x00A42440, 320 bytes long.
Data: <c sun=""> 43 00 CD CD CD CD CD CD 53 75 6E 00 CD CD CD CD
Object dump complete.
The thread 0x58C has exited with code 0 (0x0).
I'm using STLPort with _REENTRANT defined and VC6.0. Are there any memory leaks in STLPort that I should know about?
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
I think that is not memory leak
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Hello,
Why do you think that it is no leak?
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
What you are seeing are false positives. Probably stuff that gets allocated as part of global variable initialization. The CRT memory report is happening prior to those global variables getting destroyed.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanks for your reply. Since I ran the code this morning, the memory leaks disappeared! I'll be happy as long as they stay away
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Turn on CRT Debug checks at the start of main() and off again at the end. See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/_core_using_the_debug_heap.asp
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Hello,
Thanks for your reply. I was checking the leak again this morning and it disappeared! Anyway, as long as it stays this way...
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Well I get the error: ASSERT(::IsWindow(m_hWnd));
On my main dialog I show the modless dialog and on the modless dialog I try to close it.
MAIN dialog
CModless m_modless;
m_modless.ShowWindows(SW_SHOW); // Works Greate
Modless dialog (on close )
CModless m_modless;
m_modless.ShowWindow(SW_HIDE); // Get the error.
On initdialog on the main dialog I use,
m_modless.Create(IDD_MODLESS); // To create the modless dialog.
It works to show the dialog but not to close it.
What Im I doing wrong?
|
|
|
|
|
I dont' know if you put the CModless m_modless in both places just for our benefit, but a modeless dialog needs to be declared as a member variable of the calling class. If it's declared as a local variable, it goes out of scope as soon as the function's over.
But this is what I do. When I create the modeless dialog, I send in a pointer to the calling class. In the calling class, I #define something like WM_CLOSE_MYDIALOG as WM_USER + 101. Then in the modeless dialog's close handler I do this:
m_pCallingClass->SendMessage(WM_CLOSE_MYDIALOG);
make a message map for that message in the calling class, and in the handler call DestroyWindow() for the modeless dialog member variable. hope this helps, because you did help me. Thanks!!
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
My articles[^]
bdiamond
|
|
|
|
|
|
I posted a question a little while ago, and someone helped me with using an embedded dialog. It worked, but I have two problems.
1. the dialogs show up ok, but if I hit the Enter key, my dialog disappears.
2. The second dialog has a dialog embedded in a static text control (like it is itself), but the smaller dialog has a Custom Control on it that I'm using for an instance of Chris Maunder's MFC Grid Control. Everything else shows up in the smaller dialog except for the custom control.
Does anyone have any suggestions? Oh, the static control is on a CFormView. I chose to use the CFormView to utilize some of the Doc/View architecture, but I still need the CDialog-derived classes for other purposes.
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
My articles[^]
bdiamond
|
|
|
|
|
When you press enter key you get to the OnOK(); and OnClose(); you must set some he on that funktions.
|
|
|
|
|
the custom control wasn't showing up because the style wasn't set right, and the enter button was like the answer to my post said, I just had to overrid trhe OnOK() handler and put a return statement in;
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
My articles[^]
bdiamond
|
|
|
|
|
how to download a web-page in C++ (not display it)?
includeh10
|
|
|
|