|
You need to put the code for the "simulations in a loop" in another thread. That way, the GUI's message pump does not get bogged down and become unresponsive. See here for more.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
multi-threading is the most elegant way to handle this. but, there's always the bad-old Message Pump:
void MsgPump()
{
DWORD dwLen = 100;
MSG m_msgCur;
CWinApp *pWinApp = AfxGetApp();
DWORD dInitTime = GetTickCount();
while (::PeekMessage(&m_msgCur, NULL, NULL, NULL, PM_NOREMOVE) &&
(GetTickCount() - dInitTime < dwLen) )
{
pWinApp->PumpMessage();
}
}
call this somewhere in your loop. it's not necessary to call it every iteration, but just a few times each second will be enough to keep the UI alive.
of course, now you need to be able to handle things the user will do things with your buttons, menus, etc., while your loop is running. (i usually just disable all controls and watch out for WM_CLOSE and WM_QUIT).
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
|
I need to implement source control on a Windows project ASAP. I've been fighting VSS on and off again. Well, the other day, I dusted it off and went thundering into adding files, etc.... and I lost my network connection in the middle of this processing. Now, two of my projects are corrupt with:
file names.dat may be corrupt
and
Error reading from file
Using the analyze utility, it reports that there are no problems to fix, yet these errors remain. So, I'm about to just delete these projects and start again. However, my network bounces around considerably. I cannot afford my code repository being corrupted every time a command or operation is interrupted (has MS never heard of rollback?). Am I just being paranoid? Is this product actually stable enough? I'll give you another example - VSS still uses 8.3 names? Give me a break...
Charlie
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
scrap VSS and use a better SSC, either CVS or SubVersion; I found that both of those products, while not beeing complety integrated in Visual Studio, are way better.
Source Code is the most important things that you ( and/or your company ) own; you should paranoid !!!
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
You won't have an argument from me - the source code and the ability to build products is the crown jewel of any software organization. I know there are other products out there. My situation is a bit more complicated in that I am an independent consultant within an organization that is mainly mechanical products - software is a tolerated evil. It is getting better, but they are still very new to the software world. In any event, I don't have the luxury of just picking anything I want to use (not yet anyway).
So, setting aside that there are better products out there, is VSS really this sensitive?
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
CharlieG wrote:
is VSS really this sensitive?
Yep[^] (<edit: <a="" href="http://www.highprogrammer.com/alan/windev/sourcesafe.html" rel="nofollow">this[^] is the link i was originally looking for).
Here's a quote I once heard from someone who works at Microsoft:
"Visual SourceSafe? It would be safer to print out all your code,
run it through a shredder, and set it on fire."
I use Perforce which is excellent and free for up to two users. Otherwise, Subversion (which is the next incarnation of CVS and apparently fixes a number of serious issues) sounds good.
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.1.2 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
VSS is a terrible thing to use if you might lose your connection.
If you *need* it, then consider adding a remoting plug-in -- SourceOffSite. Uses the SourceSafe database, yet it's remote-safe.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
CharlieG wrote:
I cannot afford my code repository being corrupted every time a command or operation is interrupted
Could you use a local repository, and simply copy the whole thing up to the network once you've done with it? If the network connection fails during the copy, just copy it again. Of course, this is a *really* bad idea if you aren't the only one using the repository.
CharlieG wrote:
Is this product actually stable enough?
Yes, if you have a reliable network. We've used it for 10 years, and had one (minor) corruption. Didn't use the repair facility, just the usual server backups, so I can't comment on the effectiveness of the Analyze utility.
CharlieG wrote:
VSS still uses 8.3 names? Give me a break...
Well:
1) It's an internal, proprietary database. Why do you care how it's stored? 8.3 is good, not bad. It means you can put your VSS database on a file server that doesn't support long filenames (should you have to).
2) Take a look in the SYSTEM32 directory of your XP machine, and list all the Windows system files that are not in 8.3 format. It won't take long...
|
|
|
|
|
Working backwards:
8.3 names - fair enough.
Internal proprietary database - you might be reaching here . As important as source control is,
I would expect something like failsafe recovery and 2-phase commit.
Reliable network - depends on the phase of the moon - seriously, I have received emails announcing a server reboot in 1 minute.
If you are unfortunate enough to walk away from your computer when the email comes in, oh well.... oopsie.
My concern is that it didn't take much for VSS to go south. Maybe I *am* overreacting... but, I just don't have enough
mileage on VSS to make a qualified judgement. MS did it's own FUD on VSS for me.
Local repository - if it was just me, I would do this in a heartbeat, but I have a few others that access the source code.
Reasonable idea though.
regards,
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
Now maybe I depart from reality or enter the zone of wishful thinking.
I just read about Perforce - appears that I need a server. The less infrastructure the better.
I will admit that I like my repository as a file based system - it's simpler. Perhaps I'm
asking for mutually exclusive features.
Subversion: interesting, but still requires a server.
Am I stuck with having to go as a server? Can I run Perforce as a local application?
C. Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
|
|
|
|
|
hi,
can anyone tell how to display images in the browser with the help of CHttpServer and CHtmlStream classes when i use them in an ISAPI extension dll. i have the name of the image file and i want to display the image in the same browser window.(i.e. when i click the get button)
thanks
aditya
|
|
|
|
|
Hi, I am writing a program where I need to keep a dozen modeless dialogs in a specific z-order (Dlg1 is always behind Dlg2, which is always behind 3, etc..) This concept is similar to layers in powerpoint or photoshop except I want to do it with dialog windows.
First I set up an int array which indexed the order I wanted (so 3,2,4,1 would be Dlg3 behind Dlg2...) Then I set up on all the dialogs:
SetWindowPos(prevWnd, x,y,0,0 SWP_NOSIZE|SWP_NOACTIVATE);
where prevWnd is found by looking up the id in the array.
However, this does not work as when I click on a dialog, it always activates the dialog I clicked on and move its z-order in unexpected ways. (So I don't even know what SWP_NOACTIVATE does exactly.)
I tried using the SWP_NOZORDER style within the Dialog class but then the dialog is always brought to the foreground if I click on it.
How would I write a z-order manager that will always "lock" my dialog windows in a specific z-order?
Also a very simple question, what does the pWndInsertAfter in the SetWindowPos mean exactly? Is the pwia in FRONT or in BACK of the target window? because it always seem to change in my program. Thanks!
|
|
|
|
|
pWndInsertAfter tells windows what z-order position a windows should have. I'm sure you know programs where you can select that the main window should stay in the foreground. That's ment by pWndInsertAfter.
Don't try it, just do it!
|
|
|
|
|
Hello,
I have a program that sends keys (words to be exact) to Excel or Notepad. I'm currently using SendInput() which works fine except on some computers. For example two identical machines running XP with Office 2003 could result in one working with my program and the other not. So this is a mystery to me. One problem is that my program loses focus (or rather sets the focus to the target application) yet in Microsoft's On-Screen Keyboard application which also sends keys to a target program the program never has the focus. Does anyone know how this can be achieved? Also has anyone had any similar experiences with SendInput() or sending keys to another program?
Any help/advice in this matter is greatly appreciated.
Thank you,
Al
|
|
|
|
|
Use SendMessage(..., WM_CHAR...) instead as it is not affected by the target window losing focus.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Thank you David, I'll give it a shot. But I'm still mystified as to how Microsoft manages not to get the focus on their On-Screen Keyboard application. I wonder if they're using SendMessage(..., WM_CHAR...) as well.
Al
|
|
|
|
|
al_in_the_city wrote:
I wonder if they're using SendMessage(..., WM_CHAR...) as well.
Use Spy++ to find out.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I think the keyboard sends untranslated messages...
Don't try it, just do it!
|
|
|
|
|
|
Without using Doc/View facilities, I want that before printing i can preview first on the screen my printing.
What to do ?
I am using Visual C++ 6.0
I learn my self
|
|
|
|
|
How can I send my printing to outlook for sending it to someone by e-mail.
Thanks
I learn My self
|
|
|
|
|
See here for examples of CDO, MAPI, and SMTP.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I can I send my printing to outlook for sending it to someone by e-mail.
Thanks
I learn My self
|
|
|
|
|
???
Don't try it, just do it!
|
|
|
|