zaryk
December 23rd, 2008, 04:14 PM
[Erased By postee]
|
Click to See Complete Forum and Search --> : winapi c++ - save function not saving correctly zaryk December 23rd, 2008, 04:14 PM [Erased By postee] TheCPUWizard December 23rd, 2008, 04:18 PM 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)???? zaryk December 23rd, 2008, 04:41 PM [Erased By postee] marceln December 23rd, 2008, 05:17 PM 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. TheCPUWizard December 23rd, 2008, 05:28 PM 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) 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 zaryk December 23rd, 2008, 06:05 PM [Erased By postee] marceln December 23rd, 2008, 06:14 PM In SaveFile you have: 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: 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! TheCPUWizard December 23rd, 2008, 06:21 PM 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: 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. zaryk December 23rd, 2008, 06:52 PM [Erased By postee] TheCPUWizard December 23rd, 2008, 06:54 PM 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. zaryk December 23rd, 2008, 07:06 PM [Erased By postee] TheCPUWizard December 23rd, 2008, 07:15 PM 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: 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. :wave::wave: zaryk December 23rd, 2008, 07:22 PM You were useless. STLDude December 23rd, 2008, 07:50 PM 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 (http://www.microsoft.com/express/product/default.aspx) (which is free) and has IMHO, the best visual debugger for c++. marceln December 23rd, 2008, 07:55 PM 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/ TheCPUWizard December 23rd, 2008, 08:04 PM Everyone please note how zaryk has deleted many of his previous posts, and totally corrupted the thread....you may want to take this into consideration when helping him/her. ps: I would have sent this by PM (along with many of the previous posts), but it sees like enabling that was too much trouble for the OP..... zaryk December 23rd, 2008, 08:13 PM Oh, I WILL get it to work, and I wont even install Microsoft Office on my computer so why would I want to install vc, and then have to deal with changing my whole program cuz vc finds a lot more errors BECAUSE they dont necessarily use the syntax because, in fact, they are two different compilers AND made by two different organizations. ps: I agree you should note that I deleted my posts. marceln December 23rd, 2008, 08:17 PM Oh, I WILL get it to work, and I wont even install Microsoft Office on my computer so why would I want to install vc, and then have to deal with changing my whole program cuz vc finds a lot more errors BECAUSE they dont necessarily use the syntax because, in fact, they are two different compilers AND made by two different organizations. the changes to your code will be minimal. so, you don't want to use MS products, but you still use WinAPI in your application written with open source tools... zaryk December 23rd, 2008, 08:43 PM I like small programs. anything that gets into the 100's of mb, other than WOW and Guildwars, Im not too particular about. zaryk December 23rd, 2008, 09:27 PM Well, i figured out my problem and fixed it by combining both functions and making it a void rather than BOOL. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |