|
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
|
|
|
|
|
prasad_som wrote: ReadFile(hr,&szBuffer,SIZE,&buff,NULL);
Check the second and third parameters. They should be:
ReadFile(hr, szBuffer, sizeof(szBuffer), &buff, NULL);
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Check the second and third parameters
yes, thanks David.Its corrected now.
|
|
|
|
|
Hello guys,
I have a MFC dialog based application , where I want to play *.avi files.
Suppose I have a button "Load video" and after clicking it and choosing the specified *.avi file , I want to be able to play(pause,stop) the video in my dialog.
Any suggestions on how to do it?
PS. I had problems with CAnimateCtrl , When I tried to Open the file :
if(!m_animate.Open("c:\\file.avi"))
MessageBox("Could not open video");
I got the latter MessageBox. Though file.avi existed on C: disk.
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
-- modified at 7:44 Friday 21st October, 2005
|
|
|
|
|
Just a check.
Does file runs in media player?
Do you have necessary rights on file?
|
|
|
|
|
prasad_som wrote:
Does file runs in media player?
yes it does.
But is not there another way to play *.avi files without using CAnimateCtrl
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
why dont u try using windows media player activex control
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
I do not have any experience with using ActiveX controls.
Could you give me little tips on how to do this, I am using Visual Studio.Net 2003.
Thanks in advance
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
in the dialog editor view, right click on the tool bar panel, choose add/remove items. on the next dialog, choose com components tab and tick windows media player in the list. click ok and then u can use it like any other control.
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
thanks for help , but on little thing more.
i have done everything but when I write m_player.openPlayer("c:\\file.avi"); New instance of MediaPlayer is opened and the file is played there.
But I need the video to be played inside my dialog so I thought this should do the job :
m_player.launchURL("c:\\file.avi");
But I get a error MessageBox with empty text
Do you have any idea what is wrong??
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
-- modified at 8:59 Friday 21st October, 2005
|
|
|
|
|
Giorgi Moniava wrote: Do you have any idea what is wrong??
Yes, you need to use the setURL() method.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|