Originally posted by Sam Hobbs
This does sound strange. I am not aware of any problems and since you say you compiled the generated application as it existed when generated, it sure should work.
If the files you are working with are small and do not have anything you can't share then try attaching a sample of the files to a reply so we can see what the data looks like.
Sure. Here is the little text file I was using to test my code. It was created with notepad.
For what it's worth, I tried on another Windows XP computer to see if that wasn't due to my computer being hosed, and it exhibits the very same symptoms. Also, I tried using the MDI framework instead of the SDI framework and it's still the same.
You are correct, that is a plain (non-Unicode) text file. So the next thing you can do if you want is to post the project.
The best way to do that is to zip the project. If you want to include the exe file then that would be good but we don't need anything else from the Debug and/or Release directories. It would help to have the contents of the Res directory but that is not important. You can also omit the following file extensions: aps, ncb, opt and plg, although their sizes are relatively small.
Originally posted by Sam Hobbs
You are correct, that is a plain (non-Unicode) text file. So the next thing you can do if you want is to post the project.
The best way to do that is to zip the project. If you want to include the exe file then that would be good but we don't need anything else from the Debug and/or Release directories. It would help to have the contents of the Res directory but that is not important. You can also omit the following file extensions: aps, ncb, opt and plg, although their sizes are relatively small.
Ok, I think everything you asked for is in this zip file. I hope I didn't omit anything important nor put unneeded files :-).
I had to do some things to get it to compile using VC 6 but when I did compile it the program works; that is, it can open the test.txt file and it looks normal. I was unable to execute the exe though since it is a debug version of a program compiled using VC 7. It it were a release version I would be able to execute it.
Also you did good in creating the zip file except the res directory was not included. I was able to create one easy enough and I know you are just beginning with this stuff so I just wanted to let you know that what you did is good except if you do this in the future you can try to include the res file also.
So I don't know what to say. Perhaps there is a problem with VC 7. Probably the good news is that it is not likely to be a problem with what you are doing.
What happens when you open other text files? Is there a problem if you open a cpp file or a h file? What happens when you create a file using your simpleedit; can you later open it? Can you open the saved file using notepad?
Originally posted by Sam Hobbs
I had to do some things to get it to compile using VC 6 but when I did compile it the program works; that is, it can open the test.txt file and it looks normal. I was unable to execute the exe though since it is a debug version of a program compiled using VC 7. It it were a release version I would be able to execute it.
Also you did good in creating the zip file except the res directory was not included. I was able to create one easy enough and I know you are just beginning with this stuff so I just wanted to let you know that what you did is good except if you do this in the future you can try to include the res file also.
So I don't know what to say. Perhaps there is a problem with VC 7. Probably the good news is that it is not likely to be a problem with what you are doing.
What happens when you open other text files? Is there a problem if you open a cpp file or a h file? What happens when you create a file using your simpleedit; can you later open it? Can you open the saved file using notepad?
Thanks for taking a look at this code! I'll be sure to include the res directory next time :-).
SimpleEdit exhibits the exact same symptoms when I open other text files, header files, cpp files, etc.... When I create and save a file with SimpleEdit and open it with the notepad afterwards, I can only see the first character of the file.
I'm going to search the web to see if I find any reports of such problems with VC++ 7. Do you need me to attach a release version of the executable here?
You can provide a release version if you want me to try executing it using my system but I can only tell you whether it works the same as it does on your system(s).
[QUOTE]Originally posted by Sam Hobbs
You can provide a release version if you want me to try executing it using my system but I can only tell you whether it works the same as it does on your system(s). [/QUOTE
I guess that's still a valuable information. Here is a release version of the executable.
Since the same code works correctly with Sam's VC++ version 6, but fails with mux's version 7, I'll hazard a guess: mux might be compiling with UNICODE defined.
I don't know how to check this in version 7 since I also use version 6. Typically you would look under project settings, or maybe at the top of your stdafx.h file.
Sorry that this is a guess, and that I'm hazy on where to check if UNIDODE is defined. Maybe Sam will tell us that he compiled with UNICODE defined and that it works fine, in which case you can all justifiably deride me for being a silly speculator
I don't have mfc70.dll but I was going to see if I could get it from somewhere. Probably I can.
I considered the possibility that Unicode is defined so I searched the files for the VC 7 project and did not find "Unicode" so I assume that is not the problem. When I execute Maxime's compiled exe I shoudl be able to easily determine if it is using Unicode.
If anyone has mfc70.dll and was able to execute the program then you can let us know what happens.
Originally posted by Sam Hobbs
I don't have mfc70.dll but I was going to see if I could get it from somewhere. Probably I can.
I considered the possibility that Unicode is defined so I searched the files for the VC 7 project and did not find "Unicode" so I assume that is not the problem. When I execute Maxime's compiled exe I shoudl be able to easily determine if it is using Unicode.
If anyone has mfc70.dll and was able to execute the program then you can let us know what happens.
What I know for sure is that I didn't define UNICODE myself, so if it is defined, it has been done by the project wizard. I don't see UNICODE defined in stdafx.h either, but maybe it lies elsewhere?
I tried to attach my mfc70.dll file after zipping it, but it exceeds the maximum size allowed by the forum.
If Unicode is specified for a VC 7 project the same way as for a VC 6 project then it is done in the project settings.
If you want to try something you could try creating a static release build instead of a dynamic release build. Then MFC70.dll would not be needed. The problem is that then the exe might be too big to fit as an attachment here but probably not.
To do a static release build change the project settings to specify use of MFC in a static library instead of a shared DLL.
Originally posted by Sam Hobbs
If Unicode is specified for a VC 7 project the same way as for a VC 6 project then it is done in the project settings.
If you want to try something you could try creating a static release build instead of a dynamic release build. Then MFC70.dll would not be needed. The problem is that then the exe might be too big to fit as an attachment here but probably not.
To do a static release build change the project settings to specify use of MFC in a static library instead of a shared DLL.
I found a setting for the character set in the project properties. It was set to multi-byte character strings. Setting it to unicode produces different garbage when opening a file, but it's still garbage :-). Setting it to "Not set" doesn't change anything.
I wanted to attach a static release build to this post, but the file is too big for the forum.
I think you misunderstood what I meant by specifying Unicode in the project settings. I might have forgotten what it is I meant, but I am nearly certain I meant that your application (project) should be built for Unicode. Note that I said project settings.
I think you are setting the Options, not the project settings, when you set the character set. Unless VC 7 is different, there is not a setting for a font (character set) for a project. Are you sure it is a project setting you changed? If not, then it sure won't have any affect on your program, except possibly enabling you to see the data correctly using the editor (Visual Studio).
* 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.