|
When disabled, the text in the CComboBox is hard to read. Can I make a CComboxBox readonly or change its text color? I tried OnCtlColor(), it works when the ComboBox is not disabled.
Thank you
|
|
|
|
|
Ownerdraw would be one solution...
"Two wrongs don't make a right, but three lefts do!" - Alex Barylski
|
|
|
|
|
You would have to create the control as Owner Draw. Call the base to perform drawing if not disabled, else draw it yourself in the colors you want. For reference, you may want to look up GrayString and see how windows does it.
onwards and upwards...
|
|
|
|
|
I've read a lot of basics on C++, now I want to make something happen more than a hello world program. I was hoping to find a step-by-step tutorial that would walk me through a more advanced program (a game or something) that has some substance to it (while explaining in detail what is going on). Is there such a tutorial?
Thanks much, Dave
|
|
|
|
|
The Scribble example (search MSDN, or check your MFC folders) would be a good place to start. It's got a little of everything in it.
|
|
|
|
|
|
In a CListCtrl class, I need to implement functions for the ClistCtrl list to handle keyboard Up and Down arrows. If the user presses on the Up arrow key, the selection goes one row up; if the user presses the Down arrow key, selection goes one row down. Can this be implemented?
Eilzabeth
|
|
|
|
|
Yes, it does that by default. Once the control has focus, using the arrow keys will navigate the control accordingly.
|
|
|
|
|
You are right. But I want more than just this. I am sorry that I did not state that I want to refresh the child record screen when a parent record is selected from the list by the Up/Down arrow key. There is no OnSelectionChanged function for a list control. How do I notified when the Up/Down arrow key is pressed?
Eilzabeth
|
|
|
|
|
Elizabeth Chang wrote:
There is no OnSelectionChanged function for a list control.
Sure there is. Check out the LVN_ITEMCHANGED notification message.
|
|
|
|
|
Thank you. This works perfectly.
Eilzabeth
|
|
|
|
|
Hello,
I know what I'm about to define is pretty vague.. but I don't have any idea where to even start....
I have a server application that sits on 3 machines.. Every 60 seconds I spawn 3 UI threads per server to communicate between the 3. The communication takes only a few seconds and then the socket closes and the UI thread exits..
Pretty simple nothing special.
Here’s the problem.. If I let the servers run for a day or two and I check the thread count inside the Task Manager it shows an extra 30+ threads... I have a function to keep track of the UI threads I spawn (when they start and exit and how many are currently running etc..). When the task manager reads 30+ threads my application shows that ALL OF THE UI THREADS are closed the count is at 0. I know it's not my UI threads getting hung. Where do I start to try and figure out where these 30+ extra threads are coming from??
I have a feeling that when the machine goes into power save/screen blanks out.. the problem starts.
I know people are going to say why spawn the threads, just keep them open but by design I have to do it this way and can't change this..
Any ideas would be greatly appreciated?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
In terms of number, what is the percentage of threads still exist in Task Manager relative to the total number of threads the programs have spawned?
Kuphryn
|
|
|
|
|
After a day or so the program would have spawned around 4300 threads total.. and the task manager shows 30+ threads when it should read 4 threads.
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Can you prove that the program effectively terminates all threads?
Kuphryn
|
|
|
|
|
Well, in the init of my thread I do a SendMessage to the main GUI stating that the thread has started. I do a ++ on the number of open threads, then in the threads ExitInstance I do another SendMessage again and in the main GUI I do a --.. to keep track of the # of currently open threads..
I am assuming that the threads do infact exit because this number is usually zero when I check it (unless a thread is open) but it drops back to zero with in seconds.
I guess this isn't 100% truly proving it assuming that the thread doesn't exit even though it runs the exitinstance.. Another thing is that I can't reproduce the problem on my development box it only happens on the production machines so I can't leave it run in Debug mode
Im using the WinSock2 API.. do you know if the sockets being created could spawn threads that are not exiting?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
What about switching to PostMessage? If the main gui doesn't respond, maybe the thread is getting locked.
Joel Lucsy
|
|
|
|
|
Run it in the debugger. Wait till the threads start building up and stop it and see what is going on with the threads.
John
|
|
|
|
|
I can't reproduce the problem on my development box.. it only happens (for what ever reason) on the production machines not running VC..
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Did you try release mode on your development box?
John
|
|
|
|
|
Yeah, both release and debug mode work perfectly on my development box..
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Ok. Can you run process viewer (a vc6 tool) to see if indeed your application has that many threads still running.
John
|
|
|
|
|
I moved process view pview.exe to one of the machines and I do see the extra threads on the process.. The weird thing is that when a thread is spawned I see the new thread as 100% privileged these hung threads show 0% don't know if that means anything.. In the pview I show
Thread 0 - 85% priv 15% user
Thread 1 - 33% priv 67% user
Thread 2 and up - 0% priv 0% user..
new threads that get spawned and dissapear show 100% priv 0% user..
Does this tell you anything?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
RobJones wrote:
new threads that get spawned and dissapear show 100% priv 0% user..
Does this tell you anything?
100% priveleged says that it is executing a system call. 0% priv 0% user probablu means that the thread is blocked possibly waiting for a mutex or a thread to end using one of the Win32 API Synchronization functions for example WaitForSingleObject()
John
|
|
|
|
|
RobJones wrote:
machine goes into power save
Simple test, tun off power save AND screen save, does it still happen?
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|