|
|
I have a media player from microsoft playing a file.
When the player plays the file a graph is produced.
What additiionally I wanted was to get some code to connect to the microsoft media players
graph and a add some filter and configure the filters.
BEST REGARDS
|
|
|
|
|
I don't have a solution for you but I bet if/how it can be done can be found in the Windows
Media Player SDK which can be found here[^].
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have a media player from microsoft playing a file.
When the player plays the file a graph is produced.
What additiionally I wanted was to get some code to connect to the microsoft media players
graph and a add some filter and configure the filters.
BEST REGARDS
|
|
|
|
|
Hi All,
Does the Windows API provide a function which allows one to monitor a chunk of memory for modifications (similar to watching a directory for changes using FindFirstChangeNotification())?
Jeff
microsoft.public.vc.mfc received one response with, 'What are you trying to do'? Monitor Memory for Alteration[^]
microsoft.public.win32.programmer.kernel received no responses. Monitor Memory for Alterations[^]
|
|
|
|
|
You can do this with the VS Debugger, i.e. set a memory breakpoint but only one and only monitoring 4 bytes. That's because it uses an internal feature of Intel architecture compatible processors to achieve this at a very low level. I guess it's probably an interrupt or something. I don't know of any other way if you want to be certain of catching changes as they happen.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi Matthew,
Matthew Faithfull wrote: You can do this with the VS Debugger
My bad - I want to do it from a Userland program - no debugger required.
BTW, I did try and think how we could do it by acting as if we were a debugger - but I don't think vanilla userland programs (i.e., not running under privlidged accounts) will allow it.
Jeff
|
|
|
|
|
I'm not sure about Vista but on previous Windows versions at least the VS Debugger is pretty much a vanilla userland program.
If I remember rightly the code to set up a memory watch style breakpoint is in John Robbins book 'Debugging Applications' which is a great book, worth a read anyway if you haven't already. I can't be sure the technique would work from 'ordinary' code but it may and if a switch to Kernel mode is required I'm sure Robbins explains how to do it. I think the book code is downloadable if you give it search
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi Matthew,
Matthew Faithfull wrote: I think the book code is downloadable
I have the book in my collection - John and I bounce emails every now and again. As busy as he is, he will respond to questions.
Anyway, I reworked the section and added some other information on 'what does not work'. In addition, I cited you (I hope you don't mind). See the section entitled, 'Polling Versus Notification'.
Jeff
|
|
|
|
|
Hi I'm looking to change the format of my internal classes to clean up my code but I can't get the syntax right.
I have
class A
{
class B
{
}
B b;
};
I would like to change it to something where class B is defined outside. ie.
class A;
class A::B
{
};
class A
{
B b;
};
The above code doesn't seem to compile. Anyone know how to do this?
|
|
|
|
|
Do you mean like this?
class B
{
};
class A
{
B b;
};
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Kindof, except I want B to be an internal class of A. In your sample B is it's own separate class. (going to quickly edit my original post)
|
|
|
|
|
Your first version looked right. I guess I'm not sure what you meant by "I would like to change
it to something where class B is defined outside"
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
yeah it was right... I just had to recheck it (I thought I had a typo but I didn't).
what I mean is I want class B to still be an internal class of class A. Yet I would like the definition for it to be outside class A (ie. in a different file).
That is to say, I don't want class B to be defined between the curly brackets of class A.
|
|
|
|
|
R Thompson wrote: yeah it was right... I just had to recheck it (I thought I had a typo but I didn't).
Just a missing semicolon.
R Thompson wrote: That is to say, I don't want class B to be defined between the curly brackets of class A.
It has to be there if that's the scope you want it to have. Scope is the only effect nesting a
class has on the class.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
May I suggest something like this:
class BInternal<br />
{<br />
};
class A<br />
{<br />
class B : public BInternal<br />
{<br />
};<br />
};
If you hide the definition of BInternal then from an external perspective this is the same as what you want I think.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Actually, I Think I understand what you mean. In C you would declare A as an element of B. CPP is Object Oriented, that means that the lingo changed, from Sub Structure to Inheritance. To achieve the same effect, you derrive class B from class A. This Typically means that you can downcast a pointer to class B as a Pointer to class A. It has it's benefits though, In general a Downcast is not required, and the Syntax is a lot less involved.
LateNightsInNewry
|
|
|
|
|
I'm probably one of the few last remaining hungarian notation users around but if anyone out there still writes code using hungarian notation, would you happen to have a link for the latest recommended forms that would include 64-bit pointer precision types like LONG_PTR.
Or,
if anyone has any ideas on how to name
LONG_PTR
INT_PTR
that would be consistent with past practices. I'm at a loss on how to do it (nicely) without confusing myself later on.
|
|
|
|
|
I'm a closet 'hugarian' as well although I never did use f... for bools. My latest practice is to use names like INT64 or LONG32 where the sizes are genuinely fixed and won't change depending on the platform where this code is compiled and ULONG_PTR and the like for types that are sized according to the word size of (bitage as I prefer) of the system. Of course if you're defining these types yourself and intending others to use them then you probably shouldn't polute the default namespace with such generic names anyway so in my latest project I use mxUINT32, mxINT64, mxUINT_PTR, mxULONG_PTR. I don't have mxLONG_PTR defined because as far as I'm concerned pointers are never signed but that's probably a matter of taste. I use this style of names for anything #define(ed) or typedef(ed) from fundamental types either directly or via windows headers.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
thanks for the response.
interesting technique. The "m" might catch me offguard from time to time if just glancing or skimming code as if it were a member variable.
Matthew Faithfull wrote: I'm a closet 'hugarian' as well
we are indeed an endangered species.
|
|
|
|
|
The problem with LONG_PTR is that I see many people using it when there is no need to - the variable will never contain a pointer to anything. If you're dealing with fixed-size variables, you should mark them as i32 or i64 . If you really need LONG_PTR , then use lp .
|
|
|
|
|
Thanks for the guidance.
CArray::GetSize() returns INT_PTR in MFC 7.1
This unfortunately is not a pointer so using "lp" can be confusing here since anytime I see "lp", an arrow operator is always dancing in my head.
With GetWindowLongPtr(), it returns LONG_PTR and can on occasion, such as when using GWLP_USERDATA possibly represent a pointer if the user squirreled one away in there for use in a static callback method.
I'm finding it more common anymore to come across things that use it for items of size and occasionally for pointers so I'm not sure a naming convention that mixes with a plain old pointer convention wouldn't confuse others and myself later on.
I've been toying with "np" but it just doesn't flow.
|
|
|
|
|
Just to be clear. The purpose of types like LONG_PTR is to store non pointer data that will always be the same size as a pointer so that for example reinterpret_cast<LONG_PTR>(CMyObject*) will work without changing it on both 32bit systems where sizeof(CMyobject*)==4 and on 64bit platforms where sizeof(CMyobject*)==8 . In other words it's a long that's the same size as a pointer.
This is different from the lpName convention which goes right back to the old days of memory models and far-pointers and near-pointers / long-pointers. Please don't ask me to explain it, it was before my time but you can see that np would definitely not be a good idea especially when there's oldies around. So when the API says lpData it means a full size pointer on the current system i.e. 32 bits or 64 bits and when it says LONG_PTR it means a 32 bit or 64 bit numeric that is always the same size as a pointer. void* lpData and LONG_PTR PtrData will always be the same size so conversions will maintain all the data. I hope that's cleared it up
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Why my code:
<br />
pStorage->CreateStream( lpszW, STGM_DIRECT|STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE|STGM_FAILIFTHERE, 0, 0, &pStream) <br />
returns error STG_E_INVALIDNAME (Invalid value for pwcsName) [pwcsName => lpszW]?
I use this befor calling CreateStream:
<br />
LPWSTR lpszW = new WCHAR[255];<br />
LPTSTR lpStr = strFilePath.GetBuffer( strFilePath.GetLength() );<br />
int nLen = MultiByteToWideChar(CP_ACP, 0,lpStr, -1, NULL, NULL);<br />
MultiByteToWideChar(CP_ACP, 0, lpStr, -1, lpszW, nLen);<br />
where strFilePath is e.g. "Slika000.jpg"??
I use this for storage a file.
THX to all
|
|
|
|
|
In this case, you know the size of your WCHAR buffer so you don't need to check the result string
length. An alternative is to actually use the destination length.
Also the much-overused GetBuffer() is not necessary when you need a const TCHAR pointer to a
string
int nLen = MultiByteToWideChar(CP_ACP, 0, strFilePath, -1, NULL, 0);<br />
LPWSTR lpszW = new WCHAR[nLen];<br />
MultiByteToWideChar(CP_ACP, 0, strFilePath, -1, lpszW, nLen);
Regardless, that doesn't explain what's wrong with the string - what's in lpszW after the second
MultiByteToWideChar() call?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|