CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 32

Threaded View

  1. #16
    Join Date
    Apr 1999

    Re: CreateFile Failed problem

    Quote Originally Posted by wklove2003 View Post
    Sorry, I just havent been able to get a GetLastError() function to return anything.
    What do you mean "not return anything?"
        DWORD dwError = GetLastError();
        printf("The value of the error code is %d\n", dwError);
    That is all we have been waiting for all this time. What is the error value?

    In general:
    if ( ThisFunctionCallReturnedFailure )
        DWORD dwError  = GetLastError( );
        // dwError now has the reason code for why the function failed
    That is what your original code was missing -- you never checked at all for the reason code for the failure. All you did was check for failure, and all we asked you to do is go further and check the reason for the failure by calling GetLastError(). That doesn't sound complex to me.
    I am a complete newb to programming, but unfortunately, have been handed a project that is dealing with a fairly complex program that was downloaded. So most of the code I have posted, I did not actually do. Just trying to get this program to run properly ASAP
    What we asked you to do has nothing to do with the size or complexity of the program.

    All we wanted was you to make a single function call, GetLastError() and see what value is returned, instead of being in the dark as to why CreateFile fails. If you can't do that, then may I suggest you get someone else to finish your program, since what we asked is the simplest of things.


    Paul McKenzie
    Last edited by Paul McKenzie; September 9th, 2010 at 12:26 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.