|
Awhile ago someone wrapped the custom draw routine along with a nice article. Its been almost 2 hours and I am unable to locate it.
Search comes up with over 200 hits for custom draw and still could not find it. Been going through each section piece by piece.
Search tips how to find it would be appreciated..
Mark A
|
|
|
|
|
Which library (if any)? WTL has a CCustomDraw class.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I was gonna use it for mfc. One of the reasons why I wanted to find the article was that it got rid of the huge switch statement. They managed to do this without using delegation. How does the wrapper glue to the control if there no switch statement of any kind from the original CustomDraw procedure. Is this making any sense at all?
Sorry its late. Its been awhile since I looked at the article so maybe what im thinking isnt even possible. (why was looking for it)
cry.
Mark A
|
|
|
|
|
I am writing a db application using structs as records and i want the users to be able to use sql commands in it to return the data.
Is there any classes out there that use CString to process the query and save it into a simple form that would be easy to extract from the structs stored in a file.
If would be a great help if someone made on for me.
thanks.
|
|
|
|
|
Mikel wrote:
Is there any classes out there that use CString to process the query and save it into a simple form that would be easy to extract from the structs stored in a file.
I think you have to manage this process yourself.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Could you tell me how to start? i am only new to programming and dont have a clue how to do it.
|
|
|
|
|
Hi.
I began learning C++ and programming for the first time about ten months ago. I love programming using C++. Whether I am using C++, MFC, or Winsock, programming concepts never change.
C++ is an extremely powerful programming language and is one of the most extensive programming language. I find myself often trying to decide one programming style and weighing effeciency, effectiveness, reusabiliy, and manageability for future changes.
What is most important: Independent or Effeciency?
Here is one example. Let consider there is a function that does a mathematicaly calculation. However, there are different types of data such as int and double. In this case, is it better to write two separate functions where each performs a task for a specific data type, or is it better to use a switch or if/else state inside one function and manipulate data relative to whatever datatype that is passed in? This is just one example. There are many more complicated scenarios.
Ultimately, my concern here is about "slick" programming or "safe" programming.
-> many lines of code : easier to expand
Is it better to have everything independent, i.e. one function for every job and for every data type? This might seem redundant.
-> few lines of code : difficult to expand
Is it better to use "tricks" and cram everything togetter to make programs smaller and maybe more efficient? This might seems difficult to expand in the future. What if you want to add a new feature and needs to add something to a function; however, this feature only applies to one datatype or one scenario.
Thanks,
Kuphryn
|
|
|
|
|
I think your example is a good candidate for templates (or generics, whatever you like to call it )
Most of the time I find Independent to be better than efficiency, but that depends on every application (or type of application).
The best approach I've found is "divide and conquer", make several functions with a short number of lines and use function calls between them to accomplish a task. This way you can reuse chunks (functions) of code.
Hope this make sense.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Thanks.
I see your point very clearly and I will approach most programs from a similar perspective.
Kuphryn
|
|
|
|
|
I think that when it comes down to different datatypes, you can look into templates. Othertimes polymorphism will help you by declaring a virtual function inside of a set of different classes.
Whatever you do though, I do not believe that there is one simple paradigm to use when you are coding. I think that a good developer can use all of the concepts in the language. I think that an excellent developer can modify their styles and behaviors depending on the problem at hand.
If you are developing business software or nuclear powerplant controls, reliability and managability may be your primary goal. However if you are into game development these two items may take a back seat to efficiency.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Ok I never got it to work so I might as well give up trying and seek for some help here. :p
My goal is that, given a string(CString object) that contains some Chinese characters, I want to output some certain sub-string or characters by specifying an index(and count for sub-string).
I've installed unicode libs for VC++6.0, defined _UNICODE symbol in my project and modified the program entry function to...whatever the odd name is, anyway, it compiled and linked, but it wouldn't out put the sub-string or characters correctly. Here's the code:
CString str = _T("ÎÒÃÇ");
CFile fo;
fo.Open(_T("test.txt"), CFile::modeCreate | CFile::modeWrite);
TCHAR ch = str[1];
fo.Write(&ch, sizeof(TCHAR));
fo.Close();
And it didn't work.
I can, though, use CStdioFile to output the whole CString which works perfectly, but that's not what I want, I wanna output individual characters, not the whole string...
What am I doing wrong? Thanks in advance.
|
|
|
|
|
|
I'll try it. But why should the length be divided by sizeof(BYTE)?
|
|
|
|
|
Bin wrote:
I'll try it. But why should the length be divided by sizeof(BYTE)?
Did it work now? If not, what is getting written?
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Sorry it didn't work.
After output one character to the "test.txt", size of that file is 2 bytes, which sounds correct, but the character does not show up.
I know it's not the problem of string contents because there's no problem if I use CStdioFile to output the whole string... just can't extract a single character, dangit.
|
|
|
|
|
Well, here is another suggestion. Since you got it to work with CStdioFile's WriteString, you should extract each character as a substring and write it using CStdioFile::WriteString. This is sorta inefficient, but worth a try anyway, if no other solution comes up!
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
The funny thing is that, I did try that way, suppose now I use CStdioFile instead:
CString str = _T("ÎÒÃÇ");
CStdioFile fo;
fo.Open(_T("test.txt"), CFile::modeCreate | CFile::modeWrite);
CString ch(str[0]);
fo.WriteString(ch);
fo.Close();
The whole string can be written, but a character cannot, even though it had been used to create a dummy CString first, then to output that dummy string, still nothing.
|
|
|
|
|
Now I begin to think that maybe we cannot use operator[] or the like to extract a wide char from a CString?
|
|
|
|
|
This is very curious indeed. I wonder whether there is anything special about a 1-character UNICODE string!!!
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Ok now I'm sure as hell that we cannot use operator[] to extract a wide char from CString because now size of the output file "test.txt" becomes 1 byte, which is absolutely wrong.
|
|
|
|
|
Bin wrote:
Ok now I'm sure as hell that we cannot use operator[] to extract a wide char from CString because now size of the output file "test.txt" becomes 1 byte, which is absolutely wrong.
Hmmmm. This is very strange. But instead of using [] why don't you use CString::Mid ?
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
I'll try CString::Mid, but I doubt it will work...
|
|
|
|
|
OKOK, Mid worked, BUT need to use Mid(0, 2) to get the first char, and use Mid(2, 2) to get the second, which is weird because str.GetLength() returns 2...
|
|
|
|
|
Well, glad to know it worked! Can figure out why it works later I guess. Meet the dead line for now [hoping there aren't any hidden bugs]
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Thank you Nish, I really appreciated your help.
|
|
|
|