|
CoffeeAddict19 wrote: but it is still not rendering color for some reason.
Hopefully my modified post below will help
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
CoffeeAddict19 wrote: indicating that ScreenDC was null
Is Create() failing? Never mind, I see you fixed the ASSERT
I steered you wrong with the CreateCompatibleDC, sorry
*EDIT* I DID show you a way to do what you were already doing though :)
This should work from anywhere:
CWindowDC ScreenDC(0);
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&ScreenDC, 20, 20);
BITMAP bitmapstruct;
bitmap.GetObject(sizeof(BITMAP), &bitmapstruct);
You'll see in the BITMAP struct, the format matches the screen format.
Try this:
CreateResult = CWnd::Create(CPIEGRAPH_CLASSNAME, _T(""), dwStyle, rect, pParentWnd, nID);
CWindowDC ScreenDC(0);
TextDCResult = TextMemDC.CreateCompatibleDC(&ScreenDC);
PieDCResult = PieMemDC.CreateCompatibleDC(&ScreenDC);
SelectText = m_textBitmap.CreateCompatibleBitmap(&ScreenDC, 250, 20);
SelectPie = m_pieBitmap.CreateCompatibleBitmap(&ScreenDC, 300, 300);
Mark
-- modified at 14:54 Thursday 31st May, 2007
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
mmmm Pie! Cool!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi all:
I declared a variable of map type as below:
typedef vector<streampos> OccurrenceList;<br />
map<string, OccurrenceList> table;
I just do not know how to "insert" a new instance of map into this list.
Normally, I will use:
table.insert(make_pair(a_new_string, a_new_something); //a_new_something is only a variable of simpler type, like a int.
Can anyone help?
Thank you
|
|
|
|
|
typedef vector <<streampos>> OccurrenceList;
map <<string, occurrencelist="">> table;
|
|
|
|
|
<br />
typedef vector <<streampos>>OccurrenceList;<br />
map <<string, OccurrenceList>> table;<br />
new instance can be inserted into the map of simpler/complex type
if the necessary operators are implemented for that type.
<br />
OccurrenceList list;<br />
list.push_back(somedata);
table.insert(make_pair("a_new_string", list); <br />
this will work. note: map stores a new copy of "list"
|
|
|
|
|
|
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.
|
|
|
|