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

C / C++ / MFC

 
AnswerRe: PostMessage problem Pin
Naveen23-Jun-08 17:41
Naveen23-Jun-08 17:41 
GeneralRe: PostMessage problem Pin
tataxin23-Jun-08 18:22
tataxin23-Jun-08 18:22 
GeneralRe: PostMessage problem Pin
Naveen23-Jun-08 18:46
Naveen23-Jun-08 18:46 
GeneralRe: PostMessage problem Pin
tataxin24-Jun-08 14:41
tataxin24-Jun-08 14:41 
AnswerRe: PostMessage problem Pin
Hamid_RT23-Jun-08 18:38
Hamid_RT23-Jun-08 18:38 
AnswerRe: PostMessage problem Pin
Jijo.Raj23-Jun-08 18:57
Jijo.Raj23-Jun-08 18:57 
AnswerRe: PostMessage problem Pin
tataxin23-Jun-08 19:26
tataxin23-Jun-08 19:26 
AnswerRe: PostMessage problem [modified] Pin
bonkers23-Jun-08 20:42
bonkers23-Jun-08 20:42 
You need a class that handles the post msgs....

void FACTORY::addWindow(HWND hWnd)
{
	m_Windows.push_back(hWnd);
}


thus, regsiter all the windows with this class with the function above. (FACTORY::instance().addWindow(m_hWnd);)

then, you send these messages to the different classes that registered to this via the PostMessage function....

void FACTORY::PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam)
{

	list<HWND>::iterator i;
	int count = 0;

	HWND hWnd;
	for( i = m_Windows.begin(); i != m_Windows.end(); i++)
	{
	  hWnd = *i;

	  ::PostMessage(hWnd, Msg, wParam, lParam);
	}	

}
Then simply post the message and catch it in the class....
FACTORY::instance().PostMessage(THE_MESSAGE, (long)VAL1, (long)VAL2);


and "catch" it in you PretranslateMessage functions....
if(pMsg->message == THE_MESSAGE)


then get the vals...
int VAL1 = (long)pMsg->wParam;
 int VAL2 = (long)pMsg->lParam;

OR SOMETHING LIKE THAT....

modified on Tuesday, June 24, 2008 3:04 AM

GeneralRe: PostMessage problem Pin
tataxin24-Jun-08 14:46
tataxin24-Jun-08 14:46 
Questionwhat ALL gets created by an empty class? (c++) Pin
dd31415923-Jun-08 8:27
dd31415923-Jun-08 8:27 
AnswerRe: what ALL gets created by an empty class? (c++) Pin
David Crow23-Jun-08 9:00
David Crow23-Jun-08 9:00 
GeneralRe: what ALL gets created by an empty class? (c++) Pin
dd31415923-Jun-08 9:31
dd31415923-Jun-08 9:31 
AnswerRe: what ALL gets created by an empty class? (c++) Pin
Jijo.Raj23-Jun-08 9:06
Jijo.Raj23-Jun-08 9:06 
GeneralRe: what ALL gets created by an empty class? (c++) Pin
dd31415923-Jun-08 9:31
dd31415923-Jun-08 9:31 
QuestionHELP WITH WINSOCK PROGRAMMING Pin
bodhi201623-Jun-08 8:25
bodhi201623-Jun-08 8:25 
AnswerRe: HELP WITH WINSOCK PROGRAMMING Pin
bulg23-Jun-08 11:55
bulg23-Jun-08 11:55 
AnswerRe: HELP WITH WINSOCK PROGRAMMING Pin
Stephen Hewitt23-Jun-08 14:25
Stephen Hewitt23-Jun-08 14:25 
Questionoperator delete Pin
Eikthrynir23-Jun-08 7:24
Eikthrynir23-Jun-08 7:24 
AnswerRe: operator delete Pin
David Crow23-Jun-08 7:35
David Crow23-Jun-08 7:35 
GeneralRe: operator delete Pin
led mike23-Jun-08 7:52
led mike23-Jun-08 7:52 
JokeRe: operator delete Pin
David Crow23-Jun-08 8:53
David Crow23-Jun-08 8:53 
AnswerRe: operator delete Pin
Cedric Moonen23-Jun-08 7:44
Cedric Moonen23-Jun-08 7:44 
GeneralRe: operator delete Pin
led mike23-Jun-08 9:47
led mike23-Jun-08 9:47 
QuestionDateTimePicker Pin
si_6923-Jun-08 6:00
si_6923-Jun-08 6:00 
AnswerRe: DateTimePicker Pin
James R. Twine23-Jun-08 7:41
James R. Twine23-Jun-08 7:41 

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.