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
Solved

RegisterClass Function Returns Error Code 1410

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
firstswap challenge 20 82
Controlled Assessment GCSE - desperate help needed 4 98
index Out OF Range Exception error 4 68
incorrect syntax near the order by 10 38
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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 …

765 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