|
That key handler (provided you've got a message map entry for it) will only trap key downs for the form view. The edit control is a different window.
Your choices here are:
- find a WM_COMMAND from the edit control that does what you want and handle that in the form view
- derive a class from CEdit and reflect messages from the form view into the control. Do a search for MFC message reflection to see how this works.
(This[^] isn't too bad about message reflection but it might be out of date).
Cheers,
Ash
|
|
|
|
|
i did add the WM_KDOWN but still nbothing happen when i press a key. I tried it with an application Based on CEditView and it works.
It seems a prob with The FormView Class
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Isn't CEditView "just" and edit control? Any messages from the edit control will be processed by the CEditView.
An edit control on a form view has an additional window involved. Key down message will be processed by the edit control and not the form view.
Cheers,
Ash
|
|
|
|
|
Ok, what u said is great and means that my edit control, normally, can implement the OnKeyDow function even if my form is CFormView Class. but based on my code (first message) nothing is happening.
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Yep, but your code for the handler is in your CFormView overide, not in a CEdit override.
What I'd do is...
- Derive a class from CEdit
- Add ON_WM_KEYDOWN to its message map
- Implement OnKeyDown
Snip, snip, Bob's yer Aunty.
Cheers,
Ash
PS: If you do implement it this way remember to call CEdit::OnKeyDown to allow the normal window procedure to handle the keystroke otherwise you'll cripple the behaviour of the edit control.
|
|
|
|
|
It seems the best way, after all spending 4 hours looking for a function or a sample code is stupid
I created a CEdit based class, called CTest in whhich i add the OnKeyDown(...) Now how could call it from the OnChangeEdit1 Function of my CFormView? PS: I need to pass the 3 parameters UINT of OnKeyDown << Newbie question sorry
"The Ultimate Limit Is Only Your Imagination."
modified on Tuesday, June 8, 2010 1:36 PM
|
|
|
|
|
what about PreTranslateMessage ??
how could i know the key pressed by the user ??
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
You don't need to use PreTranslateMessage - that's for doing something global to a message before it's processed by a window.
Cheers,
Ash
|
|
|
|
|
I used to get the version and copyright from the resource files using the following
char ThisProgramsName[256]="";
GetModuleFileName(AfxGetInstanceHandle(),ThisProgramsName,256);
DWORD dwHandle = 0;
DWORD dwSize = GetFileVersionInfoSize( ThisProgramsName,&dwHandle );
if(dwSize!=0L) {
UINT uVerInfoSize;
char *lpVerInfo = new char[dwSize];
GetFileVersionInfo(ThisProgramsName, dwHandle, dwSize,lpVerInfo );
The libraries have all changed in VS2010. What do I need to link to satisfy these calls, or has the method of retrieving this information changed.
Same question for GetAdapters
This is the old code
PIP_ADAPTER_INFO pAdapterInfo;
PIP_ADAPTER_INFO pAdapter = NULL;
DWORD dwRetVal = 0;
UINT i;
unsigned long LowestHexIP, PossibleIP;
char MacByte[4], MacID[16], LowestMacID[16];
ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);
pAdapterInfo = (IP_ADAPTER_INFO *) MALLOC (sizeof(IP_ADAPTER_INFO));
// Make an initial call to GetAdaptersInfo to get
// the necessary size into the ulOutBufLen variable
if (GetAdaptersInfo (pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW) {
FREE (pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) MALLOC (ulOutBufLen);
}
ES
|
|
|
|
|
Ed SHaw wrote: The libraries have all changed in VS2010.
I'm not sure this is strictly accurate, according to the GetFileVersionInfo[^] page on MSDN you need Version.lib, and I know from my own projects that this has not changed for some time. I expect GetAdapters will have a similar information page that you can look at.
It's time for a new signature.
|
|
|
|
|
Do you know where I can download the latest version.lib and IPHlpApi.lib for both win32 and x64?
|
|
|
|
|
All these libraries are part of the standard SDK, which (in my case) came automatically with Visual Studio 2010. If you did not get them in this way I guess you need to go to MSDN and search for "Platform SDK".
It's time for a new signature.
|
|
|
|
|
Ed SHaw wrote: What do I need to link to satisfy these calls...
What linker error(s) are you receiving?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Undefined's for GetFileVersionInfoSize(), GetFileVersionInfo(), VerQueryValue()and GetAdaptersInfo().
I think I need version.lib and IPHlpApi.lib for x64 build. I put in the old version for win32 and they build and run ok. I expected new versions of everything with new VS2010
Ed
|
|
|
|
|
Hi
how to catch access violation exception
|
|
|
|
|
Same replies as earlier...
|
|
|
|
|
You can use the function: SetUnhandledExceptionFilter to catch. Then use MiniDumpWriteDump to dump exception to a file.
|
|
|
|
|
...or you could use longjmp which should be portable.
|
|
|
|
|
Hello All,
I made a service which keep track of logon, logoff, lock and unlock notification.. I want to extract the logged on user name when user logged on, lock or unlock system.. So i'm using GetUserName in respective cases, but it returns me "SYSTEM" every time..
What could be the reason?
Thanks...
|
|
|
|
|
Maybe because your service executes under the SYSTEM account?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Have you looked at the ISensLogon interface?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Environment.UserName will return the current user name
|
|
|
|
|
Thanks Everyone, I now used WTSQuerySessionInformationA
|
|
|
|
|
I installed a simple (and quite old application) on Windows 7 (UAC is enable) and it is not saved a simple text file (a simple LOG file) on C:\ !
I'm sure that the problem is related on UAC because disabling it the program runs well.
So, how to bypass the UAC and have the permission to write that file?
I suppose it can be also difficult to manage the registry, there is also in this case some special procedure to use?
thanks...
Russell
|
|
|
|
|