Click here to Skip to main content
15,926,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Help! how to force the control to display the + even though the item does not have any child items inserted Pin
Mark Salsbery6-Sep-08 8:29
Mark Salsbery6-Sep-08 8:29 
GeneralRe: Help! how to force the control to display the + even though the item does not have any child items inserted Pin
DavidLeeFromKunming6-Sep-08 16:48
DavidLeeFromKunming6-Sep-08 16:48 
QuestionMultiple Events Pin
thenutz725-Sep-08 9:26
thenutz725-Sep-08 9:26 
Questiondotted ip address to name? Pin
montiee5-Sep-08 9:06
montiee5-Sep-08 9:06 
QuestionRe: dotted ip address to name? Pin
David Crow5-Sep-08 10:19
David Crow5-Sep-08 10:19 
AnswerRe: dotted ip address to name? Pin
montiee5-Sep-08 10:48
montiee5-Sep-08 10:48 
Questionuse of "SECTION" within a hook dll ..? Pin
only_jack5-Sep-08 8:54
only_jack5-Sep-08 8:54 
QuestionCWnd not receiving PostMessage Pin
gatwork5-Sep-08 8:05
gatwork5-Sep-08 8:05 
I have code which worked under VC6 and now failing under VS2005 (additional change was moving portions to a dll from a lib, but pretty sure this not affecting things)

I have an out-of-process COM server, which constructs a CWnd in the constructor of the CComCoClass templated object. The intent is for this CWnd to receive messages posted from a thread (created in a linked dll) to track external state. (why is it a CWnd? because the primary recipient of the dll's state messages is a windows app)

The CWnd seems to construct fine, but the thread goes quiescent. I don't think that the thread has a message loop.

Question: how to I get the CWnd into a messagepump? a) Can I change the CWnd creation? b) Can I force the linkage of the Cwnd into the PreTranslate tree? c) Do I have to punt the CWnd and go to a GUI thread (which seems to be effectively duplicating much of what just creating a CWnd should do for me, and forces me to add to the dll a parallel notification list)?

Messages sent from the posting dll thread can be received at the COM object's message loop (via PostThreadMessage), so I'm confident the switch from VC6 to VS2005 is the culprit not the change from LIB to DLL, especially since PostMessage works in the primary application.

class ATL_NO_VTABLE CServer: 
	public CComObjectRootEx<ccomsinglethreadmodel>,
	public CComCoClass<cserver,>,
	public IDispatchImpl<iserver,>
{
...
	class wndHook : public CWnd{
	public:
		wndHook(){}
		//{{AFX_MSG(wndHook)
		afx_msg LPARAM Message(WPARAM, LPARAM);
		//}}AFX_MSG
		DECLARE_MESSAGE_MAP()
	}*pWnd;
}

CServer::CServer(){
...
	pWnd = new wndHook();
	if (!pWnd->CreateEx(0, NULL, _T("HOOK"), WS_CHILD,
		CRect(0,0,0,0), CWnd::GetDesktopWindow(), 0, NULL)){
		TRACE0("Failed to create hook window\n");
	}

	GetDLL()->AddToNotificationList(ENUM_VAL, pWnd);

}

BEGIN_MESSAGE_MAP(CServer::wndHook, CWnd)
	//{{AFX_MSG_MAP(wndHook)
	ON_MESSAGE(WM_APP, CServer::wndHook::Message)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


// external dll function 
void DLL::Post(WORD mID, long val)
{
...
	::PostMessage([element in list]->GetSafeHwnd(), WM_APP, mID, val);

}</ccomsinglethreadmodel>

Question[Message Deleted] Pin
hhh5-Sep-08 7:54
hhh5-Sep-08 7:54 
AnswerRe: Design Question Pin
Perspx5-Sep-08 10:17
Perspx5-Sep-08 10:17 
GeneralRe: Design Question Pin
hhh5-Sep-08 22:44
hhh5-Sep-08 22:44 
AnswerRe: Design Question Pin
john john mackey5-Sep-08 12:16
john john mackey5-Sep-08 12:16 
GeneralRe: Design Question Pin
hhh5-Sep-08 22:59
hhh5-Sep-08 22:59 
QuestionString literal expansion Pin
Jim Crafton5-Sep-08 7:44
Jim Crafton5-Sep-08 7:44 
AnswerRe: String literal expansion Pin
Michael Dunn5-Sep-08 8:07
sitebuilderMichael Dunn5-Sep-08 8:07 
AnswerRe: String literal expansion Pin
Garth J Lancaster5-Sep-08 15:00
professionalGarth J Lancaster5-Sep-08 15:00 
Questionhow to read data from com port Pin
manju23reddy5-Sep-08 7:40
manju23reddy5-Sep-08 7:40 
QuestionVC++ and CRystalReport Pin
kasi145-Sep-08 7:39
kasi145-Sep-08 7:39 
AnswerRe: VC++ and CRystalReport Pin
liquid_6-Sep-08 10:48
liquid_6-Sep-08 10:48 
QuestionThreads Pin
bhanu_85095-Sep-08 3:35
bhanu_85095-Sep-08 3:35 
AnswerRe: Threads Pin
David Crow5-Sep-08 3:53
David Crow5-Sep-08 3:53 
AnswerRe: Threads Pin
JudyL_MD5-Sep-08 4:38
JudyL_MD5-Sep-08 4:38 
GeneralRe: Threads Pin
bhanu_85096-Sep-08 0:12
bhanu_85096-Sep-08 0:12 
GeneralRe: Threads Pin
JudyL_MD6-Sep-08 2:46
JudyL_MD6-Sep-08 2:46 
AnswerRe: Threads Pin
Roger Stoltz5-Sep-08 4:42
Roger Stoltz5-Sep-08 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.