|
In my project, there is a Static text where I put a Timer on it.
And I want to set the color of this Static Text is TRANS_BACK.
But I don't know how to do.
Please help me.
Thanks.
King of Merit
|
|
|
|
|
Hi,
Can do it by adding the OnCtlColor. Have a look @ the msdn for OnCtlColor. They do provide a sample code too.
Sujan
|
|
|
|
|
|
Hi Friends,
I am working with a multithreaded application. The problem which i am facing is sometimes the application shutdown is not proper (seems that the application is in waiting state). I am using CriticalSection also for data sync. Is there any tool which shows the current thread status..etc.
Sujan
Note: i do have the process explorer from sysinternals.com. In the process viewer it is showing that the application is waiting on the ntdelayexecution thread.
|
|
|
|
|
Are you using WaitForX (Single Object, MultipleObjects) or MsgWaitForX (same thing) at all? More than one critical section, leading to a deadlock situation?.
Otherwise, your applciaiton wants to exit, but one or more of your threads are still blocked waiting for a mutex, event, etc. You should design your threads to wait for MORE than one object, typically the processing object, and an event object you can 'set' from the main thread when the program is about to exit. Then when progrma is about to exit, it signals event for thread(s) to exit, waits for thread(s) to exit, and then the main program's thread can exit.
How do you detect that a thread has exited? The thread can set an event the main thread is waiting on, the thread can clear/set a variable the main thread can check, or main thread can wait for thread handle to be signaled. see documentaiton for _beginthreadex
|
|
|
|
|
Hi,
Here is the scenario:
I have an app which uses CFileDialog to select a file.
All i am really doing with the file is getting the name, its path and extension.
I have an executable (call it myexec)in the directory my app is in, which must be run from that directory as it uses dlls which are there too.
I take the file name (full path) i select and build a command string like "myexec filename-with-full-path" and run it using the system() routine.
It works fine if i choose a file from the home directory of my app but if i chose one from another directory, it fails because it cannot find the executable "myexec".
I am presuming the changing of directories in the CFileDialog control has altered the working directory of my app and if this is so i do not know how to reset it without another call to CFileDialog and returnng to the home directory from within that.
I hope this is not too confusing...I tried to explain it as best as i could...confusing me a little too...
Thanks,
Sean
Firefly, Stargate, Farscape: in that order
|
|
|
|
|
I believe GetCurrentDirectory() & SetCurrentDirectory() are what you after.
How do I print my voice mail?
|
|
|
|
|
Thanks! I actually found using _getcwd() and _chdir() worked in the interim but i like your suggestion better - i hate all those "underscore" routines...they look "don't use these unless you have the chops"-like...
As to voice mail...I will investigate...
Thanks again
Sean
ps - I must say this forum has been most helpful and friendly - I am glad i found it
Firefly, Stargate, Farscape: in that order
|
|
|
|
|
Use the OFN_NOCHANGEDIR flag in the dwFlags parameter of the CFileDialog constructor.
CFileDialog Dlg(TRUE, NULL, NULL, OFN_NOCHANGEDIR);
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Perfect!
Sean
Firefly, Stargate, Farscape: in that order
|
|
|
|
|
I suggest using GetModuleFileName() to get the path to your main app, then doing string manipulation to create the right path. That way you know you've always got the right path.
[insert witty comment here]
bdiamond
|
|
|
|
|
Thanks!
That's what i was initially thinking of (along the lines of the "which" directive in UNIX) and it exactly what i need to know - where my app is...
I love this forum...and i will try to return the service for others with queries as soon as i stop worrying about my own app
Sean
Firefly , Stargate , Farscape - in that order
|
|
|
|
|
I want to use RichEditCtrl like RichEditView. RichEditView,Bitmap can be inserted and serialized(store and load). How to realize this function with RichEditCtrl? Please tell me , thank u.
|
|
|
|
|
Try looking at the wordpad samples. THis is *non* trivial if memory serves, as I think you have to deal with a bunch of COM stuff too.
Good luck!
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
thanks for your time
first feel sorry for posting this message
in this section,,
i working on pelcoD/P tuning,
mainly pan/tilt speed,
i don't use joysticks but keypad(every key interrupt 200ms),
shall i control pan/tilt unit at contant speed ?
or smoothly increased speed?
what do you think pan/tilt speed scheme best fit when i using keypad?
logarithm or exponential speed or just 2 step speed ?
what kind of scheme best used...?
i think i need your advice..
thanks again..
|
|
|
|
|
In a C++ Console Application, I'm looking for some sort of way to give the user a certain amount of time to input a command and if they do nothing in that time, go onto something else.
Essentially, the ideal flow would be something like:
if(SomeFunctionToSeeIfThereIsInputAvailable()) {
cin.getline(someCharArray, 200);
}
I've heard that something like that exists.
I've also heard of something like signals that will wait a while then call a function even while something else is going on or something.
I'm pretty sure my IDE doesn't have any capabilities like that or at least it is poorly documented.
Does anybody know of some library that has a way of doing something like that?
- Makutu
|
|
|
|
|
Hello, all
My project is dealing with DVB-T TV reception based on a piece of hardware. Basically, I am developing a dialog style console (VC++) to control all the signals, MPEG2 data stream etc. As to the functionalities, simply saying, it includes functions like play(), record(), monitoring().Now i want the monitoring() to be running all the time, updating and displaying parameters from hardware for examing purpose. And at the same time, i need to run play() and record(), but they are not accessing the same data. Just for a trial, i use an infinite loop to implement monitoring(), resulting the program hang and with no effect when i try to run play() or record() any more then terminated unexpected. So i just recall the concept of threads,but due to the limited knowledge on them, i even have no idea in this scenario, should i make all the function play(), record() and monitoring() as threads or just make monitoring() as a thread? And how to make it?
Greatly appreciate your help! Thx in advance.
|
|
|
|
|
1. I have a class based on CListCtrl, report style.
I want to prevent the header items from being resized.
So, I declared the OnBegintrack handler to the wrapping class. It does not get control.
Then only for a try I declared the OnBegintrack to the main frame (it's nonsense, I know), it does not get control.
I declared OnNotify to the wrapping class; it does get the control, but no matter what return code I pass, it does not prevent resizing.
What can be wrong?
2. Testwise I created a non-wrapped CListCtrl, like the above.
The parent of the CHeaderCtrl is the CListCtrl. It is not defined in AFXCMN.H.
How can I declare the OnBegintrack to the CListCtrl?
|
|
|
|
|
Vancouver wrote:
declared OnNotify to the wrapping class; it does get the control, but no matter what return code I pass, it does not prevent resizing.
If I remember correctly it's not the return code, but the value LRESULT* pResult is set to. I'm thinking setting this to zero should do the trick, but you'll probably have to play with this a bit.
Hopefully someone else will fill you in more appropriately...I myself am to lazy to fire up VC++ right now to figure it out!!!
Cheers
How do I print my voice mail?
|
|
|
|
|
If I remember correctly it's not the return code, but the value LRESULT* pResult is set to
Thanks, but that's not the issue. I tried with both the return code and pResult.
Btw, another pecularity: I declared an OnNotify for the CListCtrl wrapping class,
and another one for the main frame (the parent of the CListCtrl).
HDN_BEGINTRACK appears only at the OnNotify of the wrapper, and HDN_ITEMCLICK only at the main frame level. Both come from the CHeaderCtrl. What's going on?
|
|
|
|
|
BOOL CTSTListCtrl::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
switch (((NMHDR*)lParam)->code)
{
case HDN_BEGINTRACKW:
case HDN_BEGINTRACKA:
case HDN_DIVIDERDBLCLICKW:
case HDN_DIVIDERDBLCLICKA:
{
*pResult = TRUE; // disable tracking
return TRUE; // Processed message
}
}
return CListCtrl::OnNotify(wParam, lParam, pResult);
}
like in the above fucntion you have to handle all the four events and should not call the parent class's onnotify for the same events...
hope the above helps....
Gudluck
Adi
|
|
|
|
|
I found the error:
this swine of MFC Wizzard generated ON_NOTIFY_REFLECTs in the message map instead of ON_NOTIFY.
Apparently these (and, of course, the corresponding afx_msg's) have to be registered by hand.
Thanks anyway.
|
|
|
|
|
Could you please elaborate on this?
I have an owner-drawn list control, and I need to receive HDN_BEGINTRACK and HDN_ENDTRACK so I can draw the list control differently when the columns are being resized. I read the information on the few posts here on the forum, but I don't even get the OnNotify called into the list control, let alone anything resembling the HDN_ messages.
I do have a derived CHeaderConrol class attached to the header control, but it only overrides the DrawItem function. It does not intercept any messages.
I tried changing the _REFLECT messages to regular ON_NOTIFY, but I still did not get the notifications. Then I took all that out and let ClassWizard add the OnNotify to the list control class, but that did not get called at all either.
Thanks for any help or suggestions.
|
|
|
|
|
Hi,
first of all, if you want to process these messages on the level of the list control, then don't use message reflection, because the list control is the parent of the header control.
Second, the embedded CHeaderCtrl's control id is always zero, so the filter in On_Notify has to be zero as well.
Because the wizard would generate reflecting message mapping, which is wrong here,
you have to record the message handlers by hand between the end of the message map generated by the wizard
//}}AFX_MSG_MAP
and
END_MESSAGE_MAP()
like
ON_NOTIFY(HDN_BEGINTRACKA, 0, Your_Begintrack)
ON_NOTIFY(HDN_BEGINTRACKW, 0, Your_Begintrack)
ON_NOTIFY(HDN_ENDTRACKA, 0, Your_Endtrack)
ON_NOTIFY(HDN_ENDTRACKW, 0, Your_Endtrack)
Furthermore, you have to declare the functions following
//}}AFX_VIRTUAL
in the class definition of your list control:
afx_msg void Your_Begintrack(NMHEADER *nmheader, LRESULT *pResult);
afx_msg void Your_Endtrack(NMHEADER *nmheader, LRESULT *pResult);
(you are free to decide the names of the functions).
This should suffice.
|
|
|
|
|
Thank you very much for the updated information.
It works exactly as desired now.
The class derived from CListCtrl class now gets the begin track and end track messages from the embedded header control, exactly as I had hoped
|
|
|
|
|