|
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.
|
|
|
|
|
First off, I appologise if this has been answered before. I always perform a thorough search across google, newsgroups and ofcourse codeproject, but alas I can't find what I need this time hence my first post.
I have an application that has many CEdit controls, the ones that are on a CDialog derived window have the context menu and the ctrl-c etc keyboard shortcuts. The ones that are on a CFormView have the context menu but the ctrl-c etc keyboard shortcuts do not work.
And yes I have found Knowledge Base article Q145616 "How to Enable Edit Menu
Commands for Edit Controls" that everyone with this problem gets pointed to, but this is about the global Edit->Copy, Edit-Paste menu items not the keyboard shortcuts for each Edit control.
How do I get this to work? Will subclassing the CEdit control, handling the key presses and replacing all instances of CEdit with my subclasses control work - if so then why on earth doesn't the CEdit control work this way.
Many thanks,
Rincewind
|
|
|
|
|
So what exactly is the problem? Are you not able to paste into an edit control using Ctrl+V from the keyboard, Paste from the Edit menu, or Paste from the edit control's context menu?
TheRincewind wrote: And yes I have found Knowledge Base article Q145616 "How to Enable Edit Menu
Commands for Edit Controls" that everyone with this problem gets pointed to...
So you implemented the code in this article to no avail?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I must have read that KB 5 times before but after actually fixing the problem I now understand the KB - DOH. The answer was exactly in that KB I listed, I feel like a right wally now
Just in case someone else needs it spelt out like I did on this occasion:
1. The app wizard creates accelerator keys for Ctrl-C, Ctrl-V etc.
2. CFormView's (and probably a class a bit higher up), process accelerator keys, whereas CDialog does not
3. Processing an accelerator key (finding a match between the keys you pressed and an entry in the accelerator key table) means the key press is not passed on to child controls - hence the CEdit control never gets the keys
In my case, I wasn't using the accelerators at all, so simply deleting these entries fixed the problem.
Hope my mistake helps someone else!
Rincewind
|
|
|
|
|
I need to create a scheduler which does a function (display message) at the specified time. and it should be able to run at the background in the system try. How can i do this.
A link or code snippet will be useful.
I already have a SDI application and i have the display message function in it i need to call at scheduled time and it should be able to minimize to system tray.
Thanks,
|
|
|
|
|
karmendra_js wrote: I need to create a scheduler...
Are you sure? Perhaps you want to create a schedule instead. You need to search for the ITaskScheduler , ITask , and ITaskTrigger interfaces. There are some good examples on MSDN.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
* first learn how to minimize your application to the system tray.
* Learn how to set timers for a function.
* make a function that compares current time with the scheduled time, if they concide, popup a message.
is that you want?
All these can be found if you search inside CP itself.
He is like a one-legged man in a bum kicking competition. -Novjot Sidhu
--[v]--
|
|
|
|
|
hello to all members
i am given a com dll and i had to make windows service using that
i had no idea about windows service
please tell me how can i make a windows service(steps)
i see the following http://www.codeproject.com/system/cntservice.asp
but do not understand how to use it
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
|
By the way, who gave you the task ? Is that your boss?
yes
and i am new to all these things
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
When you create an MFC project, you may choose between an SDI, MDI or Dialog-based. In Dialog-based, we can create buttons, lines, and other controls but in SDI, you have to insert a dialog to place your buttons, etc.
I would like to ask if it is possible to place these dialogs, edit boxes, static text, etc to the main window of the SDI or MDI? if yes, how, just a snippet will do? Thanx
|
|
|
|
|
Yes, when creating your project, on the last step of the creation wizzard, you can choose from which class view (CView, CScrollView, CFormView,...) your main view class will inherits of. Just choose CFormView and a form will already be ready for you. You just need to place the controls you want on it.
No code snippet necessary
|
|
|
|
|
to create a control declare an object of that control class eg CEdit , CStatic etc in ur view class and then call Create function of these classes in OnCreate function of ur view class
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
Hi,
I m opening a file and trying to read a content of it..but in buffer it gives me nothing. Is it coz the pointer goes to end of the file??? whats thereason to not get data....here is code
DWORD buff;
TCHAR *szBuffer = NULL;
HANDLE hr = CreateFile(L"c:\\a.txt",FILE_READ_DATA,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
ReadFile(hr,&szBuffer,10,&buff,NULL);
here szBuffer contains nothing...
Thanks
Supriya Tonape
|
|
|
|
|
If you are opening Text File why Not go for CStdioFile and CFile class.. Thats work well with The Text or binay file!...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Anonymous wrote: Is it coz the pointer goes to end of the file???
No
The reason is ReadFile doesnot allocate memory for szBuffer .
Use this code
DWORD buff;
TCHAR szBuffer[SOME_SIZE] ;
HANDLE hr = CreateFile(L"c:\\a.txt",FILE_READ_DATA,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
ReadFile(hr,szBuffer,SOME_SIZE,&buff,NULL);
-- modified at 9:15 Friday 21st October, 2005
|
|
|
|