Click here to Skip to main content
15,851,915 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ class hierarchy design problem Pin
kylur12-Apr-10 11:10
kylur12-Apr-10 11:10 
QuestionCan PostThreadMessage Post to a Thread in a Different Process Pin
ForNow9-Apr-10 8:50
ForNow9-Apr-10 8:50 
AnswerRe: Can PostThreadMessage Post to a Thread in a Different Process Pin
Code-o-mat9-Apr-10 11:48
Code-o-mat9-Apr-10 11:48 
GeneralRe: Can PostThreadMessage Post to a Thread in a Different Process Pin
ForNow9-Apr-10 12:03
ForNow9-Apr-10 12:03 
GeneralRe: Can PostThreadMessage Post to a Thread in a Different Process Pin
Code-o-mat9-Apr-10 12:11
Code-o-mat9-Apr-10 12:11 
GeneralRe: Can PostThreadMessage Post to a Thread in a Different Process Pin
Adam Roderick J9-Apr-10 20:25
Adam Roderick J9-Apr-10 20:25 
AnswerRe: Can PostThreadMessage Post to a Thread in a Different Process Pin
cmk9-Apr-10 16:15
cmk9-Apr-10 16:15 
AnswerRe: Can PostThreadMessage Post to a Thread in a Different Process [modified] Pin
Adam Roderick J9-Apr-10 19:58
Adam Roderick J9-Apr-10 19:58 
Offcourse they are unique until they are process is alove, but once process is terminated, they can be assigned to another process.

And next is about marshalling. It duplicating the handles. Just have a look on this article which will help you get the knowledge regarding the same.
Inside Windows Handles

Now here is sample that explains, how you can send a message to other process thread.
Now here WM_QUIT is send to Task Manager and it can be terminated from our process using PostThreadMessage.
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
char tWindow[]="Windows Task Manager";
int main(int argc, char *argv[])
{
	HWND hWnd;
	DWORD proc;
	DWORD hThread;
	hWnd = FindWindow(NULL,tWindow);
	if(hWnd == NULL)
	{
	  return 0;
	}
	hThread = GetWindowThreadProcessId(hWnd,&proc);
	if(hThread  == NULL)
	{
	  return 0;
	}
	char buffer[MAX_PATH];
	char *message = "hello";
	sprintf(buffer, "say %s", message);
	// IT will kill the Task manager application.
	PostThreadMessage((DWORD) hThread,(UINT) WM_QUIT,0,(LPARAM)buffer);
	printf("+ Done...\n");
	return 0;
}

Hope things are clear Smile | :)
Величие не Бога может быть недооценена.
modified on Saturday, April 10, 2010 1:26 AM

QuestionDestructElements() and destructor not getting called Pin
David Crow9-Apr-10 7:34
David Crow9-Apr-10 7:34 
AnswerRe: DestructElements() and destructor not getting called Pin
Chris Losinger9-Apr-10 7:41
professionalChris Losinger9-Apr-10 7:41 
GeneralRe: DestructElements() and destructor not getting called Pin
David Crow9-Apr-10 8:37
David Crow9-Apr-10 8:37 
GeneralRe: DestructElements() and destructor not getting called Pin
Chris Losinger9-Apr-10 8:49
professionalChris Losinger9-Apr-10 8:49 
QuestionRe: DestructElements() and destructor not getting called Pin
David Crow9-Apr-10 8:59
David Crow9-Apr-10 8:59 
AnswerRe: DestructElements() and destructor not getting called Pin
Chris Losinger9-Apr-10 9:08
professionalChris Losinger9-Apr-10 9:08 
AnswerRe: DestructElements() and destructor not getting called Pin
Eugen Podsypalnikov9-Apr-10 9:58
Eugen Podsypalnikov9-Apr-10 9:58 
GeneralRe: DestructElements() and destructor not getting called Pin
David Crow9-Apr-10 10:21
David Crow9-Apr-10 10:21 
GeneralRe: DestructElements() and destructor not getting called Pin
Moak9-Apr-10 11:14
Moak9-Apr-10 11:14 
GeneralRe: DestructElements() and destructor not getting called Pin
Eugen Podsypalnikov9-Apr-10 11:43
Eugen Podsypalnikov9-Apr-10 11:43 
AnswerRe: DestructElements() and destructor not getting called Pin
CPallini9-Apr-10 12:41
mveCPallini9-Apr-10 12:41 
AnswerRe: DestructElements() and destructor not getting called Pin
Ajay Vijayvargiya11-Apr-10 5:34
Ajay Vijayvargiya11-Apr-10 5:34 
QuestionReg to Unicode and MBCS problem in socket programing Pin
rrthangavel9-Apr-10 6:19
rrthangavel9-Apr-10 6:19 
QuestionRe: Reg to Unicode and MBCS problem in socket programing Pin
CPallini9-Apr-10 8:21
mveCPallini9-Apr-10 8:21 
AnswerRe: Reg to Unicode and MBCS problem in socket programing Pin
Migounette10-Apr-10 2:46
Migounette10-Apr-10 2:46 
AnswerRe: Reg to Unicode and MBCS problem in socket programing Pin
Ajay Vijayvargiya11-Apr-10 5:40
Ajay Vijayvargiya11-Apr-10 5:40 
Questionget notification of a particular process start Pin
Cvaji9-Apr-10 5:58
Cvaji9-Apr-10 5:58 

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.