Solved

RegisterClass Function Returns Error Code 1410

Posted on 2006-06-19
3
1,746 Views
Last Modified: 2012-06-22
I am running a c program that returns 1410 in this code snippet.

// Register the window class and return success/failure code.
ret = RegisterClass(&wndclass);
printf("return from RegisterClass = %d\n", ret);

ret1 = GetLastError();
printf ("return from GetLastError = %d\n", ret1);

What should I do to resolve this error? Value of ret1 is 1410.

also, since GetLastError returns DWORD I’m not sure the format specifier I’m using in the printf statement (%d) is correct.
0
Comment
Question by:shekhar_shashi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
cookre earned 75 total points
ID: 16938830
First off, use %ld (that's a lower case L)
Don't look at GetLastError() unless you know an API call fails - in this case, a value of 0.

If an API call is successful, the error code is seldom set to zero, rather it stays whatever it was before the call.

If you want to use GetLastError() as an error indicator, call SetLastError(0) before making the API call.


0
 
LVL 2

Assisted Solution

by:deepakgupta111
deepakgupta111 earned 50 total points
ID: 16968933
I don't think that there is any problem with your RegisterClass() function

As the MSDN documentation says
If the function succeeds, the return value is a class atom that uniquely identifies the class being registered.If the function fails, the return value is zero.

Since you are getting Non-zero value, so seems like RegisterClass() call is successful.
0
 
LVL 22

Expert Comment

by:cookre
ID: 16969173
deepakgupta111:

We don't yet KNOW what the return code from the call was since the value of 'ret' isn't referenced.  All we know is that GetLastError() returned a 1410 into 'ret1'.

Now, the call to RegisterClass() probably was successful, but can you tell us why (there are two facts to consider)?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Introduction to Processes

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question