|
(That question must have been answered before, but I'm not certain what to google for, and it's not urgent.)
I have a pop-up menu on a CTreeCtrl filled with dynamic values :
while( SomethingIsTrue)
{
groupMenu.AppendMenu(MF_STRING, 0, someDynamicString );
}
I know I could use a range of predefined range of values, but It will make thing harder since I will need to create a temporary map of value-pair between the menu ID and the string (data) that is inserted in the menu.
The pop-up is called with TrackPopupMenu , even if I use the TPM_RETURNCMD flag, I still need to have a valid ID to know which menu item was selected ?
The question I have is :
Is it possible to get the string from the selected menu item ?
Thanks.
Max.
|
|
|
|
|
I have an application MyApp which spawns 2 process A and B. MyApp cannot communicate to either A or B. MyApp first starts the process A and It has to wait untill A has completed initilization and reaches a stable state which is approx 4 mins. MyApp should remain idle during this time period. After 4 min, MyApp starts process B and should wait for approx 2 min and shutdown.
What is the best method for suspending MyApp for the above said duration using very little system resources? I do not want to use Sleep() for this purpose.
|
|
|
|
|
I am unsure if this applys to you, but have you considered WaitForSingleObject()?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Use the Event?!
WaitForSingleObject(..., 4 minutes, ...).
Maxwell Chen
|
|
|
|
|
koumodaki wrote: I do not want to use Sleep()
Why not it suspends the thread using very little system resources and so meets your requirements?
|
|
|
|
|
Perhaps he's afraid that he'll forget to set the alarm and oversleep.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
If your app has a UI, and it stays visible during the waiting period,
then you could disable the main window for the duration. Set a one-shot
timer to wake it.
If there's no UI or you hide the app's UI while it's waiting then there's no
reason to Sleep() - it won't be doing anything. You still need a way to wake it though.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
is there a simple way to provide another process two simple int values?
Because a pipe between those 2 processes is a little bit to much work...
Is there a special area to create some variables in a "free access zone" ?
Big thanks ![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
CreateFileMapping() & MapViewOfFile() would be reasonably "simple".
|
|
|
|
|
Joergen Sigvardsson wrote: CreateFileMapping() & MapViewOfFile() would be reasonably "simple".
For two ints?
I'd just use WM_COPYDATA[^]
|
|
|
|
|
I thought about that one, but its inherent insecurity made me think otherwise before recommending it.
|
|
|
|
|
2 ints fit in a regular window message.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Assuming they have a message pump - not specified!
|
|
|
|
|
Just tossing another idea out there
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am creating some controls through wizard in a dialog, but i see some IDS are shared among different controls, how this behavior would affect an overall project.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
Mushq wrote: ...but i see some IDS are shared among different controls, how this behavior would affect an overall project.
If those controls are on the same dialog, it would fail to work.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
As long as notifications coming from them aren't being received in the same container window, there are no problems. If you get notifications from two different controls that share the same control id, it's not that easy to disambiguate.
Here's[^] a good tool for reorganizing your resource ids.
|
|
|
|
|
Thanx
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
Mushq wrote: "English is my second language; please excuse any grammatical or spelling mistakes"
Your grammar and spelling are actually quite correct, I have noticed. Most of the time
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Thank a lot. I have changed my signature now.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
|
|
|
|
|
Hi all,
How can one create a ofstream - open("test.txt",ios ??) object that can accomidate file share read and write?
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
An ofstream object implies "insertion," whereas an ifstream object implies "extraction." Use an fstream object, instead, where you can specify ios::in | ios::out .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
If I have Class B which is a multiple occurence of CLass A plus some added fuctionality
does it make sence to have the contructer of B declared
B :: B(CArray(A, &A))
{
Thankx
|
|
|
|
|
That clearly depends.
In the current case, your class b has a member variable of type CArray(A, &A) ?
Then it could very well make sense to have a c'tor like
B :: B( CArray(A, &A) Array)
: m_array( Array)
{
}
private:
CArray(A, &A) m_array;
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
I am not quite familiar with the last part of constructer prototype B : : (CArray(A &A) Array) : m_array(Array)
But I will look it up
Hope I am writting clearer
|
|
|
|