Click here to Skip to main content
15,922,630 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multiple languages in single resource file Pin
Blake Miller14-Jun-05 9:19
Blake Miller14-Jun-05 9:19 
General[out] parameters for ActiveX control interface Pin
Ian Bowler14-Jun-05 6:31
Ian Bowler14-Jun-05 6:31 
GeneralRe: [out] parameters for ActiveX control interface Pin
Ian Bowler14-Jun-05 8:36
Ian Bowler14-Jun-05 8:36 
Generalbizarre asm problem Pin
heebiejeebies14-Jun-05 5:19
heebiejeebies14-Jun-05 5:19 
GeneralCOleDateTime AddDays() Pin
DanYELL14-Jun-05 4:57
DanYELL14-Jun-05 4:57 
GeneralRe: COleDateTime AddDays() Pin
David Crow14-Jun-05 2:10
David Crow14-Jun-05 2:10 
GeneralRe: COleDateTime AddDays() Pin
DanYELL14-Jun-05 5:56
DanYELL14-Jun-05 5:56 
GeneralRe: COleDateTime AddDays() Pin
David Crow14-Jun-05 3:03
David Crow14-Jun-05 3:03 
GeneralConvert CString to CTime / COleDateTime Pin
P-Rex14-Jun-05 4:39
P-Rex14-Jun-05 4:39 
GeneralRe: Convert CString to CTime / COleDateTime Pin
David Crow14-Jun-05 2:07
David Crow14-Jun-05 2:07 
GeneralRe: Convert CString to CTime / COleDateTime Pin
P-Rex14-Jun-05 5:17
P-Rex14-Jun-05 5:17 
GeneralRe: Convert CString to CTime / COleDateTime Pin
David Crow14-Jun-05 2:22
David Crow14-Jun-05 2:22 
GeneralRe: Convert CString to CTime / COleDateTime Pin
DavidR_r14-Jun-05 8:00
DavidR_r14-Jun-05 8:00 
GeneralRe: Convert CString to CTime / COleDateTime Pin
David Crow14-Jun-05 8:04
David Crow14-Jun-05 8:04 
GeneralRe: Convert CString to CTime / COleDateTime Pin
JWood14-Jun-05 6:03
JWood14-Jun-05 6:03 
GeneralRe: Convert CString to CTime / COleDateTime Pin
P-Rex14-Jun-05 20:22
P-Rex14-Jun-05 20:22 
Questionmake stacktrace or what calls DllCanUnloadNow? Pin
ThinkingPrometheus14-Jun-05 4:21
ThinkingPrometheus14-Jun-05 4:21 
GeneralLooking for Dialog Manager component for VC++ 7. Pin
mlatimer14-Jun-05 4:00
mlatimer14-Jun-05 4:00 
QuestionHow to run a thread as a member function of a class? Pin
Eytukan14-Jun-05 3:45
Eytukan14-Jun-05 3:45 
AnswerRe: How to run a thread as a member function of a class? Pin
Bob Stanneveld14-Jun-05 4:08
Bob Stanneveld14-Jun-05 4:08 
GeneralRe: How to run a thread as a member function of a class? Pin
Eytukan14-Jun-05 1:43
Eytukan14-Jun-05 1:43 
GeneralRe: How to run a thread as a member function of a class? Pin
Bob Stanneveld14-Jun-05 1:49
Bob Stanneveld14-Jun-05 1:49 
GeneralRe: How to run a thread as a member function of a class? Pin
Eytukan14-Jun-05 1:55
Eytukan14-Jun-05 1:55 
GeneralRe: How to run a thread as a member function of a class? Pin
Eytukan14-Jun-05 2:06
Eytukan14-Jun-05 2:06 
Though it looks primitive.. please dont ignore..
see the class test with its data member "text" and function "disp()"
i wanna access it from the Thread1 and Thread2..

#include <afxwin.h>
#include<afxext.h>
#include<stdio.h>

char fValue[10];
CWinThread *pThread1,*pThread2;

UINT Thread1(LPVOID lp)
{
CClientDC cdc(AfxGetApp()->m_pMainWnd);
int j=250;
for(int i=1;i<=600;i++)
{
cdc.TextOut(i,j,"Thread1");
cdc.SetBkColor(0x0009999);
Sleep(6);
strcpy(fValue,"Thread1");
Text = fValue; ///// I WANT TO ACCESS THE DATA MEMBER "TEXT" FROM CLASS TEST//
cdc.TextOut(500,500,Text);
}
disp();/// HOW TO ACCESS MEMBER FUNCTION "DISP" FROM CLASS TEST//
return 0;
}


UINT Thread2(LPVOID lp)
{

CClientDC cdc(AfxGetApp()->m_pMainWnd);
cdc.SetBkColor(0x0990009);
int j=280;
for(int i=1;i<=600;i++)
{
cdc.TextOut(i,j,"Thread1");
Sleep(5);
strcpy(fValue,"Thread2");
Text = fValue;///// I WANT TO ACCESS THE DATA MEMBER "TEXT" FROM CLASS "TEST"//
cdc.TextOut(500,500,Text);

}

disp();/// HOW TO ACCESS MEMBER FUNCTION "DISP" FROM CLASS TEST//
return 0;
}



class test
{
public:

CString Text;

void disp()
{
AfxMessageBox(Text);
}
};



CMenu cm;

class MyWindow: public CFrameWnd , public test
{
public:
MyWindow()
{
Create(0,"Threads of MFC");
}

void q()
{
PostQuitMessage(0);
}

void Threads()
{
AfxMessageBox("Starting....");
}
DECLARE_MESSAGE_MAP()
};

BEGIN_MESSAGE_MAP(MyWindow,CFrameWnd)
END_MESSAGE_MAP()



class MyWin:public CWinApp
{
public :

BOOL InitInstance()
{
MyWindow *x;
x=new MyWindow;
m_pMainWnd=x;


pThread1=AfxBeginThread(Thread1,x);
pThread2=AfxBeginThread(Thread2,x);

x->ShowWindow(SW_SHOWMAXIMIZED);
return 1;
}
};
MyWin App;


thanks bob,
vivek
GeneralRe: How to run a thread as a member function of a class? Pin
David Crow14-Jun-05 2:20
David Crow14-Jun-05 2:20 

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.