|
You can use a boolean. Along with a timer.
Use SetTimer to set a time for 30 seconds.
while(bContinue)
{
do your stuff here
}
In the timer handler, set bContinue to false and also KillTimer the timer
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
You must also make sure you are not doing some busywaiting.
Best regards,
Alexandru Savescu
|
|
|
|
|
The purpose if this derived combo box is to allow each option to occupy more than one line.
I have implimented DrawItem, MeasureItem, and PreCreateWindow functions.
I use AddString to add string to the drop down list.
Edit: I did not overwrite AddString
In my DrawItem function, I use GetLBText( nIndex, rString ). (And then use DrawText after inserting line breaks.)
rString wouldn't return the string I inserted earlier.
In fact, the string is at most 4 characters long, and characters aren't the ones that can be typed in from the keyboard. Most of time the characters are just bars similar to this "|".
I'm thinking that AddString and GetLBText are not good with user drawn control but I don't know exactly how.
Another relatively minor problem is that MeasureItem doesn't seem to be taking effect. It doesn't matter what height MeasureItem gives, I still get 1-line height.
All help is appreciated, thanks.
Edit:
Also, the reason I use AddString is because
1) I am expanding a program with this new class where CComboBox was previously used. If I write AddItem then I will have to go back and change every instance where AddString is used.
2) It's nice to have the same interface as CComboBox.
Another question, can I adjust the edit control part of the Combo Box on the fly? When I play around with it, I can get each option in the drop down list to occupy different height, but I haven't figure out how to adjust the size of the edit control.
Thanks.
|
|
|
|
|
Is the CBS_HASSTRINGS style set? (Has Strings in the resource editor)
--------
A closed mouth gathers no foot. --Shog9 --
|
|
|
|
|
No. I don't quite understand what CBS_HASSTRINGS do. I allocate the objects programmaticaclly, do I still need to worry about the resource editor?
I will try it tomorrow when I can. Thanks.
|
|
|
|
|
I am little new to GUI programming and especially CRichEditCtrl class.
How can i implement the below using CRichEditCtrlView:
For example in Wordpad if i open a new text document and uses some rich editing feautres then while saving the file it asks me "saving the file in text format looses formatting features."
How do i really detect whether user has used any rich editing feautres in a text document of CRichEditCtrlView
|
|
|
|
|
First of all I don't know those classes.
But I think you need to update a m_bRichEditFeatureUsed flag.
Set it to 1 when such feature is used; Set it to 0 after you save.
|
|
|
|
|
Use the m_bRTF boolean of the CRichEditDoc class. You can set it to TRUE or FALSE depending whether you want to save as RTF or plain text respectively.
Best regards,
Alexandru Savescu
|
|
|
|
|
I think what he's asking about is weather the user has actually used any RTF in the document, not how to choose which format to save in.
Unfortunately I can't think of any simple ansawer to that question
|
|
|
|
|
When I selected the menu "build-start debug-attach", there is no processes shown in the "attach process" dialog box.
Whp know the reason?
Thanks
|
|
|
|
|
Are you running under an account that has debug privs?
|
|
|
|
|
anyone knows how do i find if some of the resources(ico,bmp,dlg) in my project are not in use without going check one by one ???
Casa.Sapo.pt
|
|
|
|
|
Could you just do a global search of your project source code for the resource ids to see if you call them anywhere?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
yes
but the project is to big ,and go one by one to find those that are not in use is hell of a job
Casa.Sapo.pt
|
|
|
|
|
Choose Edit | Find in Files from the menu. THis will allow you to search a whole directory and it also allows you to specify the types of files to search.
I use the keyboard combination Alt + E, I. If the search is taking to long, then you can specify Alt + E, I again to stop it.
The results from the search will appear in your output window.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
yes, but try to imagine that you have a lot of resources created by outher programmers , and you whant to delete all of those that are not used, without do the search one by one
i think i have found one project do build on my free time
Casa.Sapo.pt
|
|
|
|
|
Max... Santos wrote:
i think i have found one project do build on my free time
When your finished, please post it on CP as an artical: I have exactly the same problem!
Dylan Kenneally
London, UK
|
|
|
|
|
From the View Menu you may choose Resourse Symbols or Resource Includes. It will try to tell you what resource ids are being used.
Best regards,
Alexandru Savescu
|
|
|
|
|
Hey Everyone
I was working on a Browser based ActiveX Control (MFC VC++ 6 SP5) for doing file transferring. I have an internal thread in the control that handles all the transferring and such. I would like to send messages back to the main dialog for display (logging). However, I'm unable to send a message from the thread that the Control catches. I can throw messages in the control and catch them.. I can throws messages in the thread and catch them in the thread, just unable to send a message from the thread to be caught by the control (COleControl class). I have done something similar in an App, but I used an AfxGetMainWnd()->PostMessage(...) when posting the message, since this is a control and there by being a dialog based app, How do I get the message back to the main control or main dialog class?
As a note, I used the "ON_REGISTERED_MESSAGE" macro to register a custom message mapping to a handler function. Is there any reason why this would cause a problem? It works in an .exe App.
Thanks for any help or suggestions
Rick Gavin
|
|
|
|
|
I am not quite sure that I follow your question, but I believe that you will want to look at the PostThreadMessage function.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I have tried PostThreadMessage with no luck.
I have an activex control, generated with the 'MFC ActiveX ControlWizard', which gives me an app class of type COleControlModule, the program is structerd as such.... The COleControl Creates the Dialog, which intern creates the Thread, which intern creates the Socket. The data from the socket needs to be displayed in the dialog.
COleControlModule (App)
- COleControl (Ctrl)
- - CDialog
- - - CWinThread
- - - - CAsyncSocket
How do I get a message from the CAsyncSocket derived class back to the COleControl or the CDialog? If this was an App and Not a Control, I could use AfxGetApp() or AfxGetMainWnd()->PostMessage(...) to get a handle back to the main thread. However, these reference doesn't seem to be working for me in a Control.
Thanks for any help.
|
|
|
|
|
When I add this to my stdafx.h:
#pragma once
#ifndef foo
#define foo
#pragma message( "************i should be seen once*****************" )
#elif
#pragma message( "************i should be seen a lot*****************" )
#end#pragma once
#ifndef foo
#define foo
#pragma message( "************i should be seen once*****************" )
#elif
#pragma message( "************i should be seen a lot*****************" )
#endif
if
all I see in the compiler is the first message? Shouldn't it print the top message once, then lots of copies of the second message?
What obvious mistake am I making /this/ time?
TIA,
Pete
|
|
|
|
|
sorry, that code should have read as follows:
#pragma once
#ifndef foo
#define foo
#pragma message( "************i should be seen once*****************" )
#elif
#pragma message( "************i should be seen a lot*****************" )
#endif
|
|
|
|
|
No, because stdafx.h is preprocessed only once. See the VC forum FAQ, I have a FAQ on how precompiled headers work.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
|
|
|
|
|
Good Eyes
I first looked at that question and I could not see why it would be failing, then I see your response and realized he was doing it in the precompiled header.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|