|
you can look here also:
UINT ThreadNotifyFunc (LPVOID pParam)
{
HWND hwnd = (HWND) pParam; // Window to notify
HANDLE hChange = ::FindFirstChangeNotification (_T ("C:\\"),
TRUE, FILE_NOTIFY_CHANGE_FILE_NAME ¦ FILE_NOTIFY_CHANGE_DIR_NAME);
if (hChange == INVALID_HANDLE_VALUE) {
TRACE (_T ("Error: FindFirstChangeNotification failed\n"));
return (UINT) -1;
}
while (...) {
::WaitForSingleObject (hChange, INFINITE);
::PostMessage (hwnd, WM_USER_CHANGE_NOTIFY, 0, 2);
::FindNextChangeNotification (hChange); // Reset
}
::FindCloseChangeNotification (hChange);
return 0;
}
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
Also look for ReadDirectoryChangesW() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
class a{
public:
a():rs(&db)
{}
CRecordset rs;//line a
CDatabase db; //line b
};
// my question is shld line b comes before line a
|
|
|
|
|
heu, you are trying to create an object, but you assign a member with another member of the same object, which wasn't set yet. so change your code...
i'd like to add a remark. your code is note very beautiful, and worse, it is not very useful.
put your data members in private statement, write your class definition in a .h file, and write the class implementation into a .cpp file :
A.h
<font style="color:blue;">class</font> CA {
CRecordset rs;
CDatabase db;
<font style="color:blue;">public:</font>
CA (<font style="color:blue;">void</font>);
<font style="color:green;">
}
A.cpp
CA::CA(<font style="color:blue;">void</font>) : rs(), db() {
}
<font style="color:green;">
TOXCCT >>> GEII power
|
|
|
|
|
i feel that was the most simple way to express his doubt.
It'd be funny to have .cpp and .h files along for such a simple question.
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
anyway, his code was wrong !
and you, i'm waiting for your response at your "who's who" page...
thx
TOXCCT >>> GEII power
|
|
|
|
|
check out, its there!!
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
Members of class are constructed in order, in which are declared. It doesn't depend on, whether they are initialized in class constructor. And it also doesn't depend on the order of member initializers in class constructor.
So in your example the line b should be before the line a.
Robert-Antonio
"Life is very hard, if you apply E-R model to it."
|
|
|
|
|
Hi,
I created a thread using the AfxBeginthread function.
How do I stop this thread from another thread. MSDN resources say that its dangerous to use call TerminateThread. I tried using it too, but it failed to terminate it.
Thanks,
Deepak Samuel.
|
|
|
|
|
one way is to set a global boolean flag like g_fExit = true, from whichever thread you want ..so that the corresponding thread sees that and return.
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
in case you wanna use that call InterlockedIncrement or use a Critical section object in order to prevents more than one thread from using the same variable simultaneously.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Check the CEvent for MFC or the events in general for WIN32
The main idea:
in the loop of the thread that you want to stop, call WaitForSingleObject with WAIT_OBJECT_0 on the event handle, and in case it is signaled you just have to return and in the other thread just signal the event
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
i told that was one way and perhaps the simplest.
see wot Jeffery Ricther has to say. [^]
"its easy to make complex and complex to make simple"
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
Both are easy and simple to use, but i would rather go with events as it sure that it would be thread safe.
God is Real, unless declared Integer.
|
|
|
|
|
sounds nice..
please explain the need for thread saftey for this line:
g_fExit = true
that also with the help of an MFC object !
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
No, i am not tring to be within the context on this problem only... In general senario where threads need to be syncronised i would use kernel objects rather than some variables.;)
God is Real, unless declared Integer.
|
|
|
|
|
it 'd 'nt be fair if i dont mention the risk of deadlock. For any big and complex program it 'd be programmers nightmare to maintain all those handles.
if he has lot of threads and want to stop them form others. seems you didnt faced any such problem yet.
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
suhredayan® wrote:
if he has lot of threads and want to stop them form others
thats what kernel object are for, using it efficiently gives good results.
God is Real, unless declared Integer.
|
|
|
|
|
i would be greatful if you explain the pitfall in following line if executed from multiple thread.
g_fExitThread=true;
or atleast the need from the kernal resource, to do the above.
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
Click[^]
God is Real, unless declared Integer.
|
|
|
|
|
suhredayan® wrote:
see wot Jeffery Ricther has to say.
either Jeffery is ur pal ,or you been eating pages of his book.
God is Real, unless declared Integer.
|
|
|
|
|
maatha>pitha>guru>god
btw not a pal, but > god
thats wot i have learnt.
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
PostThreadMessage(ThreadId, WM_QUIT, 0, 0);
|
|
|
|
|
The problem with using PostThreadMessage or SendNotifyMessage is that worker threads typically don't have message loops, so these functions are not helpful always.
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
Hi all..
I want to find the type of internet connection.Is there any method to find the type of internet connection used by a particular system.
|
|
|
|