16,002,513 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by krmed (Top 25 by date)
krmed
30-Jun-13 9:27am
View
Perhaps if you remove the FOF_NOERRORUI you might get some more information. This could be why you don't see any errors.
krmed
28-Apr-13 16:49pm
View
Sounds like a good homework assignment. Guess you need to start writing the code since no one here will do your homework. Once you have that, we'll be glad to answer your questions.
krmed
15-Apr-13 9:18am
View
What do you do with the brush between the time you create it and then destroy it?
If you select the object into a DC, you must remember to "unselect" it (select a different object) before you destroy it, as you cannot destroy an object that is currently selected in a DC.
krmed
17-Jul-12 14:48pm
View
Actually, I was talking about a Post Build event in one of the ten projects that he does build. After the last one's done, just use the Post Build to copy everything that's needed to wherever desired.
krmed
25-Apr-12 6:35am
View
When you open a command prompt (let's say without the Visual Studio Command prompt) and type the command "set" (without the quotes), you see all of your environment variables.
Now if you open the VS Command Prompt and type set, you'll see all of the ones that now exist - including those set by Visual Studio. However, as Aescieal explained, they are set within the current process ONLY. This means that once you open the Visual Studio command prompt, the variables exist, but the go away when you close that command prompt.
If you start a program from that command window, the program you start will inherit those variables since it is a child process of the command window.
Hope that explains well enough.
krmed
3-Mar-12 11:46am
View
Why are you putting all the "control panel" stuff in your batch file? The only thing you need in the batch file should be the attrib +h c:\whateverdir\*.* /s command.
krmed
22-Sep-11 8:22am
View
In the old "DOS" days, a Ctrl-Z marked the end of file (usually). However in today's world, there is normally no such thing as an end of file mark - either text or binary. The file only contains whatever the creator decided.
If you write a data structure from your software, you should know the format, and therefore know how much to read from the file. If you choose to use some kind of EOF indicator in files you create, you need to be aware that that "character" or "sequence" cannot appear anywhere else in the file, so you have to handle that. This is why most files don't contain any such mark.
Hope it helps.
krmed
4-Aug-11 6:31am
View
Please show the DeleteContents method - what's being done in there? It should be resetting all doc variables to be as if you have not yet opened a file. You also don't show where you are calling the SetTitle() method of the doc.
krmed
3-Aug-11 13:19pm
View
Please post the code you have - maybe that will help see where your problem is.
krmed
3-Aug-11 13:14pm
View
I think you are sadly confused. If you compare INBuffer[2] with 0x02 like this
if (INBuffer[2] == 0x02)you are comparing only a single BYTE.
Each character of INBuffer can only contain ONE character. It's only one byte long. How that charcter is represented is a different matter. Let's say INBuffer[2] contains the letter A.
Here are some of the ways that can be represented:
Decimal representation 65
Hexadecimal representation 0x41
ASCII representation A
Octal representation 0101
Binary representation 1000001
So you see, 0x0A is really a decimal value of 10, which is stored in a single byte. However "0x0A" (as a string) is a character string that is 4 bytes long, plus one byte for the terminating null. To show this stored in INBuffer, you would have:
INBuffer[0] = '0' or 0x30 or 48, etcINBuffer[1] = 'x' or 0x78 or 120, etc
INBuffer[2] = '0' or 0x30 or 48, etcINBuffer[3] = 'A' or 0x41 or 65, etc
INBuffer[4] = 0 (the terminating NULL)
As you can see, each individual character contains a value between 0 and 255, and this can be stored in a single byte.
Hope this helps.
krmed
20-Jul-11 16:44pm
View
Yes, you set it to null in the constructor, but you don't show where you call the Init function. The first time you call it, it will be NULL (because of the contructor), but if you call it more than once it won't be NULL for the subsequent calls. (You'll notice in my response I said "let's assume it's not NULL").
Good luck.
Sorry - I posted that as a comment instead of a reply to your comment.
krmed
20-Jul-11 16:44pm
View
Deleted
Yes, you set it to null in the constructor, but you don't show where you call the Init function. The first time you call it, it will be NULL (because of the contructor), but if you call it more than once it won't be NULL for the subsequent calls. (You'll notice in my response I said "let's assume it's not NULL").
Good luck.
krmed
18-Jun-11 9:27am
View
Good luck... remember to test the actual operation of the code (especially on Windows 7 as some things have changed).
If you have future problems, I'm sure you can post here and someone will help.
Good luck.
krmed
17-Jun-11 7:41am
View
I've updated the answer. Be sure to test thoroughly - just because it compiles and links doesn't necessarily mean it will all work as you think.
Good luck.
krmed
16-Jun-11 15:36pm
View
Originally, you compiled the program with Visual Studio .NET V7 (2002) and it did not have the improvements that have been added. VS2010 is very compliant with the current C++ specification, and also includes a lot of "safe" functions to help protect agains buffer overruns.
krmed
16-Jun-11 11:39am
View
Thanks - I appreciate it.
krmed
16-Jun-11 11:38am
View
Thanks - I appreciate it.
krmed
16-Jun-11 11:22am
View
Actually, the .c or .cpp isn't VS specific... the C language requires all variables to be defined before any code, but C++ does not. If you mean the unreachable code warning, I'm not sure if that VS specific or not.
krmed
12-May-11 13:42pm
View
memmove will not replicate the first byte throughout all of "data".
According to MSDN:
If some regions of the source area and the destination overlap, both functions ensure that the original source bytes in the overlapping region are copied before being overwritten.
krmed
12-May-11 13:40pm
View
Deleted
memmove will not replicate the first byte throughout all of "data".
According to MSDN:
If some regions of the source area and the destination overlap, both functions ensure that the original source bytes in the overlapping region are copied before being overwritten.
krmed
19-Apr-11 6:50am
View
I would think that if someone downvotes an answer they should at least add a comment as to why they feel that way. It's almost enough to discourage anyone from posting any answers.
krmed
18-Apr-11 10:16am
View
I didn't say it was a good idea, just answered the OP's question. How can I avoid...
In my opinion (and what I've always done) the appropriate solution is to use strcpy_s (or _tcscpy_s).
strncpy isn't really equivalent since it doesn't append the null at the end of the string, whereas strcpy_s does append it, and makes sure there is room for the terminating null.
krmed
10-Apr-11 22:13pm
View
If your function is working on the entire array it needs the address of thefirst element. That's normally the case.
Glad I could help.
krmed
1-Mar-11 13:12pm
View
It won't change the "size" but if you notice, he's using GetCount() - and that WILL change after a delete. Since the initial value of nCount is set to the original GetCount() result, he we be attempting to get elements past the end of what's available.
In his example, he added three elements and thefore nCount is set to 3 and i is 0, and the elements are 0, 1, and 2. After the first delete, i becomes 1 but the valid elements are now 0 and 1. The next time through the loop, i becomes 2, but the only valid index is now 1 - thus the problem.
krmed
2-Oct-10 18:24pm
View
Yes, of course you can use ofstream (or anything else you want to). MFC provides the CArchive for your use - but you don't have to.
Show More