Click here to Skip to main content
15,897,291 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can extract a Return Value from a Stored Procedure with ADO Pin
Jon Hulatt14-May-02 23:54
Jon Hulatt14-May-02 23:54 
GeneralRe: How can extract a Return Value from a Stored Procedure with ADO Pin
youssef15-May-02 2:52
youssef15-May-02 2:52 
GeneralRe: How can extract a Return Value from a Stored Procedure with ADO Pin
Jon Hulatt15-May-02 3:08
Jon Hulatt15-May-02 3:08 
GeneralRe: How can extract a Return Value from a Stored Procedure with ADO Pin
Carlos Antollini15-May-02 3:27
Carlos Antollini15-May-02 3:27 
GeneralRe: How can extract a Return Value from a Stored Procedure with ADO Pin
Jon Hulatt15-May-02 5:14
Jon Hulatt15-May-02 5:14 
GeneralRe: How can extract a Return Value from a Stored Procedure with ADO Pin
Carlos Antollini15-May-02 5:27
Carlos Antollini15-May-02 5:27 
GeneralRe: How can extract a Return Value from a Stored Procedure with ADO Pin
Jon Hulatt15-May-02 5:38
Jon Hulatt15-May-02 5:38 
GeneralRe: How can extract a Return Value from a Stored Procedure with ADO Pin
Carlos Antollini15-May-02 5:48
Carlos Antollini15-May-02 5:48 
GeneralRe: How can extract a Return Value from a Stored Procedure with ADO Pin
Jon Hulatt15-May-02 5:46
Jon Hulatt15-May-02 5:46 
GeneralThreads and server side applications Pin
unknown soldier14-May-02 23:44
unknown soldier14-May-02 23:44 
GeneralRe: Threads and server side applications Pin
Nish Nishant14-May-02 23:55
sitebuilderNish Nishant14-May-02 23:55 
GeneralRe: Threads and server side applications Pin
unknown soldier15-May-02 0:01
unknown soldier15-May-02 0:01 
GeneralMulti-language Pin
14-May-02 23:43
suss14-May-02 23:43 
GeneralRe: Multi-language Pin
Christian Graus15-May-02 3:03
protectorChristian Graus15-May-02 3:03 
GeneralRe: Multi-language Pin
Paul M Watt15-May-02 8:27
mentorPaul M Watt15-May-02 8:27 
GeneralRe: Multi-language Pin
15-May-02 22:57
suss15-May-02 22:57 
GeneralHelp................................ Pin
johny quest14-May-02 23:26
johny quest14-May-02 23:26 
GeneralRe: Help................................ Pin
Jon Hulatt15-May-02 0:12
Jon Hulatt15-May-02 0:12 
GeneralReadFile function Pin
14-May-02 22:54
suss14-May-02 22:54 
GeneralRe: ReadFile function Pin
Niklas L14-May-02 23:24
Niklas L14-May-02 23:24 
GeneralMultiThreaded Progress bar Pin
SamirSood14-May-02 22:36
SamirSood14-May-02 22:36 
GeneralRe: MultiThreaded Progress bar Pin
Jon Hulatt14-May-02 23:57
Jon Hulatt14-May-02 23:57 
GeneralRe: MultiThreaded Progress bar Pin
SamirSood15-May-02 0:14
SamirSood15-May-02 0:14 
GeneralRe: MultiThreaded Progress bar Pin
Todd Smith15-May-02 7:31
Todd Smith15-May-02 7:31 
Generalcode for MultiThreaded Progress bar Pin
Hesham Amin15-May-02 0:45
Hesham Amin15-May-02 0:45 
Hi..
I know two ways to do so:
The first:
to pass a handle of a progress bar to the worker thread and use it as follows

1. Create a helper class that will hold data passed to the worker thread:
<br />
class CData<br />
{<br />
HWND m_hWnd;<br />
//Athor class members..<br />
}<br />

2. In the dialog class create a member variable of type CData:
private:
CData MyData;

3. Before the call to AfxBeginThread() fill members of CData :
<br />
{<br />
//..<br />
//.. some of your code<br />
MyData.m_hWnd=(GetDlgItem(IDC_PROGRESS))->m_hWnd; //where IDC_PROGRESS <br />
<br />
is the ID of the progress bar..<br />
<br />
//now call AfxBeginThread<br />
AfxBeginThread(WorkerFn,&MyData, /*Ather args..*/);<br />
}<br />


4. In the Worker thread function write the following code:
<br />
UINT WorkerFn(LPVOID pData)<br />
{<br />
CData* data=(CData*)pData;<br />
CProgressCtrl* progBar=CWnd::FromHandle(data->m_hWnd);<br />
<br />
//Now use progBar as you wish!<br />
progBar->SetRange(0,100);<br />
//etc<br />
<br />
}<br />


The second:
Pass the handle of the dialog enstead of the progress bar then use:
<br />
::PostMessage(data->m_hWnd,WM_USER+1,0,0)<br />

and handle the message in the dialog..

Send again if you find any problems..

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.