Solved

RegisterClass Function Returns Error Code 1410

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 61
changeXy challenge 13 57
Not needed 13 54
C# DataGridView_RowsAdded event not firing 1 37
This is an explanation of a simple data model to help parse a JSON feed
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now