CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Apr 2008
    Posts
    214

    winapi c++ - save function not saving correctly

    [Erased By postee]
    Last edited by zaryk; December 23rd, 2008 at 08:31 PM.

  2. #2
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: winapi c++ - save function not saving correctly

    Nobody is likely to bother....

    You come here expecting people to volunteer their time, when you explicitly state that you are not willing to have any curtesy (ie a minimal yest complete commented formatted code sample posted properly inside code tags)????
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  3. #3
    Join Date
    Apr 2008
    Posts
    214

    Re: winapi c++ - save function not saving correctly

    [Erased By postee]
    Last edited by zaryk; December 23rd, 2008 at 08:32 PM.

  4. #4
    Join Date
    Feb 2007
    Location
    Craiova, Romania
    Posts
    326

    Re: winapi c++ - save function not saving correctly

    Quote Originally Posted by zaryk View Post
    I gave the file that is having the problem, you could at least look at it, and then if you don't feel like helping, don't post anything.
    it's too much overhead to download the arhive, figure out where to save it (cause I don't want a messy filesystem), browse and then open it in vs.
    how about posting the code, with some comments?

    edit: oh, see you already did.

  5. #5
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: winapi c++ - save function not saving correctly

    I Copied and pasted your code into my compiler (VS-2008) it does not compile (Complete means a code sample that reproduces the error, minimal means no extranesous information)

    Code:
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(1) : error C2146: syntax error : missing ';' before identifier 'SaveFile'
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(1) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(1) : error C2065: 'HWND' : undeclared identifier
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(1) : error C2146: syntax error : missing ')' before identifier 'progTab'
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(1) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(1) : error C2059: syntax error : ')'
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(2) : error C2143: syntax error : missing ';' before '{'
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(2) : error C2447: '{' : missing function header (old-style formal list?)
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(39) : error C2146: syntax error : missing ';' before identifier 'DoFileOpenSave'
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(39) : error C2086: 'int BOOL' : redefinition
    1>        d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(1) : see declaration of 'BOOL'
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(39) : error C2065: 'HWND' : undeclared identifier
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(39) : error C2146: syntax error : missing ')' before identifier 'hwnd'
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(39) : error C2059: syntax error : ')'
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(40) : error C2143: syntax error : missing ';' before '{'
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(40) : error C2447: '{' : missing function header (old-style formal list?)
    1>d:\source\dyncondevcorp\corplib\source\clrhosting\nativelauncher\private\temp.cpp(65) : fatal error C1004: unexpected end-of-file found
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  6. #6
    Join Date
    Apr 2008
    Posts
    214

    Re: winapi c++ - save function not saving correctly

    [Erased By postee]
    Attached Images Attached Images
    Last edited by zaryk; December 23rd, 2008 at 08:31 PM.

  7. #7
    Join Date
    Feb 2007
    Location
    Craiova, Romania
    Posts
    326

    Re: winapi c++ - save function not saving correctly

    In SaveFile you have:
    Code:
          dwTextLength = GetWindowTextLength(progEdit[count]);
             LPSTR pszText;
             pszText = (LPSTR)GlobalAlloc(GPTR, dwTextLength);
             if(pszText >= 0)
    I could not help notice the unusual test you're making:
    Code:
    if(pszText >= 0)
    You should test dwTextLength, because GlobalAlloc will return a non-null pointer (even though not valid) when dwTextLength is 0.

    Another matter is debugging, that could help you a lot more than any of the comments here. Doesn't DevC++ supports it?
    I strongly recommend using VC++ 2005 or 2008 Express Edition. It will make your life a lot easier, at least when it comes to development.

    good luck!

  8. #8
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: winapi c++ - save function not saving correctly

    Quote Originally Posted by zaryk View Post
    I really dont know how that will help me. In devc++ no errors occur.
    COPY EXACTLY (and ONLY) what you posted into a new .cpp file. Feed this file to your compiler...IT Will not compile.

    When you only post partial code (or when you include code that has nothing to do with the problem), then it becomes impossible to determine exactly what the problem is.

    Even in your last post:
    Code:
    if(GetWindowText(progEdit[count], pszText, dwTextLength))
    progedit could be garbage...
    count could be garbage
    count could be outside the valid range of progecit
    pszText could be garbage
    dwTextLenth could be garbage.

    The is 5 potential errors (that are impossible to test, unless you minimized the problem down to a minimal compilable post) in a single line.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  9. #9
    Join Date
    Apr 2008
    Posts
    214

    Re: winapi c++ - save function not saving correctly

    [Erased By postee]
    Last edited by zaryk; December 23rd, 2008 at 08:32 PM.

  10. #10
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: winapi c++ - save function not saving correctly

    Quote Originally Posted by zaryk View Post
    I can debug in devc++, and have already tried. Nothing comes up in the debugger..
    Single step through the area in question and use the print command of the dubugger to show each of the variables referenced on each line. Then post the reuslts of this debugging session...you are missing something.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  11. #11
    Join Date
    Apr 2008
    Posts
    214

    Re: winapi c++ - save function not saving correctly

    [Erased By postee]
    Last edited by zaryk; December 23rd, 2008 at 08:33 PM.

  12. #12
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: winapi c++ - save function not saving correctly

    Quote Originally Posted by zaryk View Post
    Copied to new .cpp and tried to compile.
    You could not have possibly pasted in the code that was posted inline...

    The very first line is:
    Code:
    BOOL SaveFile(HWND progTab, HWND hwnd, LPSTR pszFileName)
    That line alone will generate errors as NO headers are included, so BOOL, HWND, and LPSTR are undefined...

    I have spend enough time...going to help others who can follow directions..

    Perhaps someone else will have mercy.

    Good Luck.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  13. #13
    Join Date
    Apr 2008
    Posts
    214

    Re: winapi c++ - save function not saving correctly

    You were useless.
    Last edited by zaryk; December 23rd, 2008 at 08:34 PM.

  14. #14
    Join Date
    May 2007
    Posts
    811

    Re: winapi c++ - save function not saving correctly

    Quote Originally Posted by zaryk View Post
    Well, if you used DevC++ it would be alot easier.
    Why, it's been kind of dormant since 2005. There are far better alternatives, even Microsoft Visual Studio Express Edition (which is free) and has IMHO, the best visual debugger for c++.

  15. #15
    Join Date
    Feb 2007
    Location
    Craiova, Romania
    Posts
    326

    Re: winapi c++ - save function not saving correctly

    Quote Originally Posted by zaryk View Post
    You were useless.
    No, you are too hard headed. Do this and come back if you still don't get it to work:
    - Download VC++ 2008 Express;
    - Create a new project and import all your files;
    - Make the necessary adjustments (if any) to get it to compile;
    - Do some REAL debugging;

    You can download VC++ from here: http://www.microsoft.com/express/vc/

Page 1 of 2 12 LastLast

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured