|
Anders Molin wrote:
Let's see some code...
How do you do it?
CPaintDC dc(this);
CDC dc2;
dc.CreateCompatibleDC(&dc2);
This is inside CDialog::OnPaint()
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
|
Woops, I didn't see either.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Let All the Windows' Title Set by My Presetting String when they Created.
In simple words, I want to make all windows display the same title.
Some may say that it can be done by enumwindow() and setwindowtext(), but how can I know when a new window is created and I set the title in time?
Are there any other method existing ???
Who can do it?
|
|
|
|
|
Why ask the same question again, you've had the answer.
The real question is, why would you want to do something so stupid ?
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Christian Graus wrote:
The real question is, why would you want to do something so stupid ?
I think there is this new trend of making high performance annoyance applications. They have a big market nowadays
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
I am very intrested in UI programming ,so I am just to
try something intresting ....
|
|
|
|
|
The system does not support it beyond the ways we have suggested because it is a dumb thing to do. Why not try to learn how to do something useful ?
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Christian Graus wrote:
why would you want to do something so stupid ?
Amazing to see that people are full of ideas like this. ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Call SetWindowsHookEx() and set a CBT hook. You'll get notified as each window is created.
--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
|
|
|
|
|
Hi.
I started out using a CListBox in a dialog box. However, I wanted to add a grid feature, so I posted a message about how to add a grid to it. I found out the only way is to use a CListCtrl. I implemented a CListCtrl in place of the CListBox. There is one problem. I cannot get it to return a selected item or the selected items. There are no getseltime or getselitemindex.
How do you determine what item a user selects in a CListCtrl?
Thanks,
Kuphryn
|
|
|
|
|
Look up CListCtrl::GetFirstSelectedItemPosition() and CListCtrl::GetNextSelectedItem().
--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
|
|
|
|
|
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)?
|
|
|
|