|
Collect the handles that each createthreadex_ call returns to you in an array. Then call WaitForMultipleObjects on the the array in you exit handler. You can then guarantee that all your child theads have completed before your process thread.
Ryan.
Computers allow you to make more mistakes than any other invention, with the possible exception of handguns and tequila.
|
|
|
|
|
Don't forget to pass TRUE as the WaitAll (3rd) parameter.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
do these 2 functions (spaw* and _exec) work under windows (not dos)?
thx
includeh10
|
|
|
|
|
they'll work under both .
-c
"[it was..] one of those evenings when you feel that not only will there definitely be a revolution, but that the Association of Manufacturers will foot the bill."
-- Umberto Eco, Foucault's Pendulum
|
|
|
|
|
I have a directory and i want read the file without i know the name of file.
How i can start?
|
|
|
|
|
Have a look at FindFirstFile and friends.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
This function searches a directory for a file whose name matches the specified file name. FindFirstFile examines subdirectory names as well as file names.
I don't know the name of the file.
|
|
|
|
|
Look deeper into the docs The function supports wildcards, take advantage of them.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Use CFileFind class may be esaier
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
This solution are not good. Other solition?
|
|
|
|
|
It says that cout is an undecalred identifier when i #include <iostream>
thanks
|
|
|
|
|
It is std::cout , although many samples omit the prefix for brevity.
You can stick to the simpler cout including
using namespace std; right after the #include s, though this is not, for a variety of reasons, a good policy to follow in general.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi all!
I'm searching for a free (legal, of course) Visual C++ CD, I mean, the Introductory or Student version or something similar.
Where can I find it ?
Can I download it from some webstite ?
I need the 6.0 release (or later).
Please help!
|
|
|
|
|
|
Thank you!
I've found the same Introductory version on another book too:
Learn Visual C++ N:-Dow
|
|
|
|
|
Hi
I want to create a dynamic link library in Visual C++ for use in Visual Basic.
From VB i pass a String to the dll, so far so good, but now i want to return another String to the VB-program. My problem is now the memory access error, that occurs in the running VB programm.
What types in the c++dll can i return to VB, that expect a String??
thanx for your replies
|
|
|
|
|
A BSTR , I think. CComBSTR could be useful to do this.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I though about creating a Edit window in my app that when called
at runtime would catch all OutputDebugStrings that my program was
making.
After some nosing about on MSDN about catching OutPutDebugStrings i
wrote a thread function as below and called it from a menu option. The
idea was to eventually create a small window that would be updated with
any OutPutDebugStrings that were caught.
<br />
UINT catchDebugString(LPVOID param)<br />
{<br />
TCHAR myChar[1024];<br />
DWORD dwProcessId = GetCurrentProcessId();<br />
HANDLE hHandle = OpenProcess( PROCESS_ALL_ACCESS, false, dwProcessId );<br />
<br />
if ( DebugActiveProcess( dwProcessId ) == 0 )<br />
return 0;<br />
<br />
DEBUG_EVENT de;<br />
<br />
while ( WaitForDebugEvent( &de, INFINITE ) )<br />
{ <br />
if ( de.dwDebugEventCode == OUTPUT_DEBUG_STRING_EVENT )<br />
{<br />
OUTPUT_DEBUG_STRING_INFO deStr = de.u.DebugString; <br />
<br />
ReadProcessMemory(hHandle, deStr.lpDebugStringData, myChar, 1024, NULL);<br />
}<br />
<br />
if ( EXIT_PROCESS_DEBUG_EVENT == de.dwDebugEventCode )<br />
break;<br />
<br />
ContinueDebugEvent( de.dwProcessId, de.dwThreadId, DBG_CONTINUE );<br />
} <br />
<br />
return 1;<br />
}<br />
All was well until i found out i cant call DebugActiveProcess( dwProcessId )
with my own process id , there by making it so i cant catch my own OutputDebugStrings.
I just wondered if anyone out there had any ideas of how i could overcome this
problem or if there is another way to catch OutputDebugStrings??
cheers
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
DebugView do that and lot more
http://www.sysinternals.com/ntw2k/freeware/debugview.shtml
U have to change ur process privilege to debug mode first if u still wanna do it
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
hey there papa... yes i am aware of debug output viewer applications but want to do this programatically..
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
|
cheers mate... I'll have a look at that, as it looks like it will provide valuable info for me..
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
Maybe Ivo Ivanov's API hooking revealed[^] can be of help here.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
cheers Joaquín.. Im just having a quick read now
AdrianCooper me;
while(CKitchen::beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
I'm trying to draw a button and an ip address area in my active x control.
I thought I could just use the ResourceView->Dialog to add the components visually, but evidently that only allows you to manipulate the property and about box areas for activex programs.
So... my question is how do I draw, say, a simple CButton in the ondraw area of my control?
something like:
void CAChatCtrl::ondraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
CButton testButton = new Button();
CRect bBounds = new CRect( rcBounds->r - 30, rcBounds->b - 30, rcBounds->r, rcBounds->b );
testButton::Create("DrawnButon",BS_DEFPUSHBUTTON,bBounds,?,??);
}
Thanks for any help
|
|
|
|