|
I have a UI thread that works but I'm trying to figure out how to reliably stop the thread. The OnIdle function in the thread periodically calls WaitForSingleObject on a particular event, if it's set, it calls PostQuitMessage that we are quitting and then returns 0 to signal it doesn't need to run anymore. Half of the time this thread and the main one deadlock, sometimes I get some CResourceException and I don't trust it to stop the thread cleanly. I've read plenty on how to terminate the thread but it feels like it's not enough and doesn't always work. Does anyone have any pointers or a good way to stop the thread cleanly from outside of the thread?
|
|
|
|
|
Hi,
I use a function from a library and it is declared as a __stdcall(WINAPI) in the header file. When I use this function in my executable I get a linker error (unresolved symbol _FunctionName). The project links correctly only if I change the calling convention for the project from __cdecl to __stdcall.
Does anyone know why is this so? The header properly defines it as an __stdcall, why then do I have to change the project settings? Or am I missing something and doing something wrong?
Thanks in advance.
|
|
|
|
|
|
Actually, the third party library itself is entirely compiled with __stdcall convention and therefore the header file does not have a __stdcall for the declarations.
Now, if I am to use this library in my project, how can I re-declare the function prototypes specifying __stdcall for each of the functions. Or is there any other workaround rather than changing my project settings to __stdcall.
Thanks in advance.
/f
|
|
|
|
|
How will I be able to create a Installer of my Application. There might be some applications out there about creating your own installer but how about creating your own. Do you guys have any idea on how to create your do-it-yourself installer and be able to create shortcut icons (desktop, start menu) for your application? Just wondering if it is possible. thanx
|
|
|
|
|
It's obviously possible, any installer app does just that within a framework. I use an installer package though, there are plenty of free ones to do msi installs ( I ended up buying the full version of mine tho ) The one I use is called advanced installer.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I've tried advanced installer and found it cool, then the idea of creating my own installer interface came up.
|
|
|
|
|
There's almost never a good reason to be reinventing the wheel
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Just hoping if I could do it, but I think I have to use the advance installer anyway
|
|
|
|
|
Do you mean code your own installation program? Seems to be re-inventing the wheel to me but if that is what you want to do, then this [^]might give you a starting off point.
If what you really want is a free program that will create a setup for you then this [^]might be what you are looking for.
If a wizard fails to cast an enchantment correctly, is that a mis-spelling?
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
How will I be able to know the complete path of the tasks on the task manager that are running under windows 2000 and above?
Using CreateToolHelp32Snapshot, Process32First and Process32Next displays the information of a file that are running on your taskbar. Windows ME and below displays the complete path of the source exe file which allows you to get to the source and do something about it like checking its CRC but Windows NT, XP only displays the filename without its complete path. How will I be able to know the complete path of the exe file that are running on the taskbar? Thanx in advance
|
|
|
|
|
benjnp wrote:
...but Windows NT, XP only displays the filename without its complete path.
Are you referring to the szExePath member of the MODULEENTRY32 structure? If not, you should be.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
its can be accessed through .szExeFile
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
if(hProcessSnap != INVALID_HANDLE_VALUE)
{
pe32.dwSize = sizeof( PROCESSENTRY32 );
if(Process32First( hProcessSnap, &pe32 ))
{
do
{
cout << pe32.szExeFile << endl; // displays the exe filename...
//in NT and XP, filename alone while in winME and below, Complete path
}while(Process32Next(hProcessSnap, &pe32));
}
CloseHandle( hProcessSnap );
}
|
|
|
|
|
benjnp wrote:
cout << pe32.szExeFile << endl; // displays the exe filename...
//in NT and XP, filename alone while in winME and below, Complete path
I'm full aware of this, which is why I suggested using the MODULEENTRY32 structure. It will provide you with the full path.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Ok, sorry. Thank you so much
|
|
|
|
|
Looking for a way to detect whether or not my VC++ code is being run from a debugger (or attached to by the debugger). I need to detect this programatically, from withing the code being debugged.
This would be regardless of compile mode (i.e. debug or release)
Thanks in advance,
Michael Levesque
-- modified at 14:23 Monday 10th October, 2005
|
|
|
|
|
Never mind.... found it:
IsDebuggerPresent();
M
|
|
|
|
|
Does anyone have a clue how to update the current window you are in, the GUI that is built with Visual Studio.net MFC foundation class. The problem is I have a timer function that triggers and can take a minute or so to complete. Everything works fine unless I open say calculator, then close it. There is a hole in the GUI until the timer function completes. Is there a way of updating the window while inside the timer function. I am somewhat new to using Windows and MFC and I was wrong in assuming Windows handles it for you. I thought the purpose of using MFC was it would handle all this for you.
-- modified at 14:01 Monday 10th October, 2005
|
|
|
|
|
This would be better asked in the VC++ forum...not the Lounge.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
tis not the lounge
|
|
|
|
|
This was in the Lounge when I saw it. Chris must have moved it.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
The screen will not update because the thread that is doing your calculation is busy and this is the same thread that draws your screen. You can solve this problem in several ways. One way is to do your calculation in a second thread.
A second way is to use PumpMessage as in the following article:
http://www.codeproject.com/threads/TemplatedLengthyOperation.asp[^]
John
-- modified at 14:07 Monday 10th October, 2005
|
|
|
|
|
Folks
What is the right way to handle this warning:
warning C4018: '>=' : signed/unsigned mismatch
I am comparing the out of two functions, both of which aren't mine, and one returns int and the other returns unsigned. I know they both return positive integers practically - so whats the way to get rid of this compiler warning?
Thanks!
|
|
|
|
|
If you are certain that there will not be any range problems, you can cast one of the variables to the other's type.
if( DWORD( iValue ) >= dwValue ) <br />
if( iValue >= int( dwValue ) )
This will not work correctly if one of the variables contains a value that has the high bit set (e.g. a 32-bit integer value greater than 2,147,483,647).
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! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|