Click here to Skip to main content
15,919,340 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Message Relfection Pin
Shog91-Apr-02 17:57
sitebuilderShog91-Apr-02 17:57 
Generalpassword protect folder Pin
Steven Richardson1-Apr-02 11:03
Steven Richardson1-Apr-02 11:03 
GeneralRe: password protect folder Pin
dazinith1-Apr-02 11:23
dazinith1-Apr-02 11:23 
GeneralRe: password protect folder Pin
Steven Richardson1-Apr-02 11:27
Steven Richardson1-Apr-02 11:27 
GeneralRe: password protect folder Pin
dazinith1-Apr-02 11:33
dazinith1-Apr-02 11:33 
GeneralRe: password protect folder Pin
alex.barylski1-Apr-02 15:52
alex.barylski1-Apr-02 15:52 
GeneralRe: password protect folder Pin
Mukkie2-Apr-02 5:54
Mukkie2-Apr-02 5:54 
GeneralMultithreading Pin
RK_20001-Apr-02 10:10
RK_20001-Apr-02 10:10 
I am trying to implement a simple multithreading in my code. I have a dialog box where the user can search for stuff and get the result back in list control. However, if the search result takes too long, I would like to allow my user to stop the search by clicking on Cancel.

I have added a structure to my header which contains a handle to calling window and a few parameters that I need to pass between the worker thread and the display.

On the cpp side of things, I start my threading function when the user presses the search button:

HANDLE hHandle = ::AfxBeginThread(ThreadFunc, m_ptp);

Where m_ptp is defined as a pointer to my threading structure and Threadfun is my threading function.

Inside of my ThreadFunc, I make a query to the database and this query can take significant amount of time at times. I have tried with many different ways of putting an hour glass around this call, but it never shows up. FOr instance, I have tried the following and it doesn't work:

UINT ThreadFunc(LPVOID pParam)
{
THREADPARMS *ptp = (THREADPARMS*) pParam;
ptp->pWnd->BeginWaitCursor();
// Database call
ptp->pWnd->EndWaitCursor();

::PostMessage(hWnd, WM_USER_THREAD_FINISHED, 0, 0);

}

I have also tried starting the cursor in the calling function and it hasn't worked out for me. Any ideas?
GeneralRe: Multithreading Pin
Tim Smith1-Apr-02 10:20
Tim Smith1-Apr-02 10:20 
GeneralRe: Multithreading Pin
Paul M Watt1-Apr-02 10:33
mentorPaul M Watt1-Apr-02 10:33 
GeneralRe: Multithreading Pin
lucy9-Apr-02 9:29
lucy9-Apr-02 9:29 
GeneralRe: Multithreading Pin
Bill Wilson1-Apr-02 12:47
Bill Wilson1-Apr-02 12:47 
GeneralTFTP Server and Windows Sockets Pin
1-Apr-02 9:53
suss1-Apr-02 9:53 
GeneralRe: TFTP Server and Windows Sockets Pin
Joaquín M López Muñoz1-Apr-02 10:13
Joaquín M López Muñoz1-Apr-02 10:13 
GeneralRe: TFTP Server and Windows Sockets Pin
1-Apr-02 10:20
suss1-Apr-02 10:20 
GeneralRe: TFTP Server and Windows Sockets Pin
Dave_1-Apr-02 13:48
Dave_1-Apr-02 13:48 
GeneralFtp Upload Pin
Nnamdi Onyeyiri1-Apr-02 9:46
Nnamdi Onyeyiri1-Apr-02 9:46 
GeneralRe: Ftp Upload Pin
dazinith1-Apr-02 9:51
dazinith1-Apr-02 9:51 
GeneralRe: Ftp Upload Pin
Bill Wilson1-Apr-02 9:58
Bill Wilson1-Apr-02 9:58 
GeneralRe: Ftp Upload Pin
Nnamdi Onyeyiri1-Apr-02 23:54
Nnamdi Onyeyiri1-Apr-02 23:54 
Questionclistctrl question? Pin
jafrazee1-Apr-02 8:16
jafrazee1-Apr-02 8:16 
AnswerRe: clistctrl question? Pin
jafrazee1-Apr-02 9:17
jafrazee1-Apr-02 9:17 
QuestionCommand line parser for ATL or WTL? Pin
Todd Smith1-Apr-02 8:08
Todd Smith1-Apr-02 8:08 
AnswerRe: Command line parser for ATL or WTL? Pin
Tim Smith1-Apr-02 8:14
Tim Smith1-Apr-02 8:14 
AnswerRe: Command line parser for ATL or WTL? Pin
Chris Losinger1-Apr-02 8:22
professionalChris Losinger1-Apr-02 8:22 

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.