|
oh.. err... mm...
NO, that was Voldemort, my evil twin
|
|
|
|
|
Mark Salsbery wrote: double buffering "is for little girls"
|
|
|
|
|
well the loop is kinda controlled, but i came up with a way to fix it, i do the sleep(1); less often, every fourth time..
but now i have another problem, i created a second thread, and both main and the second thread generate exactly the same random numbers using rand()%1000, how can i get a more random random??
lol :P
/Johannes
|
|
|
|
|
You have to seed the random number generator with a random number. Use GetTickCounts or something like that. Otherwise, they always start out the same, so that you can actually 'test' the generator.
|
|
|
|
|
hu??? how?? wht? GetTickCounts?
:/
/Johannes
|
|
|
|
|
the common method is to seed the random number generator with the number of seconds elapsed since 1970 or something, can't remember exactly. Anyway use the time() function which returns this number and pass it directly into the srand() function.
srand( (unsigned)time( NULL ) );
|
|
|
|
|
Before using rand() in either thread, call this, straight from MSDN:
srand( (unsigned)time( NULL ) );
You should NOT be getting same random value sequences from each thread, then.
I just sometimes do this:
srand( LOWORD( GetTickCount() ) );
|
|
|
|
|
Just to make sure we are on the same wavelength here, you do know that all the sleep(1) call is doing is releasing CPU cycles to other processes. If you look at your app in the task manager it will still be hitting the 80-90% which is a bad thing really. You really shouldn't be using a loop for such a lengthy process.
Drawing a single scene of your animation takes a split second, you only need to draw that to the screen about 30 times a second ( less if the animation doesn't change often ). You should work out how often you need to draw a new scene and set a timer for that value. Handle the WM_TIMER to draw the scene but do not draw it to the screne. Instead, create a counter. So for example if you draw a scene 100 times a second, each time increase your counter, when the counter is 30/100 bitblt to the screen then reset the counter.
You may also find that using SetPixel() is incredibly slow. It may be a better idea to use a DIB and manipulate the pixels directly. Also to further increase your speed, create an offscreen bitmap to the same resolution as the screen.
|
|
|
|
|
How rename files and folders in a tree control?
Jus by editing labels in tree control....
-- modified at 10:45 Thursday 30th November, 2006
|
|
|
|
|
|
Haiku!
|
|
|
|
|
When you receive the TVN_ENDLABELEDIT notification, make a call to rename() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
HI ,
How can i scan all the windows which are opened ,i.e which are in the taskbar,
and how can i list those urls?
|
|
|
|
|
|
Pls refer to here- http://www.codeproject.com/staticctrl/LEDScreen.asp
How To Use
Using the class is very simple.
1. Create project.
2. Link library msimg32.lib to project.
3. Add LEDScreen source files to project.
4. Place on a dialog any bitmap image (picture static). This is optional.
5. Place on a dialog (owner bitmap if exists) CStatic. With ClassWizard, create variable m_screen for this CStatic.
6. In your dialog declaration, rename CStatic m_screen to CLEDScreen m_screen. Like this:
I am a Visual C++ 6.0 beginner user. I don't understand what is the 2th step:Link library msimg32.lib to project.
How to do exactly to link the library??
|
|
|
|
|
why don't you ask directly the article's message board[^] down the article ?
|
|
|
|
|
I afraid the article's writer will not read my question...that's why I choose to post here.
I will appreciate any help from you.
|
|
|
|
|
you have less chances that he can read your questionb here than in his article's board...
every question in an article's message baord sends automatically an email to the author of the article.
so please, ask your question over there. Thank you
|
|
|
|
|
This means that you need to link the library code with your code.
In order to do this open your project properties page. (Sorry, I don't remember how to do this in VC6) Once in this dialog open the link section and look for a field that says "additional dependencies". Add the name of the library there.
You may also need to add a path to the location of the lib. In VC6 this options is buried in the tools->options menu. Look for an option/tab that says directories.
Hope that helps.
btw - I believe this *IS* the correct forum to ask your question, as it is a general C++/link question and not something specific to the article.
|
|
|
|
|
Hi folks!
I have a MDI application with a CFormView and a CListCtrl (exactly the CListCtrlEx from (http://www.codeproject.com/listctrl/reusablelistcontrol.asp)) inside it. If I resize the window after initialisation, the CListCtrl keeps it's size/position. I tried near everything to size the CListCtrl to the Window size. Does anybody know a solution?
Thanks!
Regards
Patrick Breucking
modified 15-Apr-22 21:01pm.
|
|
|
|
|
Hi,
you have to hadle WM_SIZE (MFC's OnSize) message in your View, and manually resize the list.
Regards
|
|
|
|
|
If you do this, be sure to check the underlying HWND of at least one of the controls on the form before trying to size it. OnSize(...) may get called once or twice before the control is created, so you should use IsWindow(...) to make sure it has been created and its HWND is valid.
N.B - This might only apply to Dialogs, but I think FormViews have the same issue.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Patrick Breucking wrote: Does anybody know a solution?
Yes. See the Extras section of this article.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks for your answers. I tried and it works, but with some problems. If I make the window smaller, the scrollbars appears. but if i resize a column so much, that it is out of the window, the Scrollbars doesn't appear. It seem that the window only recognizes the initial size of the CListCtrl. I guess that I have to change another property, but I don't now the beast.
modified 15-Apr-22 21:01pm.
|
|
|
|
|
I have data in the form of structure.
I have to send data(structure) from server to client.
Can anybody answer to my query
Oye
|
|
|
|