|
I have an MDI application with a CDialogBar. Immediately after I have created the dialogbar, I can access the controls on it with GetDlgItem, but when I try to to access them at a later stage, GetDlgItem fails and I get a failed assertion for ASSERT(::IsWindow(m_hWnd)), where m_hWnd is the window handle of the dialogbar. Looking in the debug locals window I can see that CDialogBar::m_hWnd is now NULL. Yet I can still see it fine on the screen.
Why would it lose its HWND? How does it work without it? How can I access the controls on it? Thanks.
|
|
|
|
|
did you do this ?
hDlgWnd = m_wndDialogbar.m_hWnd;
instead do this
hDlgWnd = m_wndDialogBar.GetSafeHwnd();
MFC clears its temp map and the entry goes in permanent map if you do this GetSafeHWnd()
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
I was just calling CDialogBar::GetDlgItem and letting it sort out its own window handle. I've tried GetSafeHwnd() and I still get 0xCDCDCDCD
|
|
|
|
|
such situations can arise in multithreaded environment , are there any threads ?
did you use SPY ++ to see the windows handle
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
I gave up on this prob for about a month there but now I really really want to get it sorted. Its a single threaded MDI app in VC7. I can't find anyway to access the controls on the dialogbar after it has been created. I've tried DDX_Control, GetDlgItem, creating everything on the heap and everytime I get failed asserts like ASSERT(::IsWindow(m_hWnd)) from GetDlgItem etc
Any help very much appreciated
|
|
|
|
|
hi all i am a student in Computer science engineering 1st year..new guy in the field of programming..i am asked to make a program that runs its own type of video files...
ex: i have a *.AVI file i must convert to a type of my own like *.itp for example then this file is not runnable on any player except my own one..
can anyone help me with how to edit header for the video and how to render it using my program
|
|
|
|
|
You could use the old Win32 AVIFile functions, or the newer DirectShow objects.
The old AVIFiles are really easy to use if you just want to grab individual frames from a video, without sound, but they don't work with new formats like DV. Look for AVIFileInit in MSDN.
DirectShow is a bit trickier as its all COM objects, but its very powerfull, and allows you to create your own media player with relatively little code if you want. You'll need IMediaDet if you want to grab individual frames.
Good luck!
|
|
|
|
|
wow that is soe project for a first year guy
video files of own format !
you can simply put series of images in a file and display them you won't get a good fps but good for learning
or use directshow or AVIapi to display avi files but that's not what you want right
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
sure it is big for me to do..can you please tell my teacher that information.....so he may discard me from this project...
so if you please can you help me...with some more technical information for a beginner....thanks
|
|
|
|
|
Hi !
Is there a way in standard C++ to programmatically get the limits of an int (i.e the smallest possible number and the biggest possible number) ?
Thanks !
Jerome
|
|
|
|
|
int max=0,min=0;
min = min-1; //smallest possible number;
max = -min + 1; //largest possible number;
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Mr.Prakash wrote:
int max=0,min=0;
min = min-1; //smallest possible number;
max = -min + 1; //largest possible number;
????
Well, I don't see how it could work.
min = min -1 gives -1 for min.
max = -min + 1 gives 2 for max, isn't it ?
Jerome
|
|
|
|
|
Yak!! what was i thinking.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
std::numeric_limits<int>::min()
std::numeric_limits<int>::max()
|
|
|
|
|
Thanks for your help !
I still have a problem though :
I do :
#include <limits>void main()
{
int LowerLimit=std::numeric_limits<int>::min();
}
And I get these errors when I compile :
warning C4003: not enough actual parameters for macro 'min'
error C2589: '(' : illegal token on right side of '::'
error C2059: syntax error : '::'
I'm using VS 6.
Any idea ?
Thanks !
Jerome
|
|
|
|
|
First time I posted, the forum removed my <int> - I forgot to check the checkbox "Do no treat <'s as HTML tags".
I should be:
#include <limits>
LowerLimit=std::numeric_limits<int>::min();
its a template class - you can use it for any primitive data type, eg.
std::numeric_limits<float>::min();
std::numeric_limits<double>::max();
|
|
|
|
|
<small><b>Rowan Seymour wrote:</b></small>
<i>I forgot to check the checkbox </i>¨
So did I !!!
Here is the line I have in my code :
int LowerLimit=std::numeric_limits<int>::min();
and the errors I get :
warning C4003: not enough actual parameters for macro 'min'
error C2589: '(' : illegal token on right side of '::'
error C2059: syntax error : '::'
It looks like 'min' has many definitions, but the namespace should do it, right ?
I don't see what I'm doing wrong !
Jerome
|
|
|
|
|
|
yes, and using namespace std !
strange....
|
|
|
|
|
Try the following program:
#include <limits>;
#include <iostream>;
int main()
{
int LowerLimit=std::numeric_limits<int>::min();
int UpperLimit=std::numeric_limits<int>::max();
std::cout << LowerLimit << '\n'
<< UpperLimit << std::endl;
}
Don't use any other include statements.
|
|
|
|
|
min is a Win32 macro computing minimum of two parameters. It intererferes with the numeric_limits<>::min() function. The similar example is min(x, y) and max(x, y) function in <algorithm> , so in stl header files distributed with VC are defined as _cpp_min and _cpp_max . But there isn't any similar definition in numeric_limits.
You can use the INT_MIN , INT_MAX macros from limits.h . The numeric_limits class is only a STL wrapper around these macros.
HTH.....Robert-Antonio
|
|
|
|
|
INT_MIN, SHRT_MIN, SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, SHRT_MAX, USHRT_MAX, INT_MAX, UINT_MAX - all defined in ANSI-C and C++, including VS6, see limits.h
Bernd
|
|
|
|
|
Sure. Just use sizeof() in a standard (2**n - 1) calculation to get the most -ive and most +ive number that can be stored in an int . Imho, that's the real programmatic way of figuring this out.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Dear All,
Code project people has helped me a lot during my initial career by flooding me with useful solutions & valuable comments to my doubts. Thanks a lot for that.
I have another small question. I am developing an application in which I am running an executable (the job of this exe is to move some files from one location to the other, etc.). This exe is built using "Win32 Console application" provided in Visual C++ Version 6.0
When I run the application, it calls my exe, and this running exe shows its console window and performs its required operation successfully and close downs decently. BUT I DONOT WANT THAT CONSOLE WINDOW TO BE DISPLAYED DURING MY APPLICATION.
I cannot change the application since I don’t have the code for that, but I can easily do the same for my exe. So can any body please tell me how to hide the console window or console should not be displayed.
Regards,
Rohit Dhamija
|
|
|
|
|
In VB, it would be simple:
Shell "foobar.exe", vbHide
modified on Monday, August 30, 2010 6:46 AM
|
|
|
|