|
Thanks, making those changes it works great. Also, if I selectively don't return -1 while blocking the messages, the cursor moves and I get the coordinates I need. Thanks again for all you help and patience!
By the way, sometimes after removing the hook the start key is mapped to escape, even though I didn't touch those, it goes away after a little bit, but I was wondering if that was my fault or just a sympton?
-Aaron
modified 12-Jul-20 21:01pm.
|
|
|
|
|
Inside your hook functions, if you modify the lParam to post to your window, you should use a temporary variable like mylParam, instead of modifying the ORIGINAL lParam, in case you need to contionue to pass the original lParam onto the next keyboard hook. Possibly that has happened - you changed the original lParam, so there is now a side effect? Or you changed the data that was being pointed to by the hook structure. You should not modify the original data if you pass it on to the next hook handler.
|
|
|
|
|
I don't actually modify the lParam at anypoint, I just copy it and pass it on.
modified 12-Jul-20 21:01pm.
|
|
|
|
|
Well,I've personally been trying to modify the original lParam in order to change key presses. In some instances, I need to change an "L" press to an "S". I thought that by installing a low level keyboardhook, I would be able to do this. I can eat the keypresses, so I know that my hook is installed, but I can't seem to get the substitution to occur.
Regardless of how I change the lParam, the original keypress still happens. I've tried changing the vkCode and scanCode to different keys, and I can see that the changes are there in my callnexthook, but I don't see any changes in the key output.
I've been attempting forever and I can't seem to get it to work. I've tried creating my own lParam with the necessary info and passing that -- still without it working. I really feel like I'm missing something fundamental.
|
|
|
|
|
I am sorry, but I do not know.
I reviewd the MSDN documentation and could not locate anything to confirm or deny that you SHOULD be able to modify the input. A whole lot of talk about passing it on or denying, but nothing about modification. We used our hook for blocking purposes only.
|
|
|
|
|
The delay in your release of the keys might be a symptom of this, directly from MSDN:
"You can release a global hook procedure by using UnhookWindowsHookEx, but this function does not free the DLL containing the hook procedure. This is because global hook procedures are called in the process context of every application in the desktop, causing an implicit call to the LoadLibrary function for all of those processes. Because a call to the FreeLibrary function cannot be made for another process, there is then no way to free the DLL. The system eventually frees the DLL after all processes explicitly linked to the DLL have either terminated or called FreeLibrary and all processes that called the hook procedure have resumed processing outside the DLL."
|
|
|
|
|
AM super new to the MFC
but i like it cause it easy to learn
so am making a project
i have 2 edit box and i want to write to 2 different files how will i do this with out removing all the data
for the file.
a small code sample will help alot
thanks alot
|
|
|
|
|
There are several solutions. Using raw C++, you could open the file in binary mode, seek the end of the file pointer, and append data.
Kuphryn
|
|
|
|
|
|
Can anyone direct me to a source that explains ways to code 'zoom ins and outs'? What I basically need is an algorithm to blow up or shrink down an image by clicking a button or, better, by rubberbanding an area of the image.
Thanks,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
Just type cximage in search box it will take you to the project which does all this and more
|
|
|
|
|
StretchBlt is all you need.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
StretchBlt is all you need.
But it's non-intelligent in its operation as it doesn't resample the image but merely cuts pixels off or blows pixels up. CxImage[^] gets my vote.
--
Dad, how strange it is that the pig can speak. *thoughtful pause* It must have lost its "oink". (my 3-year old daughter Moa, while watching Babe)
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
Johann Gerell wrote:
But it's non-intelligent in its operation
True, but we're assuming that this guy needs the complexity that comes from adding another class to his project ( not saying that CxImage is hard to use, I've not looked at it ). If you set the right stretch mode, StretchBlt gives reasonable results, why uses a jack hammer to nail in a tack ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
If you set the right stretch mode, StretchBlt gives reasonable results
Well, I develop for CE, where the stretch mode can't be set (it's carved in stone).
Christian Graus wrote:
why uses a jack hammer to nail in a tack
That's often the normal scenario when dealing with CE's limited API set.
Anyway, the resampling code can easily be broken out from CxImage and be used separately.
--
Dad, how strange it is that the pig can speak. *thoughtful pause* It must have lost its "oink". (my 3-year old daughter Moa, while watching Babe)
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
Johann Gerell wrote:
Well, I develop for CE, where the stretch mode can't be set (it's carved in stone).
That's a whole different ball game then
Johann Gerell wrote:
That's often the normal scenario when dealing with CE's limited API set.
*grin* well, no-one had mentioned CE before this, so...
Johann Gerell wrote:
Anyway, the resampling code can easily be broken out from CxImage and be used separately.
Sure - that stuff is pretty easy to write in any case.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Thanks for all that discussion. I'll try both, one for a quick and dirty image processing and the other for situations when a more accurate processing is justified. Best,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
Christian Graus wrote:
*grin* well, no-one had mentioned CE before this, so...
No, but you asked for a scenario when the big hammer must be used, so...
--
Dad, how strange it is that the pig can speak. *thoughtful pause* It must have lost its "oink". (my 3-year old daughter Moa, while watching Babe)
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
Hello All,
Can someone suggest a fast ways to convert big endian to small endina? Thanks!
Nachi
|
|
|
|
|
there is a bswap ASM instruction, however, this might not be the fastest way on all architectures.
DWORD SwapEnidan(DWORD x)
{
__asm mov eax, x
__asm bswap eax
__asm mov x, eax
return x;
}
Another option (that could be better if you have to convert many values and unroll the loop by two) would be splitting into bytes and shifting around:
DWORD x = ...;
DWORD swapped = ((x & 0x000000FF) << 24) |
((x & 0x0000FF00) << 8) |
((x & 0x00FF0000) >> 8) |
((x & 0xFF000000) >> 24));
I don't think that XCHG or "manually" swapping bytes is faster.
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
I have a SDI application with a tab view. I make a call to a function that I call GetGrandParent().
The call and function is shown below.
//function is called here...
// parent is Tab Control, grandparent is Tab View
//m_pTabViewWnd = (CTabVw *)GetGrandParent();<---problem here???
//////////////////////////////////////////////
//function
CWnd* CSmsPropPage::GetGrandParent()
{
CWnd *parent= GetParent(); // tab control is the parent
return parent->GetParent(); // tab view is the grandparent
}
In debug the pointer returned is fine, the application runs...but in release mode, the pointer is invalid.
As a matter of fact a call to GetGrandParent() in Release mode causes the debugger to step into a function called:
CWnd * PASCAL CWnd::FromHandler(HWnd hWnd). The program doesnt actually step in GetGrandParent() in Release Mode.
I have the compiler set up so that I can debug in Release Mode.
Does anyone have any idea why the pointer is invalid in Release Mode, and why FromHandler() is called?
Thanks.
Jerry
|
|
|
|
|
What is CSmsPropPage? Is that a separate dialog window? Post the code that creates it.
Kuphryn
|
|
|
|
|
Im building a C++ DLL for visual basic
i cant get this to work, why ?
yes i now im not good with C++
I now i can call SendMessage with visual basic ( thats easy )
I need to go around a bug, This message just wont work
with visual basic
i did find webpage's with this problem
(HWND_BROADCAST ,WM_SETTINGCHANGE,SPI_SETNONCLIENTMETRICS,NULL);
How can i pass the variables to SendMessage ?
#include <windows.h>
long __stdcall main (int hWnd, int Msg, int wParam, int lParam)
{
::SendMessage(hWnd, Msg, wParam, lParam);
return 0;
}
plz help,
Greets jeroen
|
|
|
|
|
soul_ripper wrote:
How can i pass the variables to SendMessage ?
I don't understand the question !!
pass them as you do with any other function
more explanation/code will help us understanding your problem.
|
|
|
|
|
soul_ripper wrote:
Im building a C++ DLL for visual basic
Do you mean a C++ DLL that will be used by VB? If you mean something different, please explain so that we do not provide you with unnecessary suggestions.
soul_ripper wrote:
I need to go around a bug, This message just wont work
with visual basic
Which message is problematic?
soul_ripper wrote:
long __stdcall main (int hWnd, int Msg, int wParam, int lParam)
{
::SendMessage(hWnd, Msg, wParam, lParam);
return 0;
}
The parameters passed to main() are int , char ** , and char ** .
That aside, the first parameter to SendMessage() must be a valid window handle, or HWND_BROADCAST if you want all top-level windows to receive the message, that has a message pump.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|