|
Thanks for the response.
-Ken Maz
|
|
|
|
|
Yeah, basically, C++ allows you to do a lot of things that could potentially be dangerous, like accessing out of the bounds of an array, and leaves it up to the programmer to make sure the program is doing what he wants it to do.
Danny
The stupidity of others amazes me!
|
|
|
|
|
Ken Mazaika wrote: In one of my classes (on programming in Scheme) my professor said that C++ is an "unsafe language".
Make sure you fully understand in what context he was talking. Otherwise, you could treat that as a blanket statement and come away with a completely misguided view of a very good language.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
|
Try using RegisterHotKey for receiving Win+D or a global hook.
I don't know how you could respond to that specific button, but quick launch bar is fully customisable and you could add a shorcut to an application that would show your application (or even a shorcut to the application itself).
-- modified at 13:49 Friday 21st October, 2005
|
|
|
|
|
Or one other idea, don't do it. The user of windows expects that clicking the desktop icon on using WINDOWS + D keys to hide ALL windows, including your application. To play with Windows expected functionality can be kind of cheating the user.
Danny
The stupidity of others amazes me!
|
|
|
|
|
bugDanny wrote: To play with Windows expected functionality can be kind of cheating the user.
I agree. Users expect their Windows applications to have a common intuitiveness. To alter that could have negative repercussions.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi left a message about subclassing in Visual Studio 2003.
I got a few replies and some were helpful, but some wernt related to VS 2003.
Subclassing in VS6 is pretty easy because of the class wizards ability to bind the new class to the control on the dialog or window.
However in VS 2003 it doesnt have that!
Here is the url for the previous post ->
click here
Thanks Tom
|
|
|
|
|
just create two empty text files, type your header code in one, and your implementation in the other. voila!
Cleek | Image Toolkits | Thumbnail maker
-- modified at 13:33 Friday 21st October, 2005
|
|
|
|
|
|
|
Ignoring the IDE fluff, it works the same way - you can do it manually using ctrlWrapper.SubclassDlgItem() , or you can just add a DDX_Control() entry to your dialog class's implementation of DoDataExchange() .
|
|
|
|
|
Hi and thanks for the replies and for calling me a dumbass (being sarcastic) .
I'll give two examples of what ive being trying to achieve, for the smartasses.
Firstly, I was trying to derive a PictureBox that could be drawn in easily.
I thought i could derive a static and add OnPaint and give it a device context.
In Visual Basic 6 (my previous language) i could use a text box then use GetDC to draw in it.
Secondly, I was trying to create a NumberBox from a EditBox and catch the WM_CHAR message and only allow Digits. The NumberBox class was derived from the EditBox Class.
Thanks again
Tom
|
|
|
|
|
Tom Moore wrote: I thought i could derive a static and add OnPaint and give it a device context.
That'll work. Instantiating CPaintDC in an OnPaint handler will give you a DC you can draw onto. You probably also want to implement OnEraseBknd , if only to ensure that nothing extra gets drawn there.
Tom Moore wrote: Secondly, I was trying to create a NumberBox from a EditBox and catch the WM_CHAR message and only allow Digits.
There are a few classes like that already written - do a search on CP. Note that if you only need integers, you can use the ES_NUMBER style and the standard control will take care of it for you.
|
|
|
|
|
cool! If i derive my new class from the parent class!
Eg. class CDrawBox : public CStatic or CNumberBox : public CEdit
Do i subclass the Static Picture box on the form using SubClassDlgItem, same goes for the Numberbox. Thanks again
Tom
|
|
|
|
|
Tom Moore wrote: Do i subclass the Static Picture box on the form using SubClassDlgItem
You can, or you can just use MFC's built-in subclassing, which uses DoDataExchange() and DDX_Control to do the same thing. Take a bit of time and look through the demo code for this article:
http://web4.codeproject.com/staticctrl/digidisplay.asp[^]
|
|
|
|
|
morning,
when the string got convert to long, it lost the leading zero, could it just be padded back or it should be converted back to string to add the zero? here is the code, sorry, it's java
String t = party.getNumber().getNNxx();
t = rightTrim( t.substring( offset, t.length() ) );
while( t.length() > 0 )
{
long city = ( party.getCityCode() == 0 ? Long.parseLong( t.toString() ) : party.getCityCode() );
t = t.substring( 0, t.length()-1 );
String szCountry = Long.toString( party.getCountry() );
long token = cintCity.find( (long) party.getCountry(), city );
if ( token != cintCity.end() )
{
party.setCityCode( city );
thanks.
-- modified at 12:08 Friday 21st October, 2005
|
|
|
|
|
I'm not sure why you asked a Java question in a C++ forum.
valerie99 wrote: when the string got convert to long, it lost the leading zero, could it just be padded back...
No. Numbers with leading zeros are for display purposes only. If you had:
char *szNumber = "01234"; and you assigned that to a long via:
long lNumber = atol(szNumber); why would you want lNumber to be equal to 01234 instead of 1234?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
thanks, David.
I need that 0 because it's the phone number, 0123 is different as 123.......thanks for your help.
|
|
|
|
|
thanks, David.
I need that 0 because it's the phone number, 0123 is different as 123 in some country's city code.......thanks for your help.
|
|
|
|
|
Ok, but how are you using that number? Are you sending it to a modem for dialing purposes?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I think this shouldn't been done as long since it's for display not conculation, leading zero is meaningful at this point.
I could left pad zero in front of string,
long city = ( party.getCityCode() == 0 ? Long.parseLong( t.toString() ) : party.getCityCode() );
String szcity = utils.leftPadZeros( String.valueOf( city ), t.length());
long token = cintCity.find2( szCountry, szcity );
but the whole app is using long for citycode, it might cause problem later on
party.setCityCode( city );
so I was wondering if I could pad zero in front of long....seems like impossible...
thanks, have a good weekend
|
|
|
|
|
David's exactly right. No number with actual meaning has leading 0's, unless it's the 0 before the decimal point. The program shouldn't keep track of that, so you'll have to pad that back, if you really want it.
Danny
The stupidity of others amazes me!
|
|
|
|
|
Thanks for my question reply to...
I hope my program visible when press WINDOWS KEY + D or click toggle desktop icon.
I know global keyboard hook. If block windows key + D but can't block click toggle desktop icon.
(I don't know this icon name by English. Because my windows language is KOREAN...
Toggle desktop icon is by side of START button. On Quick Launch... )
Sorry my English.
But I'm crazing that problem.
Please help me.
What happened message from click toggle desktop icon.
How can I my program visible when that event.
|
|
|
|
|
NSoft i really sorry. i not read till end.
regards,
Rookie
Installing MFC...2% complete.
|
|
|
|