Click here to Skip to main content
15,914,323 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: List box Help Pin
thatsme_cool5-Apr-06 18:54
thatsme_cool5-Apr-06 18:54 
AnswerRe: List box Help Pin
Nibu babu thomas5-Apr-06 18:56
Nibu babu thomas5-Apr-06 18:56 
QuestionSendInput to Inactive Windows Possible? Pin
Coxen5-Apr-06 11:34
Coxen5-Apr-06 11:34 
AnswerRe: SendInput to Inactive Windows Possible? Pin
Ryan Binns5-Apr-06 18:37
Ryan Binns5-Apr-06 18:37 
QuestionMaintaining program control while in a loop... Pin
aquawicket5-Apr-06 11:25
aquawicket5-Apr-06 11:25 
AnswerRe: Maintaining program control while in a loop... Pin
Blake Miller5-Apr-06 13:04
Blake Miller5-Apr-06 13:04 
GeneralRe: Maintaining program control while in a loop... Pin
aquawicket6-Apr-06 9:50
aquawicket6-Apr-06 9:50 
GeneralRe: Maintaining program control while in a loop... Pin
Blake Miller6-Apr-06 10:49
Blake Miller6-Apr-06 10:49 
You can not use the MFC control placeholders from the thread.

Instead, it is better to use the listbox control's window handle directly to add elements to the listbox.

The LPVOID pParam passed to thread could be a data structure, in that data structure, one of the fields could be the window handle for the list box control.

So you call

typedef struct {
HWND hListBox;
} MYSTRUCT ;

MYSTRUCT MyThreadInfo;

MyThreadInfo.hListbox = m_ListBox1.m_hWnd;

then

AfxBeginThread(MyThread, &MyThreadInfo);

UINT MyThread( LPVOID pParam )
{
MYSTRUCT* pMyThreadInfo = (MYSTRUCT*)pParam;

while( RunThread ){
if( inputdetected ){
SendMessage(pMyThreadInfo->hListbox, LB_ADDSTRING, 0, (LPARAM)"input detected");
}
}
return 0; // thread completed successfully
}



People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
GeneralThanks :) Pin
aquawicket6-Apr-06 11:42
aquawicket6-Apr-06 11:42 
QuestionError R6034: XP Manifest w/ CreateProcess() Pin
fire fly5-Apr-06 10:22
fire fly5-Apr-06 10:22 
QuestionRe: Error R6034: XP Manifest w/ CreateProcess() Pin
David Crow5-Apr-06 10:38
David Crow5-Apr-06 10:38 
AnswerRe: Error R6034: XP Manifest w/ CreateProcess() Pin
fire fly5-Apr-06 15:23
fire fly5-Apr-06 15:23 
QuestionDirectory Control Pin
jonesap55-Apr-06 8:21
jonesap55-Apr-06 8:21 
AnswerRe: Directory Control Pin
Waldermort5-Apr-06 8:27
Waldermort5-Apr-06 8:27 
GeneralRe: Directory Control Pin
David Crow5-Apr-06 8:37
David Crow5-Apr-06 8:37 
GeneralRe: Directory Control Pin
Waldermort5-Apr-06 8:40
Waldermort5-Apr-06 8:40 
AnswerRe: Directory Control Pin
David Crow5-Apr-06 8:37
David Crow5-Apr-06 8:37 
AnswerRe: Directory Control Pin
gamitech5-Apr-06 13:03
gamitech5-Apr-06 13:03 
QuestionPopulating web based default email client fields Pin
tnguyen4445-Apr-06 8:13
tnguyen4445-Apr-06 8:13 
AnswerRe: Populating web based default email client fields Pin
David Crow5-Apr-06 8:34
David Crow5-Apr-06 8:34 
GeneralRe: Populating web based default email client fields Pin
tnguyen4445-Apr-06 8:55
tnguyen4445-Apr-06 8:55 
GeneralRe: Populating web based default email client fields Pin
David Crow5-Apr-06 9:07
David Crow5-Apr-06 9:07 
GeneralRe: Populating web based default email client fields Pin
tnguyen4445-Apr-06 10:23
tnguyen4445-Apr-06 10:23 
GeneralRe: Populating web based default email client fields Pin
David Crow5-Apr-06 10:35
David Crow5-Apr-06 10:35 
GeneralRe: Populating web based default email client fields Pin
tnguyen4445-Apr-06 11:28
tnguyen4445-Apr-06 11:28 

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.