|
there's only one problem
error C2065: 'ReadDirectoryChangesW' : undeclared identifier
after i do the follow
Header Declared in WinBase.h; include Windows.h.
it's still have the problem
|
|
|
|
|
thank you
i forgot to #define _WIN32_WINNT 0x400
the problem solved
|
|
|
|
|
Can you show your code and it seems you forgot to include header file or your program?
|
|
|
|
|
the Thread function is global function
CCriticalSection m_Sec; is global too
now after include atlbase.h
only error C2065: 'ReadDirectoryChangesW' : undeclared identifier
|
|
|
|
|
i did nothing
the code dosen't changed
but the m_list problem solved
Amazing
|
|
|
|
|
problem solved with #define _WIN32_WINNT 0x400
thank you for help me so much time and give me a lot usful advises
|
|
|
|
|
It seems your problem solved and I arrived late,but I glad it solved.
|
|
|
|
|
Basix.
1.include atlbase.h
2.You cannot access member variables from a static thread function. Pass the this(Dlg) pointer into the thread param and access it inside the function or do it in one of the 100 ways.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
after include atlbase.h
only error C2065: 'ReadDirectoryChangesW' : undeclared identifier
do i miss other head file??
|
|
|
|
|
define this :
#define _WIN32_WINNT 0x400
in stdafx.h.
What OS are you using?
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
windows XP
thank you so much
#define _WIN32_WINNT 0x400 what's that for
i am new and my English is not so good
|
|
|
|
|
Few APIs would be supported to specific OS. That's the OS version.
Windows NT 4.0 -> _WIN32_WINNT =0x0400.
The error is gone or not?
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
it's already gone
thank you
|
|
|
|
|
Oh ok ok
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
i expect that the threadFunction improperly tries to access the list object, etc which are own by the main thread.
pass the this value to the param field of beginthread, then receive it inside your functionbloc and cast it to a main dialog pointer by wich you access things.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
He is not even able to compile the code? Read the question carefully again.
-Saurabh
|
|
|
|
|
1- I should be wrong
2- I should be always treated and faced with interventions like yours
3- I should suffer from the most punishment for persisting not to clear my behaviour and at least accept the fact that if I have to tell someone something, or that if I have to help him, then I have to speak properly, explain with evidence , and not throw an answer or a solution in a way that make the person not believe in it or hesistate to believe that it will solve his problem.
4- I have problem with myself as you can see becvuase you are intelligent.
5- I am correct (not to your disappointment of course).
So here I created a sample MFC Dlg project, and I created a memberfunction of the main dialog class (CThreadQuestionDlg) which is
passed as parameter to teh createThread function somewhere in order to be executed by that would-be-thread.
I coded the function such it access the m_list member of the dialog class in two ways :
#pragma once
#include "afxcmn.h"
class CThreadQuestionDlg : public CDialog
{
public:
CThreadQuestionDlg(CWnd* pParent = NULL);
enum { IDD = IDD_THREADQUESTION_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
HICON m_hIcon;
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CListCtrl m_list;
static UINT ThreadProc(LPVOID pParam)
{
CThreadQuestionDlg* pMe = reinterpret_cast<CThreadQuestionDlg*>(pParam);
pMe->m_list.DeleteAllItems();
return 0;
}
void StartThread()
{
AfxBeginThread(ThreadProc, this);
}
};
Look at the code and you will find two particular lines within the ThreadProc member.
If we keep things as they are there are no problems. But if We uncomment the case number 2 and we comment the case number 1
Then soon when we try to compile we get C2228 compilation code errors !
1>Compiling...
1>ThreadQuestionDlg.cpp
1>c:\documents and settings\administrateur\mes documents\visual studio 2005\projects\threadquestion\threadquestion\threadquestiondlg.h(44) : error C2228: left of '.DeleteAllItems' must have class/struct/union
1>Generating Code...
1>Compiling...
1>ThreadQuestion.cpp
1>c:\documents and settings\administrateur\mes documents\visual studio 2005\projects\threadquestion\threadquestion\threadquestiondlg.h(44) : error C2228: left of '.DeleteAllItems' must have class/struct/union
1>Generating Code...
1>Build log was saved at "file://c:\Documents and Settings\Administrateur\Mes documents\Visual Studio 2005\Projects\ThreadQuestion\ThreadQuestion\Debug\BuildLog.htm"
1>ThreadQuestion - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Unless we use the first case which is the solution to the problem.
Please can you help with a profiling tool ? I have a problem profiling specific regions of code in C++ unmanaged. And indeed I am unsatisfied by exhausitive profiler toools like Intel Vtune which collect evry performance data of my running program.
I rather seek something very particular very simpler. I only need to tell the profiler to measure the duratipon spent betwen two tags or three or 4. Then he has to comute the cumlulative duration and report me sort of pourcentages. like time spend in code block K represents 20% of the sepcified code block L.
Becuase i want to apply the dichotomic principle in tuning very complicate functions.
Thnk you in advance.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
Wow you have some serious issues!!!
hINTModuleState wrote: CListCtrl m_list; // static UINT ThreadProc(LPVOID pParam) { CThreadQuestionDlg* pMe = reinterpret_cast<cthreadquestiondlg*>(pParam); pMe->m_list.DeleteAllItems(); /*This is the case number 1*/ //m_list.DeleteAllItems(); /*This is the case number 2*/ return 0; } void StartThread() { AfxBeginThread(ThreadProc, this); }
Uncommenting second case will lead to compiling error because ThreadProc is a static function and a static function can only access static members of a class. Since m_list is not a static variable you cannot access it directly from with the function.
For you profiling needs try http://www.codeproject.com/KB/datetime/perftimer.aspx[^]
Saurabh
|
|
|
|
|
yes apparently i have serious issues.
i'd better start find a book or pdf and learn all the keywords and langage basis before making any judgement on any thing.
thank you for the profiler link.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
problem solved with #define _WIN32_WINNT 0x400
thank you all
|
|
|
|
|
No comment.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
I need a way to launch an external application (like notepad.exe) from a click within the page displayed in the CHTMLVIEW of an MFC application. I accomplished this with wscript.shell.run in javascript but I get an annoying prompt every time with a yes or no for whether i want to allow the active X content to run. ALL the internet explorer script and active X stuff has been set to "Enable" and i still get this. Is there some better way to launch an application based on a link in the webpage that won't prompt the user each time?
|
|
|
|
|
1) no need to repost, it's not a chat
2) no need to make multiple accounts either
|
|
|
|
|
What a jack*ss. Like we can't tell the SAME QUESTION was asked one right after another with two names.
|
|
|
|
|
uhhh what ?
modified on Thursday, June 12, 2008 2:32 AM
|
|
|
|