|
Try GetMessage instead of PeekMessage
You shouldn't have to sleep or mess with thread priority for user interface thread
Mark
|
|
|
|
|
Mark Salsbery wrote: What do you mean by "fps"?
Well i am guessing he is writing a game/game engine. Applications also lose focus when they are minimized. That is why he probaly needs the application to stop processing.
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
Sorry his reply was not there when i posted mine
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
Well I think I fixed it. I basically used CaveFox's idea of a running boolean but in the main loop placed:
if (!g_bRunning)
Sleep(1000);
I believe this was happening because I allow the program to basically sit and spin in an infinite loop. Even if I commented out everything in the while(), the same thing happened. I guess the program just needed something to do.
Any idea why this is?
Thanks for your help guys.
Dustin
|
|
|
|
|
No SLEEP()!!!
while(GetMessage(&msg,NULL,0,0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
|
|
|
|
|
This should stop all processing (except the messages).
case WM_ACTIVATE:
{
if (LOWORD(wParam) == WA_ACTIVE)
{
g_bRunning = true;
}
else
{
g_bRunning = false;
}
}
break;
static bool m_bRunning = true;
while(TRUE)
{
do
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message == WM_QUIT)
break;
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
} while(!m_bRunning)
}
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
Really, I BEG you guys...pleeeease leave the poor UI thread alone
What did it ever do to you???
|
|
|
|
|
Yea it was a little overkill (by me ) ... im sleep deprived and are not thinking strait. Should have solved it with the first post
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
It looked right to me - I had to test it before I saw it!
As soon as Sleep() comes up, it's time for an intervention
|
|
|
|
|
I have an ocx control where I popup a modeless dialog .Inside the dialog I created a CframeWnd where I created a CToolBar. My problem is I could not get the toolbar button to update.I use ON_UPDATE_COMMAND_UI for each button inside the Cframe class. Any help! I can also send a small ocx project to see the problem to anyone how offer help.
|
|
|
|
|
|
thanks nave for your hint but I saw that article before and it did not solve the problem in my case because onIdle never get called. As I said before if any has an idea but updating toolbar button for ocx controls I can send a small project that show the update problem.
I ma awaiting any other hints that may help!
thanks
zak
|
|
|
|
|
ok send me the project..I will try.
id - nave432@yahoo.com
nave
|
|
|
|
|
Sorry nave for this late response due to the end of year vacations.
I just want to let you know that I did send u the project today!
I'll be awaiting your response
Thank's again
Chiheb
|
|
|
|
|
Hi, I don't know if this is the place to post this question, but I assume that people reading this will have enough experience to answer it: is there any way to sniff a tcp loopback connection in windows? The CommView trial is the only one that I've found that works partially, because it doesn't show the FIN messages...
I would really appreciate any hint about this.
Thanks in advance,
Federico
|
|
|
|
|
google found this[^]
Hope it helps
Artificial Intelligence is no match for Natural Stupidity
No one can understand the truth until he drinks of coffee's frothy goodness. ~Sheik Abd-al-Kadir
I can't always be wrong ... or can I?
|
|
|
|
|
Hi,
Assume an small SDI application build using VC++ 8.0 on Vista OS.
If I try to run the exe of this application on another machine without VC++ 8.0 installed in it( assume that it has VC++ 7.0), then it will not launch and display an message box showing that the dll MFC80D.DLL could not be found in location bla.. bla... (3 to 4 paths).
When i try to start the exe, is it possible for me to prompt to the user (using a message box) that the application connot run in this system (as it doesnot have VC++ 8.0 in it.
Put it in simple words, I dont want my application to crash when I start it on another machine without the required dll's.
|
|
|
|
|
You can statically link to MFC and the C runtime so your app doesn't need DLLs.
If your app requires DLLs then they need to be properly installed:
Redistributing Visual C++ Files [^]
wrote: When i try to start the exe, is it possible for me to prompt to the user (using a message box) that the application connot run in this system (as it doesnot have VC++ 8.0 in it.
I don't think so
|
|
|
|
|
wrote: Put it in simple words, I dont want my application to crash when I start it on another machine without the required dll's.
You would likey have to create a (statically-linked) launcher or kickstart application that searches for all required files and if all are found, then launches the real application.
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!)
|
|
|
|
|
Hello,
I would like to get filenames with neither pathname nor extension on a multiselection files from a CFileDialog. I used GetFileTitle but it gets a NULL String with flag OFN_ALLOWMULTISELECT.
Here is my sample code
if (FileDlg.DoModal ()==IDOK)
{
CStringList csFullpathname, csOnlyName;
POSITION pos = FileDlg.GetStartPosition();
while (pos)
{
//This works and get the full path name
csFullPathname.AddTail(FileDlg.GetNextPathName(pos));
//I get a NULL string
csOnlyName.AddTail(FileDlg.GetFileTitle());
}
}
}
Is there a straightforward solution or Must I parse the full pathname to extract only the file name?
Thnks for your help.
|
|
|
|
|
|
According to the docs, GetFileTitle() doesn't work on multiple selections.
Does this work?
#include <shlwapi.h>
...
if (FileDlg.DoModal ()==IDOK)
{
CStringList csFullpathname, csOnlyName;
POSITION pos = FileDlg.GetStartPosition();
while (pos)
{
CString PathnameStr = FileDlg.GetNextPathName(pos)
csFullPathname.AddTail(PathnameStr);
TCHAR buf[MAX_PATH];
_tcscpy(buf, PathnameStr);
*::PathFindExtension(buf) = _T('\0');
csOnlyName.AddTail(::PathFindFileName(buf));
}
}
|
|
|
|
|
Your answer is full
|
|
|
|
|
It's great!!!!
|
|
|
|
|
Specify your own buffer to the lpstrFile member of the OPENFILENAME structure and examine it when the dialog is [OK]ed.
You may have to derive your own class from CFileDialog to do this.
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!)
|
|
|
|