|
if I put DoEvents( PeekMessage etc) in the while (1) loop is works fine.
That means you DO need to have a message pump for the object to work. Why not change the ActionThread to a user interface thread derived from CWinThread so that you don't need to DoEvents explicitly.
|
|
|
|
|
Owwww noooo, can't do that. Need especially CWinThread (horrid) need to keep the object in a worker thread. I think I have a solution see other postings on this thread.
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
"Owwww noooo, can't do that. Need especially CWinThread (horrid) need to keep the object in a worker thread. I think I have a solution see other postings on this thread."
Good for you. Comeback when it doesn't work.
|
|
|
|
|
Got it working, do you won't a copy for reference
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
No, thanks. But you did move the creation of your com object to the main thread which has a message pump, right?
Otherwise, you need to write an article to explain how it is working.
|
|
|
|
|
You can create the object and then marshal it to the other thread via CoMarshalInterThreadInterfaceInStream.
|
|
|
|
|
I know where your coming I reckon this should do the trick?
CMyActionThread::CreateObject()
{
SendMessage(m_hWnd, WM_CREATE_OBJECT, 0, 0);
//
Now get the marshedPointer!
}
LRESULT CMainFrame::OnMyCreateObjectMessage(WPARAM wParam, LPARAM lParam)
{
// Create the object
// Marshal the object
return 0;
}
and it's coming back now, in essential com, there's helper functions, WritePtrToGlobalVariable and ReadPtrFromGlobalVariable
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
I have create DBGrid controls at run time and want to catch event corresponding each instance but find no way.
so if someone know about it plz tell me
|
|
|
|
|
I tried to create a cobject derived class:
CObject*t=(CObject*)RUNTIME_CLASS(CHScrollTitle)->CreateObject();
and then i tried to free it with:
delete t; or CHScrollTitle::operator delete(t);
but the delete operator failes in debug-mode with an assert-notice. (something with pHead->nBlockUse==nblockuse)
does anybody know how to free a with CreateObject(or CArchive::ReadObject()) created object?
\
TIA B.Bruggeman
|
|
|
|
|
This problem isn't probably related to CRuntimeClass::CreateObject - seems that you've corrupted the heap somehow.
BTW: calling CRuntimeClass::CreateObject makes absolutely no sense when you know the exact type of object - in your case, it's CHScrollTitle. You can just write
t = new CHScrollTitle;
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I also thought it was a memoryleak/overwrite but i wrote a simple test program and than already it assert's about the debug-memory-tracing-variable m_nBockUse,
but when i use new/delete it doesn't assert..
i have different kind of classes in a list and i want to serialize them using Write/ReadObject, so i can't use an ordinary new/delete operator. but when i tested this it asserts in the (debug) operator delete, so i tested it with the lines i posted before, but it still asserted..
so do you have other suggestions?
btw in the file afxmem.cpp are many operator delete which (in debugmode) either call _free_dbg(p, _CLIENT_BLOCK); or _free_dbg(p, _NORMAL_BLOCK);, so probably the wrong deconstructor is called.. but how do I fix this?
TIA. B.Bruggeman
|
|
|
|
|
1) memory overwrites: the fastest way to detect/remove them is by using automatic diagnostic tools, like BoundsChecker (www.numega.com) or Purify (www.rational.com)
2) serializing different CObject-derived classes from list: just use operator << with pointers to objects. MFC is smart enough to write metadata containing type information to archive. You don't need to write type information yourself.
CBaseClass *p = list.GetHead();
ar << p;
CBaseClass *p;
ar >> p;
delete p;
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
hi there,
I'm writing a client to manage a remote ms-access database, how can i do that is it with SQLConfigDataSource
or something else ??
my problem is that my db is on my website ie:
www.mywebpage.com/database/mydb.mdb
a sample code will help me lot
thanks in advance ...
|
|
|
|
|
how can i add a version number to the CDocument class?
ZHANGYIFEI
|
|
|
|
|
1. Don't double post.
2. You really DON'T want to add _anything_ to the CDocument class.
The whole idea of MFC is that it encapsulates base functionality. To extend it for specific requirements, you inherit an MFC class and extend and customise to your hearts content.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Is my dll will be matched for another language (delphi, vb ect) if I created it in ATL COM APP Wizard and I use in class CDialog into this project ?
|
|
|
|
|
Delphi and VB will be able to call a COM dll generated by ATL/WTL Wizard. I don't tend to use MFC but rather ATL for my dialog classes. As long as you don't export any MFC/C++/C Datatypes then a COM dll should be able to be called from any lanugage that supports COM.
Michael
|
|
|
|
|
MSDN contains an article titled How to add MFC code to an ATL project. It explains all.
Thanks for the help,
Bill
|
|
|
|
|
You must have no problem with that, while in the pc you have the MFC runtimes.
I build ATL Com Objects from a lot of languajes, like delphi, VB, VBScript, VFP, etc....
Cheers
Carlos Antollini.
|
|
|
|
|
The question is why would you need to ? ATL is designed to be lean, why fatten it up with MFC ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hello,
I am trying to write an application in WTL with CListView.
But that CListView Can not implement Extended List-View Styles
:LVS_EX_FULLROWSELECT.
Could some one send me a link or code to create ListView that LVS_EX_FULLROWSELECT in WTL.
Thanks in Advance
dkwang
|
|
|
|
|
From my WTL code, m_listctrlData is a CListViewCtrl.
m_listctrlData.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);
hope this helps,
Michael
|
|
|
|
|
|
Dear friends
Hi
Will u please any one help me how to select/access a particular text using drag-mouse movement.as an output display file i want to use this selected text.how it is possible.Please help me,i am new to VC++,so kindly help me in getting the solution.
Thanking you in advance.
Bye
Binay
|
|
|
|
|
Is there a standard way to add buttons to a menu bar like outlooks vertical one?
and if so could someone tell me where i can find more info on using this type of toolbar
|
|
|
|