Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Update list box from thread (MFC VS2013 C++)

Hello HF,
I would like to update my listbox from a thread, but it is not possible directly so I have to use SendMessage()
Code
void CCMFCApplication1Dlg::OnBnClickedButton1()
{
    AfxBeginThread(MyThreadProc, this);//start thread
}

UINT MyThreadProc(void *pParam)
{
        CString h=L"SomeText";
    CCMFCApplication1Dlg* pThis= (CCMFCApplication1Dlg*)pParam;
        pThis->SendMessage(LB_ADDSTRING, (WPARAM)&h);
    return 0;
}
Please guide me whats the next step, I am sure I need to peek this message from main thread but have no Idea which function to use.
Any help is appreciated.
Thanks
I +3 rep4rep <3
For website hacking, custom malware, private RAT source code, dumps etc contact me on TG: @yealink2
Allocate memory on the heap[not the stack], then pass by reference to your thread using 'pParam'
im using win32 api not mfc but you can try http://forums.codeguru.com/showthread.ph...box-thread
[Image: bitcoin.png] Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by stdioJun 23, 2018 08:40 AM 3 182 Jun 23, 2018 08:40 AM
Last Post: 0xDEAD10CC
[Python] by Ineed2learn2eatJul 13, 2017 10:48 AM 3 230 Jul 13, 2017 10:48 AM
Last Post: Ineed2learn2eat
[C#] by DarrynJan 8, 2017 11:55 AM 13 425 Jan 8, 2017 11:55 AM
Last Post: Darryn