|
DS_SYSMODAL is not used any more, it is no longer possible to have system modal dialogs.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
hi
how would i go about creating a directshow filter that would disolve between 2 video sources when activated
(fade out first video while fading in second)
kenny
|
|
|
|
|
Here is my code:
BOOL CDemoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE); SetIcon(m_hIcon, FALSE);
CRect rect;
GetClientRect(rect);
CWnd wnd;
BOOL bRet = wnd.CreateControl(_T("WMPlayer.OCX"), NULL, WS_VISIBLE, rect, this, 19089);
return TRUE; }
I run the code wich VC++ 6.0, everything is OK. But when run the same code under Visual C++ 2010, the handle of
wnd (namely
m_hWnd ) is always NULL. Besides, the return value bRet is TRUE(namely success).
I'm confused. Anyone can help me?
|
|
|
|
|
CWnd wnd;
BOOL bRet = wnd.CreateControl(_T("WMPlayer.OCX"), NULL, WS_VISIBLE, rect, this, 19089);
return TRUE;
As soon as you return from this function wnd goes out of scope and is destroyed.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
As you see, this is just a Demo.
I run the code one by one line in Debug mode.
So, I can watch the instant value.
|
|
|
|
|
The wnd object has never had a window attached to it, so why would you expect it to have a valid handle?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Then, it's a valid value in VC++ 6.0. I'm confused!
|
|
|
|
|
VC 6.0 is out of date and, as far as I am aware, no longer supported.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
How about VC 6.0? Does it give a valid handle (A NOT NULL Handle).
|
|
|
|
|
|
Delete(Take a backup if you want) the .tli and .tlh from the debug folder and rebuild the project. Make sure the delete files are created again.
Then check the CreateControl function. Use the GetLastError() to examine what went wrong.
|
|
|
|
|
Thanks for your reply. CreateControl succeeded with a return value:
TRUE ;
What my question is: why the handle of
wnd is still
NULL .
|
|
|
|
|
Falconapollo wrote: I run the code wich VC++ 6.0, everything is OK. But when run the same code under Visual C++ 2010, the handle of
wnd (namely
m_hWnd ) is always NULL. Maybe something was fixed in subsequent versions of VS.
Have you tried making wnd a global variable or class member?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hello. I have a pointer which I want to assign to one of my member variables of class. Both the pointer and the object are of same type. How do I assign this pointer to this object. Here is what I mean
class ABC
{
ClassName obj1;
void AssignValue(ClassName* ptrValue)
{
obj1 = ptrValue;
}
};
But I am getting this error saying No operator "=" matches the operands. What do I do? Thanks for any input.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
obj1 is an object, not a pointer. You need to change your definition to:
ClassName* obj1;
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
This is what I was talking about. Is there no way ( like: I could cast it somehow ) to assign this pointer to the object? I don't wan to change it.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
AmbiguousName wrote: I don't wan to change it. You have no choice; an object is not a pointer and cannot be cast as such. You also have the problem that obj1 will already have been instantiated in the constructor when your object is first created.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Well, you can cast a pointer to an object - in the same way that you can eat poisonous mushrooms: only once. (provided you manage to get past the compiler that is trying to save you from that embarassement)
|
|
|
|
|
Well, yes you can do anything you like ...
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Please check this.
void AssignValue(ClassName* ptrValue)
{
ClassName& localObject = *ptrValue;
obj1 = localObject;
}
|
|
|
|
|
Yes, I was about to suggest this, but there is an error in this code: you cannot define a reference that is not const - it has to be
const ClassName& localObject = *ptrValue;
[edit]forget what I wrote next...
Instead of your suggestion, you could just do the assignment directly:
obj = *ptrValue;
Assuming that you have a valid implementation of the assignment operator, this should work.
[/edit]
modified 25-Oct-12 7:41am.
|
|
|
|
|
According to the compiler this will not work because obj1 is not a modifiable lvalue; it is an existing object, and cannot be set to something else.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
That is not my understanding, unless you are using a compiler where ClassName has a very specific predefined meaning. I was assuming that was just meant as a synonym for the actual class rather than a keyword. E. g. this should work:
class foo {
int val;
public:
foo(int v) : val(v) {}
int get() const { return val;}
};
class ABC {
foo obj1;
public:
void AssignValue(foo* ptr) {
obj1 = *ptr;
}
};
At least my compiler accepts it.
|
|
|
|
|
You are correct; I had to add default constructors (MS C++), but it then did what was required.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Yes, but this changes obj1 , which may or may not be what the original question didn't want (if the object is expensive to copy, making it a pointer rather than object, as previously suggested, might be the better solution).
If AmbiguousName has worked more with C# or Java, where the references are implicit, working with pointers might be confusing.
|
|
|
|