Solved

RegisterClass Function Returns Error Code 1410

Posted on 2006-06-19
3
1,721 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is about my first experience with programming Arduino.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

738 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