Click here to Skip to main content
15,921,028 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCMainFrame::PreCreateWindow(CREATESTRUCT& cs) Pin
vhalik26-Oct-01 6:06
vhalik26-Oct-01 6:06 
GeneralRe: CMainFrame::PreCreateWindow(CREATESTRUCT& cs) Pin
Fazlul Kabir26-Oct-01 6:36
Fazlul Kabir26-Oct-01 6:36 
GeneralRe: CMainFrame::PreCreateWindow(CREATESTRUCT& cs) Pin
vhalik26-Oct-01 6:39
vhalik26-Oct-01 6:39 
GeneralRe: CMainFrame::PreCreateWindow(CREATESTRUCT& cs) Pin
vhalik26-Oct-01 6:57
vhalik26-Oct-01 6:57 
GeneralRe: CMainFrame::PreCreateWindow(CREATESTRUCT& cs) Pin
Fazlul Kabir26-Oct-01 7:03
Fazlul Kabir26-Oct-01 7:03 
GeneralRe: CMainFrame::PreCreateWindow(CREATESTRUCT& cs) Pin
Fazlul Kabir26-Oct-01 7:40
Fazlul Kabir26-Oct-01 7:40 
GeneralRe: CMainFrame::PreCreateWindow(CREATESTRUCT& cs) Pin
vhalik26-Oct-01 7:50
vhalik26-Oct-01 7:50 
GeneralCritical Section problems... Pin
LukeV26-Oct-01 5:59
LukeV26-Oct-01 5:59 
Here's part of my code:

void CValidateurlDlg::OnButton1()
{
...

for(int i=0;i<m_purllist->GetCount();i++)
{
...
ValUrlMgr.Validate(this, url);
}
}

void CValidateUrlMgr::Validate(CWnd* pWnd, Url UrlInfo)
{
THREADPARMS* ptp = new THREADPARMS;
ptp->UrlInfo = UrlInfo;
ptp->pWnd = pWnd;
ptp->pCriticalSection = &m_cs;
ptp->pEvent = &m_event;

CWinThread* pThread = AfxBeginThread (ThreadFunc, ptp,
THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED);

::DuplicateHandle (GetCurrentProcess (),
pThread->m_hThread, GetCurrentProcess (), &m_hThread,
0, FALSE, DUPLICATE_SAME_ACCESS);

pThread->ResumeThread ();
}


//////////////////////////

UINT ThreadFunc(LPVOID pParam)
{
...

THREADPARMS* ptp = (THREADPARMS*) pParam;
Url UrlInfo = ptp->UrlInfo;
CCriticalSection* pCriticalSection = ptp->pCriticalSection;
CEvent* pKillEvent = ptp->pEvent;
CWnd* pWnd = ptp->pWnd;
delete ptp;



pCriticalSection->Lock ();

Doing some stuff....

pCriticalSection->Unlock ();

return 0;
}

If I dont comment the Lock() / Unlock() lines, I get an Unhandled error message. Not using them = works great! What's the use of critical sections then???Confused | :confused:

thanks!Smile | :)
GeneralRe: Critical Section problems... Pin
Joaquín M López Muñoz26-Oct-01 7:16
Joaquín M López Muñoz26-Oct-01 7:16 
GeneralRe: Critical Section problems... Pin
LukeV26-Oct-01 7:49
LukeV26-Oct-01 7:49 
GeneralRe: Critical Section problems... Pin
Joaquín M López Muñoz26-Oct-01 8:30
Joaquín M López Muñoz26-Oct-01 8:30 
GeneralRe: Critical Section problems... Pin
Tim Deveaux26-Oct-01 10:20
Tim Deveaux26-Oct-01 10:20 
GeneralRe: Critical Section problems... Pin
HintiFlo23-Jan-02 1:12
HintiFlo23-Jan-02 1:12 
QuestionHow to set a bitmap as a dialog background ? Pin
adara26-Oct-01 4:58
adara26-Oct-01 4:58 
AnswerRe: How to set a bitmap as a dialog background ? Pin
Joaquín M López Muñoz26-Oct-01 5:48
Joaquín M López Muñoz26-Oct-01 5:48 
Generalthanx Pin
adara26-Oct-01 12:19
adara26-Oct-01 12:19 
Generaloverload resolution in VC 6.0 Pin
Patrick D Owens26-Oct-01 4:46
Patrick D Owens26-Oct-01 4:46 
GeneralRe: overload resolution in VC 6.0 Pin
Chris Losinger26-Oct-01 4:55
professionalChris Losinger26-Oct-01 4:55 
GeneralRe: overload resolution in VC 6.0 Pin
Patrick D Owens26-Oct-01 5:16
Patrick D Owens26-Oct-01 5:16 
GeneralRe: overload resolution in VC 6.0 Pin
Joaquín M López Muñoz26-Oct-01 6:53
Joaquín M López Muñoz26-Oct-01 6:53 
GeneralRe: overload resolution in VC 6.0 Pin
Patrick D Owens26-Oct-01 9:16
Patrick D Owens26-Oct-01 9:16 
GeneralFilling CListCtrl from dll problem... Pin
26-Oct-01 4:39
suss26-Oct-01 4:39 
GeneralRe: Filling CListCtrl from dll problem... Pin
Joaquín M López Muñoz26-Oct-01 7:27
Joaquín M López Muñoz26-Oct-01 7:27 
GeneralAligning text Pin
Andrew Stampor26-Oct-01 3:57
Andrew Stampor26-Oct-01 3:57 
General2-d Graphics Pin
Chambers26-Oct-01 3:52
Chambers26-Oct-01 3:52 

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.