Article View: borland.public.cppbuilder.nativeapi
Article #8929Re: SetClassLong problems
From: Lynn Morrison
Date: Mon, 06 Sep 2004 01:38
Date: Mon, 06 Sep 2004 01:38
40 lines
2337 bytes
2337 bytes
When I run it, I get an access violation and my app shuts down.... can you
look at my code below? I get it on the call to CreateWindowEx... The
register class seems ok...
Thanks, Lynn
bool ClassRegistered;
TWndClassEx C;
ATOM A;
MCustomSocketWindowClass.cbSize = sizeof(TWndClassEx);
MCustomSocketWindowClass.style = 0;
MCustomSocketWindowClass.cbClsExtra = sizeof(long);
MCustomSocketWindowClass.cbWndExtra = 0;
MCustomSocketWindowClass.hInstance = HInstance;
MCustomSocketWindowClass.hIcon = 0;
MCustomSocketWindowClass.hCursor = 0;
MCustomSocketWindowClass.hbrBackground;
MCustomSocketWindowClass.lpszMenuName = NULL;
MCustomSocketWindowClass.lpszClassName = "MCustomSocketWindowClass";
// Just use C as a temp to fetch the info
ClassRegistered =
GetClassInfoEx(HInstance,MCustomSocketWindowClass.lpszClassName,&C);
if (!ClassRegistered) {
A = RegisterClassEx(&MCustomSocketWindowClass);
if(!A) {
FErrorCode = GetLastError();
return 0;
}
}
FHandle =
CreateWindowEx(WS_EX_TOOLWINDOW,"MCustomSocketWindowClass","",WS_POPUP,0,0,0
,0,0,0,HInstance,NULL);
if(FHandle == NULL) {
return 0;
}
FWndProc = MakeObjectInstance(LocalWindProc);
FOldWndProc = SetWindowLong(FHandle, GWL_WNDPROC, (LONG)FWndProc);
SetWindowLong(FHandle, GWL_USERDATA, (LONG) this);
return FHandle;
Technical Details
Message-ID:
<413bbf9c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4138cc6a@newsgroups.borland.com> <4138da54$1@newsgroups.borland.com> <4138ff19@newsgroups.borland.com> <413904eb$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ce81aceba334526c X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Lynn Morrison" <Cranky@__whisp.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4138cc6a@newsgroups.borland.com> <4138da54$1@newsgroups.borland.com> <4138ff19@newsgroups.borland.com> <413904eb$1@newsgroups.borland.com> Subject: Re: SetClassLong problems Date: Sun, 5 Sep 2004 21:38:39 -0400 Lines: 47 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 NNTP-Posting-Host: 209.202.121.7 Message-ID: <413bbf9c$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1094434716 209.202.121.7 (5 Sep 2004 18:38:36 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail