PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > access conflict with (LPVOID)this in CreateWindowEx
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
access conflict with (LPVOID)this in CreateWindowEx

Réponse
 
LinkBack Outils de la discussion
Vieux 24/12/2007, 01h25   #1
Young
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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?
  Réponse avec citation
Vieux 24/12/2007, 01h59   #2
Barry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: access conflict with (LPVOID)this in CreateWindowEx

Young wrote:
> 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.
  Réponse avec citation
Vieux 24/12/2007, 02h07   #3
Young
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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;
};
.....
  Réponse avec citation
Vieux 24/12/2007, 02h17   #4
Barry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: access conflict with (LPVOID)this in CreateWindowEx

Young wrote:
> 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*).
  Réponse avec citation
Vieux 24/12/2007, 02h23   #5
Young
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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?
  Réponse avec citation
Vieux 24/12/2007, 03h57   #6
johanatan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: access conflict with (LPVOID)this in CreateWindowEx

On Dec 23, 9:23 pm, Young <myfriend...@gmail.com> wrote:
> 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.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 12h15.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 1,50933 seconds with 14 queries