|
How do i use loops in MFC?
Whenever i use a for loop my MFC program freezes!
thanks
|
|
|
|
|
Could you post your code?
"But, daddy, that was back in the hippie ages..." My twelve year old son - winning the argument.
"Stan, you are an intelligent guy who responds in meaningful ways" Paul Watson 16/10/01
|
|
|
|
|
heres the code
do
{
if ((x % counter == 0) && (y % counter == 0))
{
x = x / counter;
y = y / counter;
}
counter -= 1;
}
while (counter > 0);
|
|
|
|
|
wait.
i figured it out
it was because i was using INT_MAX
how do i use INT_MAX in MFC without crashing or is there an other way?
|
|
|
|
|
What do you mean it's because of INT_MAX. Do you mean you're looping INT_MAX times??? That would explain it!
If you don't give your window the ability to process messages (such as mouse clicks) while the loop is running, it will freeze. Write yourself a little function like this:
void AMS_ProcessMessages()
{
for (MSG msg; ::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); )
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}
And call it inside your loop. That should, if nothing else, prevent your window from freezing.
Regards,
Alvaro
|
|
|
|
|
i used INT_MAX for my intial counter value.
int counter = INT_MAX;
and then decreasing the coutner by 1 each time the loop processes
|
|
|
|
|
You do realize that the loop is going to execute 2,415,919,103 times, right?
--Mike--
http://home.inreach.com/mdunn/
#include "witty_sig.h"
your with and
|
|
|
|
|
Alright, I'm new at programming in Windows API...My current two problems are the following. Any solution would be appreciated.
1: I have a text box in my program. In past programs such as DOS console-based programs, I could skip lines with the character '\n'. I tried it with this, it just displays a null character. How do I skip lines in a text box?
2: How do I make the background on a button a different color? I've gotten some advice to this but it wasn't very specific enough, this seems to be more complicated then it should be. Bill Gates is an ass. So how would I make the background on a button with handle, say, cmdStart, be, say, green?
Thanks for any help =)
Dave
|
|
|
|
|
1. What do you mean by "text box"? If it is an edit control, then make sure you have the "multiline" checkbox marked for the control (go to the resource editor, right click on the control and select "Properties"). If this is not what you're referring to please elaborate.
2. You're right changing the background of a color is unjustifiably hard. An excellent way to do it is explained in Yuri Goltsman's article Colored/Blinking Controls and Dialogs with any Font.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How do I skip lines in a text box
\r\n
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Bill Gates is an ass.
LOL, that's great!
That's why he invented VB, to cover his "assness" up a bit. I'm sure you know that changing a button's background in VB is a piece of cake. In MFC it's a mission. And it's not because of C++, it's because MFC is mostly a thin wrapper around the Win32 API.
I hope Joaquin has pointed you to the solution, but if not, take a look at the CWnd::OnCtlColor in MSDN. I believe that's the easiest way to make it work without having to derive your own button class.
Regards,
Alvaro
|
|
|
|
|
If I am making a dialog box application with multiple dialog boxes which are supposed to appear in a given sequence then do I create them all at the same time, and keep all but one hidden?
Or do I create the next dialog box to be shown inside the current dialog box?
In the former case, the current dialog box will call the next dialog box's display function..
And in the latter case, an new dialog box is created (say while closing the current dialog box)
Which approach do you think is better?
|
|
|
|
|
You should use a wizard interface. Your main dialog should be a CPropertySheet (in wizard mode) and the sequentially displayed dialogs should be CPropertyPages.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
problem is I have to show the associations with the help of UML diagrams. And I will have a head ache trying to display a dialog box as a property sheet in UML.
In my diagrams I imagine there to be a different object for each dialog box, and some sort of relation exists between them (depending on whether dialog box A creates or calls the dislpay function of dialog box B)
What do you think?
|
|
|
|
|
I'd like to be able to bring up MSDN's help from outside DevStudio (using VIM's 'K' command, in particular) to get help on a particular word. I see that I can direct hh.exe to go to a particular topic by specifying the URL on the command line (e.g. hh mk:@MSITStore:/path/filename.chm::/path\topicname.htm), but the topics for things like 'printf' can't be derived from their name (printf's topic is "mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN\2000APR\1033\vccore.chm::/html/_crt_printf.2c_.wprintf.htm").
Is anyone out there integrating MSDN help with 3rd party editors and tools?
Mark
|
|
|
|
|
Hi,
im using a CListCtrl (report view) with two columns in my app. the left column displays text and the right column should display color fields. i've read some tutorials about the CListCtrl. All i want to know is how i can add simple color fields in the right column. i dont want to add icons from a bitmap resource. how can i manage this????
thanks for your help!
bye b4ckup (:
|
|
|
|
|
I never did that, but if I need to do that, I must to try with GetItemRect, this function return to me the rect of each item, and I will try to paint each rectangle in the OnPaint event....
I hope to help.
me too!!!
Carlos Antollini.
|
|
|
|
|
Thanks for the answer!
I´m working on a ColorPicker. That means for every color that should be displayed in the right column, i must create an rectangle and fill it with the rgb data... argh is this idea working with the LV_ITEM structure? and how can i fill the rect ???
bye b4ckup (:
|
|
|
|
|
|
FYI, there are a bunch of nice color pickers available at http://codeproject.com/miscctrl/.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Ok, thanks a lot
bye b4ckup (:
|
|
|
|
|
Hi all,
How can i put Checkbox into one of CListCtrl (in Report mode) or Flex Grid rows ?
I need help !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Set the LVS_EX_CHECKBOXES extended style in CListCtrl or use 'item state images' for checkboxes (in fact LVS_EX_CHECKBOXES style is implemented with item state images). Note that LVS_EX_CHECKBOXES is not available on very old Win95 systems without IE 3.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Can you explain more ?
When i put LVS_EX_CHECKBOXES in extended style ... then how can i use of it ?
how can i control it ?
How can i put Ckeck in one of Checkboxes ?
or about positions, how can i set positions for it ?
Can you tell me, where can i download example about it ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I have written a static library with a CDialog divivative in it, and drawn a grid on the dialog, I then wanted to traverse my grid and needed to capture key presses e.g. UP '1' '2', I did this using entries in an accelerator table. I can now capture the key presses, but each key press makes a beep, is there any way to disable this beep?
also is there any way to stop the up,down,left and right keys from changing the currently focused button or component??
cheers!!
Andy
|
|
|
|