|
Q1:
if(action&ODA_FOCUS)
{
CBrush brush(RGB(255,0,0));
pDC->FrameRect(&rectItem,&brush);
}
I wonder why I do this in DrawItem,when I ran the program and clicked the item which is not the first one,the first item's edge turned red too?
Q2:
What is difference between ODA_FOCUS and ODA_SELECT?
Q3:
As I click an item in a listbox,and then I click another control,does combination of (state & ODS_SELECTED)&& !(action&ODA_FOCUS) correspond to the item I clicked firstly?
|
|
|
|
|
Im working on a piece of code that stores objects and manages subscriptions to these objects, each object can have multiple subscriptions and each subscription can relate to multiple objects. Both objects and individual subscriptions are identified by an int ID
I have an STL map of MyObjects keyed by their integer id
std::map< int, MyObject > mObjects;
I have an STL map that maps an object id to a list of subscription id's that relate to that object
std::map< int, std::set< int > > mSubscriptions; subscription list by object id
I get passed a subscription id to remove. What I need to do is look at the mSubscriptions map and remove each occurance of the subscription id. Then if any object is left with zero subscription id's I need to remove it from the mSubscriptions map all together and remove the object from mObjects map.
I can do this with a few loops but I'm sure it could be done better by using std::remove_copy_if() to remove the subscription id from mSubscriptions and return a vector of the object id's that now have no assosiated subscriptions. I could then use that vector of object id's to remove them from mObjects
Can anyone give me a few pointers on how to code the predicate to pass to std::remove_copy_if() to achieve this?
What I'm having trouble with is the fact mSubscriptions::value_type is a pair< > and I want to copy the .second member into my vector
-- modified at 22:21 Sunday 25th March, 2007
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
While this might not be immediately helpful you might want to consider using Boost’s Multi-index[^] containers library for this kind of thing.
Steve
|
|
|
|
|
Stephen Hewitt wrote: While this might not be immediately helpful you might want to consider using Boost’s Multi-index[^] containers library for this kind of thing.
Thanks mate,
I like the boost stuff but only a subset of it is approved for use here.
I eventually found out that I should be using std::map::erase() not std::remove_copy_if() as remove_copy_if() and remove_if() dont support map becauase its value_type is a pair<> and the first element of the pair is always const which prevents these functions from being able to copy elements of the collection
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
As I understand it you’re looking up based on subscription id: that's the set mapped to below (underlined):
std::map< int, std::set< int > > mSubscriptions; subscription list by object id
If this is the case it's a little strange on the face of it. A map only gives logarithmic performance mapping in one direction: you seem to be mapping in the opposite direction. Perhaps this is intentional because the operation is infrequent? Or perhaps I'm misunderstanding the question?
Steve
|
|
|
|
|
Stephen Hewitt wrote: you seem to be mapping in the opposite direction.
yep
Stephen Hewitt wrote: Perhaps this is intentional because the operation is infrequent
The two requirments are that a client can get a reference to the object map (mObject) without seeing the subscription information and that inserts and updates to this and the subscription info are as fast as possible
The guy that wrote the original version has a very different structure that used a call to std::transform() to return a copy of the object map. This was hugely inefficient as each instance of MyObject was copied by value several times per call
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
Josh Gray wrote: I like the boost stuff but only a subset of it is approved for use here.
Out of curiosity what libraries are in that subset?
Steve
|
|
|
|
|
at the moment we have
boost::test
boost::regex
boost::tokenizer
boost::function (signal is banned, im told this is because it can be very slow)
boost::bind
boost::thread
boost::lexical_cast
This is the first place I've worked that has used it and I really like it. I dont know the details but there was a major stuff up once many moons ago that caused the powers that be to ban all use of third party libs without expicit approval.
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
I find the Boost.Iterator[^] and Boost.Smart Pointer[^] libraries particularly useful. In particular the Boost.Iterator library has saved me heaps of time and effort and made my code more readable (as well as more correct in some cases).
Steve
|
|
|
|
|
When I want to see whats up In A Visual Project I just do a Attach process > Break All ..I can then go to Threads to see what threads are running
I was wondering is there anyway to tell from the visual studio debugger what CPU the thread started..
Thankx
|
|
|
|
|
No.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The Visual project I was running worked fine when I had a single processor
When I switched to Dual Core it seemed to loop/spin
I down Loaded a free product from AMD called code analyzer trying to make some headway
Thankx
|
|
|
|
|
Are you including pragma OMP?
|
|
|
|
|
This is a project I down loaded from the web did some modifications
and was working great on a single CPU machine
Now when I build it with debug info on a dual core
machine it loops I am trying to figure out why
Any I will investigate this and thankx
for the info
|
|
|
|
|
Hello,
I have a question concerning services. I want to write a service, running from system start. This service should write to the windows registry HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce that will cause an application to start after the user logged on. This is because the application will exclusively run on the system and the system start will not carry on until the application is finished.
This application will do some password check. If the password is ok the application should close and the system start should go on else the user should be logged off.
Now the problems I'm facing.
The application-process could be killed and password check be by-passed that way. This is why I need the service to check whether the a) application has started, b) exited correctly (system start or user log off) or c) its process has been killed.
for a) can the application send a message to the service to tell the service that the application has started and that the service should start to watch over the application?
for c) if the application-process has been killed, can the service log off the user?
How can I protect the service from being killed? Maybe a cross-checking in the application if the service is alive? How would I do that?
Thank you very much for your help. If you need further details please ask. I'm happy about each and every comment. Code snippets are very welcome.
-- modified at 18:59 Sunday 25th March, 2007
|
|
|
|
|
|
@Programm3r
Great, I was looking for such documents. I will take a closer look at them and return here later on.
|
|
|
|
|
Since you seem to be interested in password / logon authenticatinon, you could also look at a custom GINA, depending on your comfort level with Windows security. MS documentation describes them.
Judy
|
|
|
|
|
@Judy
Thanks a lot for this suggestion, I will read more about this subject. It looks like I could use it.
|
|
|
|
|
|
I'm not sure what you're asking. Each menu item can call a common click event, or define it's own. What else do you need to know ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You don't have to keep track of how nested a menu item is, as long as you give each item a unique ID.
BTW it's "comes" not "cums"
|
|
|
|
|
Michael Dunn wrote: BTW it's "comes" not "cums"
Adding my two cents, don't use "cums" because it has a derogatory connotation! Also, it is better to say you have a "question about a menu item", and not a "doubt on a menu item".
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
[facetious]
Keep up the good work. Soon everyone in India and China will know perfect English as they should.
[/facetious]
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Now if only would get the Americans to use prefect English and we would all be set;)
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|