access conflict with (LPVOID)this in CreateWindowEx | | |
This makes me very puzzled and angry.Please have a look at :
.......
.......
_hSelf=::CreateWindowEx(
WS_EX_ACCEPTFILES,
(LPCWSTR)_className,\
(LPCWSTR)"Web Studio 2008",\
WS_OVERLAPPEDWINDOW,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
_hParent,\
NULL,\
_hInst,\
(LPVOID)this);
........
........
The code is compiled and linked successly under VS2005.But ever time
it runs to "(LPVOID)this" in the function "CreateWindowEx" ,an
exception occurs which say
0x00000000 Department untreated anomaly: 0xC0000005: reading position
0 x00000000 visit when conflict
in the VS 2005.
Why?Why?WWWWW? | | | | re: access conflict with (LPVOID)this in CreateWindowEx
Young wrote: Quote:
This makes me very puzzled and angry.Please have a look at :
......
......
_hSelf=::CreateWindowEx(
WS_EX_ACCEPTFILES,
(LPCWSTR)_className,\
(LPCWSTR)"Web Studio 2008",\
WS_OVERLAPPEDWINDOW,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
_hParent,\
NULL,\
_hInst,\
(LPVOID)this);
.......
.......
The code is compiled and linked successly under VS2005.But ever time
it runs to "(LPVOID)this" in the function "CreateWindowEx" ,an
exception occurs which say
0x00000000 Department untreated anomaly: 0xC0000005: reading position
0 x00000000 visit when conflict
in the VS 2005.
Your code is not detailed enough, what kind of class object does "this"
points to?
And I suspect that this is off-topic, better post it to windows
programming NG. | | | | re: access conflict with (LPVOID)this in CreateWindowEx
Oh,I'm sorry I'm new to this usernet.I think the bug concerned with
cpp,so...And if it can't be solved here ,I will go windows programming
NG. But please do me a favor, thanks.
......
class WebStudio:public Window
{
public:
WebStudio():Window(){};
//,_mainWindowStatus(0),_pMainSplitter(NULL),_hTabPo pupMenu(NULL),_hTabPopupDropMenu(NULL),_pEditView( NULL),_pDocTab(NULL)
{};
void init(HINSTANCE,HWND,const char*);
bool doOpen(const char *fileName);
static const char * getClassName() {
return _className;
};
private:
static const char _className[32];
};
.....
class Window
{
public:
Window():_hSelf(NULL),_hParent(NULL),_hInst(NULL){ };
virtual ~Window(){};
virtual void init(HINSTANCE hInst, HWND parent)
{
_hInst = hInst;
_hParent = parent;
}
protected:
HINSTANCE _hInst;
HWND _hParent;
HWND _hSelf;
};
..... | | | | re: access conflict with (LPVOID)this in CreateWindowEx
Mm,after I send the last message,I suddenly notice that the last param
in CreateWindowEx should point to a CREATESTRUCT struct.But if so, I
have no idea to make it point to the CREATESTRUCT struct.How to do
that? | | | | re: access conflict with (LPVOID)this in CreateWindowEx
Young wrote: Quote:
Oh,I'm sorry I'm new to this usernet.I think the bug concerned with
cpp,so...And if it can't be solved here ,I will go windows programming
NG. But please do me a favor, thanks.
.....
class WebStudio:public Window
{
public:
WebStudio():Window(){};
//,_mainWindowStatus(0),_pMainSplitter(NULL),_hTabPo pupMenu(NULL),_hTabPopupDropMenu(NULL),_pEditView( NULL),_pDocTab(NULL)
{};
>
void init(HINSTANCE,HWND,const char*);
bool doOpen(const char *fileName);
static const char * getClassName() {
return _className;
};
private:
static const char _className[32];
};
....
class Window
{
public:
Window():_hSelf(NULL),_hParent(NULL),_hInst(NULL){ };
virtual ~Window(){};
virtual void init(HINSTANCE hInst, HWND parent)
{
_hInst = hInst;
_hParent = parent;
}
>
protected:
HINSTANCE _hInst;
HWND _hParent;
HWND _hSelf;
};
....
Well, after I looked at the CreateWindowEx API on MSDN,
the last parameter requires a pointer to "CREATESTRUCT", "this " is
absolutely not typeof(CREATESTRUCT*). | | | | re: access conflict with (LPVOID)this in CreateWindowEx
On Dec 23, 9:23 pm, Young <myfriend...@gmail.comwrote: Quote:
Mm,after I send the last message,I suddenly notice that the last param
in CreateWindowEx should point to a CREATESTRUCT struct.But if so, I
have no idea to make it point to the CREATESTRUCT struct.How to do
that?
Declare a struct like so:
CREATESTRUCT cs;
then fill in the members of cs like:
cs.x = y;
cs.a = b;
....
then pass "&cs" as the last param. | | | | re: access conflict with (LPVOID)this in CreateWindowEx
I did that,such as:
.....
CREATESTRUCT p;
p.cx=0;
p.cy=0;
p.dwExStyle=0;
p.hInstance=hInst;
p.hMenu=NULL;
p.hwndParent=NULL;
p.lpCreateParams=NULL;
p.lpszClass=(LPCWSTR)_className;
p.lpszName=TEXT("SB");
p.style=NULL;
p.x=0;
p.y=0;
_hSelf=::CreateWindowEx(
WS_EX_ACCEPTFILES,\
(LPCWSTR)_className,\
(LPCWSTR)"Web Studio 2008",\
WS_OVERLAPPEDWINDOW,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
_hParent,\
NULL,\
_hInst,\
(LPVOID)&p);
.....
But the same conflict still exists.
Where's the problem ?? | | | | re: access conflict with (LPVOID)this in CreateWindowEx
On Dec 23, 11:15 pm, Young <myfriend...@gmail.comwrote: Quote:
I did that,such as:
....
CREATESTRUCT p;
p.cx=0;
p.cy=0;
p.dwExStyle=0;
p.hInstance=hInst;
p.hMenu=NULL;
p.hwndParent=NULL;
p.lpCreateParams=NULL;
p.lpszClass=(LPCWSTR)_className;
p.lpszName=TEXT("SB");
p.style=NULL;
p.x=0;
p.y=0;
_hSelf=::CreateWindowEx(
WS_EX_ACCEPTFILES,\
(LPCWSTR)_className,\
(LPCWSTR)"Web Studio 2008",\
WS_OVERLAPPEDWINDOW,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
CW_USEDEFAULT,\
_hParent,\
NULL,\
_hInst,\
(LPVOID)&p);
....
But the same conflict still exists.
Where's the problem ??
One other problem I see is that your constant string "Web Studio 2008"
ought to be:
L"Web Studio 2008"
you could be causing a runaway scan since the null terminator of the
first is only one byte and the API might be looking for a double-byte
zero. |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,471 network members.
|