Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2004

Tip: Looking for answers? Try searching our database.

RegisterClassEx problems...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mrmrcoleman - 29 Nov 2004 12:19 GMT
Hello.

When I try to register my windows class using RegisterClassEx in my program
I get an error which GetLastError tells me is error 120.

This apparently is:

This function is not supported on this system.

I find this confusing as an identical call in one of the programs in the SDK
samples works fine? The only difference between the two is that my project is
built using UNICODE. Could this affect the outcome of function calls with
identical input?

This is the code:

LRESULT WINAPI MsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;

case WM_PAINT:
case WM_TIMER:
case WM_GRAPHNOTIFY:
case WM_LBUTTONDOWN:
case WM_NEXTSCREEN:
case WM_STARTSCREEN:
HandleEvent(msg, wParam, lParam);
break;

case WM_DISPLAYCHANGE:
break;

case WM_CHAR:
{
if(wParam == VK_ESCAPE)
{
PostMessage(hWnd, WM_CLOSE, 0, 0);
}
else
{
PostMessage(hWnd, WM_NEXTSCREEN, 0, 0);
}
}
break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}

HRESULT MakeWindow(HINSTANCE hInstance)
{
WNDCLASSEX wc = {sizeof(WNDCLASSEX),
CS_CLASSDC,
MsgProc,
0L,
GetModuleHandle(NULL),
NULL,
NULL,
NULL,
NULL,
L"Star Chart",
NULL};

RegisterClassEx(&wc);
}

... rest of windows code ...

How can it be that this identical code works fine in one project and not in
the other?

Any ideas would be greatly appreciated because I have been at this for 6
hours now with no success...

If anybody needs to see any other code I would be glad to post it for you, I
really just don't know what to try now...

edit:

I have now found that it is the GetModuleHandle() call that is producing the
error? Can this be right?

Thanks in advance.

Mark Coleman
David Lowndes - 29 Nov 2004 16:21 GMT
>When I try to register my windows class using RegisterClassEx in my program
>I get an error which GetLastError tells me is error 120.
[quoted text clipped - 7 lines]
>built using UNICODE. Could this affect the outcome of function calls with
>identical input?

Yes, which OS are you testing on? Win9x OS's are unlikely to have an
implementation for the wide character version of the function.

Dave
Signature

MVP VC++ FAQ: http://www.mvps.org/vcfaq

mrmrcoleman - 29 Nov 2004 16:41 GMT
Oh David... 22 hours I have been on this little bastard... Incorrect field
entries I thought, a problem somewhere else in the code I thought! ;)

Thank you very much, you have made me a happy happy man.

Mark Coleman

> >When I try to register my windows class using RegisterClassEx in my program
> >I get an error which GetLastError tells me is error 120.
[quoted text clipped - 12 lines]
>
> Dave
David Lowndes - 29 Nov 2004 17:50 GMT
>Oh David... 22 hours I have been on this little bastard... Incorrect field
>entries I thought, a problem somewhere else in the code I thought! ;)
>
>Thank you very much, you have made me a happy happy man.

So you are testing on Win9x?

Note that you can use the Unicode version if you use MSLU:

"Windows 95/98/Me: RegisterClassExW is supported by the Microsoft®
Layer for Unicode (MSLU).
"

Dave
Signature

MVP VC++ FAQ: http://www.mvps.org/vcfaq


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.