Solved

RegisterClass Function Returns Error Code 1410

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

Suggested Solutions

Title # Comments Views Activity
Generate Unique ID in VB.NET 21 100
Problems moving Excel files from local drive to server 4 26
Is online banking safe? 11 81
Java array 10 55
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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 …

740 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