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
Re: winapi c++ - save function not saving correctly
Originally Posted by zaryk
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?
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
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.
Re: winapi c++ - save function not saving correctly
Originally Posted by zaryk
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.
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
Re: winapi c++ - save function not saving correctly
Originally Posted by zaryk
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
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
Re: winapi c++ - save function not saving correctly
Originally Posted by zaryk
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++.
Re: winapi c++ - save function not saving correctly
Originally Posted by zaryk
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;
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.