Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CDialog : Message After the dialog is created and displayed? Pin
Mark Salsbery6-Feb-08 10:10
Mark Salsbery6-Feb-08 10:10 
General[Solved] Re: CDialog : Message After the dialog is created and displayed? Pin
Maximilien6-Feb-08 10:14
Maximilien6-Feb-08 10:14 
GeneralRe: [Solved] Re: CDialog : Message After the dialog is created and displayed? Pin
Mark Salsbery6-Feb-08 10:16
Mark Salsbery6-Feb-08 10:16 
AnswerRe: CDialog : Message After the dialog is created and displayed? Pin
Dave Calkins6-Feb-08 10:26
Dave Calkins6-Feb-08 10:26 
GeneralPassing multiple parameters to a thread Pin
jonsey298476-Feb-08 9:55
jonsey298476-Feb-08 9:55 
GeneralRe: Passing multiple parameters to a thread Pin
Mark Salsbery6-Feb-08 10:13
Mark Salsbery6-Feb-08 10:13 
GeneralRe: Passing multiple parameters to a thread Pin
jonsey298476-Feb-08 12:07
jonsey298476-Feb-08 12:07 
GeneralRe: Passing multiple parameters to a thread Pin
Mark Salsbery6-Feb-08 12:30
Mark Salsbery6-Feb-08 12:30 
Can you show the code (or equivalent)?

Here's a simple example - it's a silly example since the thread proc has
direct access to the global struct object, but hopefully it
shows you a way to pass a pointer to the thread proc...
#include <process.h>

// declare the struct
struct MyThreadParams
{
   int a;
   int b;
   int c;
};

// define a global MyThreadParams object
MyThreadParams GlobalThreadParams;

// a worker thread procedure
unsigned __stdcall WorkerThreadProc(void *lpParameter)
{
	MyThreadParams *pThreadParams = (MyThreadParams *)lpParameter;

	//... use pThreadParams here ...

	return 0;
}


int SomeFunc()
{
	// Initialize the global thread params struct object
	GlobalThreadParams.a = 0;
	GlobalThreadParams.b = 1;
	GlobalThreadParams.c = 2;

	// Create a thread passing a pointer to the global thread params struct to the thread proc
	HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, WorkerThreadProc, &GlobalThreadParams, 0, NULL);

	if (hThread)
	{
		::CloseHandle(hThread);
	}

...


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Passing multiple parameters to a thread Pin
Cedric Moonen6-Feb-08 20:18
Cedric Moonen6-Feb-08 20:18 
GeneralRe: Passing multiple parameters to a thread Pin
CPallini6-Feb-08 21:00
mveCPallini6-Feb-08 21:00 
GeneralRe: Passing multiple parameters to a thread Pin
Mark Salsbery7-Feb-08 5:31
Mark Salsbery7-Feb-08 5:31 
GeneralRe: Passing multiple parameters to a thread Pin
Cedric Moonen7-Feb-08 7:37
Cedric Moonen7-Feb-08 7:37 
GeneralRe: Passing multiple parameters to a thread Pin
Mark Salsbery7-Feb-08 7:54
Mark Salsbery7-Feb-08 7:54 
GeneralRe: Passing multiple parameters to a thread [Solved] Pin
jonsey298479-Feb-08 0:17
jonsey298479-Feb-08 0:17 
GeneralRe: Passing multiple parameters to a thread, best practices Pin
jonsey298479-Feb-08 0:29
jonsey298479-Feb-08 0:29 
QuestionXMLHttpRequest POST message flow. Pin
Neville Franks6-Feb-08 9:25
Neville Franks6-Feb-08 9:25 
GeneralRe: XMLHttpRequest POST message flow. Pin
led mike8-Feb-08 8:41
led mike8-Feb-08 8:41 
GeneralRe: XMLHttpRequest POST message flow. Pin
Neville Franks8-Feb-08 9:53
Neville Franks8-Feb-08 9:53 
GeneralRe: XMLHttpRequest POST message flow. Pin
led mike8-Feb-08 10:10
led mike8-Feb-08 10:10 
GeneralRe: XMLHttpRequest POST message flow. Pin
Neville Franks8-Feb-08 10:56
Neville Franks8-Feb-08 10:56 
GeneralRe: XMLHttpRequest POST message flow. Pin
led mike8-Feb-08 11:16
led mike8-Feb-08 11:16 
GeneralRe: XMLHttpRequest POST message flow. Pin
Neville Franks8-Feb-08 12:14
Neville Franks8-Feb-08 12:14 
Generalcalling code with MFC in non MFC environment Pin
act_x6-Feb-08 8:16
act_x6-Feb-08 8:16 
GeneralRe: calling code with MFC in non MFC environment Pin
Mark Salsbery6-Feb-08 8:48
Mark Salsbery6-Feb-08 8:48 
GeneralRe: calling code with MFC in non MFC environment Pin
act_x6-Feb-08 8:51
act_x6-Feb-08 8:51 

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.