|
alright,
that sounds a little bizarre. Is the source in O2 running in another thread?
If you call a function O1::SomeFunc()
and it create the object of type O2,
then do you call a function O2::OtherFunc from a function of O1 ??
If so your return value frmo OtherFunc can tell O1 to delete the O2 object.
Otherwise you could post a message to the applications main thread handle, and capture it there, and call a function that tells O1 to delete O2.
|
|
|
|
|
Maybe you can create a custom message && || custom message handler?
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
|
|
|
|
|
how could i create a custom message?
|
|
|
|
|
#ifndef WM_LOCK<br />
#define WM_LOCK WM_APP + 0x100<br />
#endif<br />
<br />
#define MY_LOCKMESSAGE(message, memberFxn) \<br />
{ message, 0, 0, 0, AfxSig_lwl, \<br />
(AFX_PMSG)(AFX_PMSGW) \<br />
(static_cast< LRESULT (AFX_MSG_CALL CWinApp::*)(WPARAM, LPARAM) > \<br />
(memberFxn)) },
OK first note, I do not understand everything they did here.
I normally copy/paste a bit and adapt it a little.
The first #indif is a custom message. The #define is a custom message handler. Read first some stuff about messages and handling them before you try to do something!!!!
(WM_APP was last message so + 0x100 if you want another again last message + 0x100 ...)
Good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
|
|
|
|
|
|
Hi,
I've got this code for the OnSetcursor function:
BOOL CVentanaPizarra::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
BOOL resultado=TRUE;
if (this->m_MouseManoMover)
{
if (SetCursor(CursorManoMover))
resultado=TRUE;
}
else
resultado = CDialog::OnSetCursor(pWnd, nHitTest, message);
return resultado;
}
the following function changes the boolean which is seen to change the cursor in the abovementioned function.
LONG CVentanaPizarra::MouseManoMoverTrue(WPARAM wParam, LPARAM lParam)
{
this->m_MouseManoMover=true;
return 0;
}
I call this function from a 'CWnd derived' custom control in the dialog (that i use for drawing). The message works, when i click on something on the control , the message is sent, but the OnSetCursor function doesn't get called, perhaps because i'm hovering the mouse over the custom control, and not over the dialog. But the custom control is in the dialog.
Any ideas?
thanks!!
|
|
|
|
|
You are not handling WM_SETCURSOR in the child window, I suppose? That would otherwise be the reason for your problem. Is the cursor changed when you move the mouse, that is, if you do the action leading to MouseManoMoverTrue , will the cursor stay as it was, but change as soon as you move it? If that is the case, you might want to call SetCursor with the special cursor in MousManoMoverTrue as well.
|
|
|
|
|
Johan Rosengren wrote:
You are not handling WM_SETCURSOR in the child window
that was the problem. Solved it. thanks!!
|
|
|
|
|
Hi,all
I am a newcomer here, would you like tell me what problem is? When i download some source codes here, I can not always compile or link them successfully. it always tells me some errors like this:
:\program files\microsoft visual studio\vc98\mfc\include\afx.h(1483) : error C2629: unexpected 'class CTimeSpan ('
c:\program files\microsoft visual studio\vc98\mfc\include\afx.h(1483) : error C2238: unexpected token(s) preceding ';'
c:\program files\microsoft visual studio\vc98\mfc\include\afx.h(1527) : error C2146: syntax error : missing ';' before identifier 'm_timeSpan'
........
How can i deal with it?
Thanks very much
henry
|
|
|
|
|
Maybe you have not include some header files.
|
|
|
|
|
Yes, I just downloaded from here:
http://www.codeproject.com/bitmap/tonyjpeglib.asp
But I can not compile and link it sucefully. Would you like do me a favor and try it see what is the problem?
Thanks
david
|
|
|
|
|
give us the erroring line 1483...
TOXCCT >>> GEII power
|
|
|
|
|
Thanks, the code as follow, but I do not think the code has any problem because it is standard and other source codes use it well. it is inside the AFX.H file.
class CTimeSpan
{
public:
// Constructors
CTimeSpan();
CTimeSpan(time_t time);
CTimeSpan(LONG lDays, int nHours, int nMins, int nSecs);
CTimeSpan(const CTimeSpan& timeSpanSrc);
const CTimeSpan& operator=(const CTimeSpan& timeSpanSrc);
|
|
|
|
|
and did you try to include time.h yourself ?
TOXCCT >>> GEII power
|
|
|
|
|
Thanks, I did not find time.h file in the fold I have downloaded. where can i find the time.h file. I think these time.h files are different from different sources. right?
thanks
|
|
|
|
|
just #include <time.h>
it is in the compiler includes folder...
TOXCCT >>> GEII power
|
|
|
|
|
Thanks
I have included the time.h file inside .cpp files. but still errors over there.
I just downloaded source codes from here:
http://www.codeproject.com/bitmap/tonyjpeglib.asp
But I can not compile and link it sucefully. Would you like do me a favor and try it see what is the problem?
Thanks
david
|
|
|
|
|
i would do it if i had time, but at the moment, i already take on my time to post on codeproject, but i'm sorry, i cannot do this for you at the moment...
TOXCCT >>> GEII power
|
|
|
|
|
Thanks Geii power
I wait for your reply when you are availiable.
Thanks again
|
|
|
|
|
wow, GEII is the studies i am currently on... it's not me
call me toxcct, i'll be fine for me
TOXCCT >>> GEII power
|
|
|
|
|
Sorry, toxcct;P
I will wait
|
|
|
|
|
I have the following class:
template<typename FLAGTYPE> // may be BYTE, WORD, ULONG...
class Flags {
public:
/**
The boolean indexing operator returns true if the indexed flag bit
is a one.
*/
bool operator[] (long ix) const
{
assert((long)ix >= 0 && (long)ix < 8*sizeof(FLAGTYPE));
return ((m_flags & (1<<ix)) != 0);
}
// ...
protected:
FLAGTYPE m_flags;
};
The bool operator[] makes it possible to write:
Flags<ULONG> f1 = 10;
bool b = f1[3]; // assigns bit 3 of f1, i.e. f1 & 0x08, to b
How do I define indexing and assignment operators that *set* bit 'ix' to a boolean value, so that I can write:
f1[3] = true;
|
|
|
|
|
You can't do that directly because the return value of a function can't be a bitfield. You would need to have operator[] return some object (probably a helper class) that has access to the members of Flags<> variable and an operator= that takes a bool parameter. That operator= would twiddle the right bit.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
If my rhyme was a drug, I'd sell it by the gram.
|
|
|
|
|
- I Want to detect a file which have received from other Computer on LAN. But I don't know way to approach.
--> What's should i do??
--> Can I use Shell Extentions??
thanks
|
|
|
|
|
*How* are you receiving it? If you've fetched it from the other computer, then look at the
application fetching the file.
If it is out of your control, (ie. you have a shared directory, and the other PC pushes the file),
then you may be able to use the FindFirstChangeNotification API function.
Iain.
|
|
|
|