|
This line is incorrect:
<br />
KBDLLHOOKSTRUCT hooked *= *((KBDLLHOOKSTRUCT*)lParam);<br />
Change it to:
<br />
KBDLLHOOKSTRUCT* hooked = (KBDLLHOOKSTRUCT*)lParam;<br />
This should clear up the errors.
Regards,
-John
|
|
|
|
|
Also, your IF statements are goofed up...
Which immediately lets me know you did not turn your warning level to 4 or you are ignoring WARNINGS during your mopile, because the compiler would otherwise warn you about "Assignment within conditional expression".
Try changing this:
if( (nCode= HC_ACTION) && ( (wParam = WM_SYSKEYDOWN) || (wParam = WM_KEYDOWN) ) )
to this:
if( (nCode == HC_ACTION) && ( (wParam == WM_SYSKEYDOWN) || (wParam == WM_KEYDOWN) ) )
I usually try to place the contant on the left hand side, because such code will NOT compile if you made such a similar error:
if( (HC_ACTION == nCode) && ( (WM_SYSKEYDOWN == wParam) || (WM_KEYDOWN == wParam) ) )
Since your IF is wacked, you are probably processing messages you should not be, at times.
|
|
|
|
|
I have figured out how to spy on an apps menu for remote control, but cannot determine how to do the same for the apps context menus.
How do you determine the commands sent from a context menu?
|
|
|
|
|
You can call TrackPopupmenu with TPM_RETURNCMD , and it'll return the menu item id. You may also want to take a look at TPM_NONOTIFY .
--
Arigato gozaimashita!
|
|
|
|
|
I actually need a command I can track in Spy++ don't I? I'm actually coding in C++. From what I can tell, these are C# functions.
As an example of what I need to do, I want in my program, to fire off a simulated right click to say a notepad window, and command "paste" at a specified position using the context menu.
The program I will actually be doing this with does not have a standard menu command for what I need to do, and this is only available in a context menu.
|
|
|
|
|
I misread the original post. My appologies.
--
Arigato gozaimashita!
|
|
|
|
|
No Problem!
I appriciate the attempt, but can anyone tell me if this is even do-able? And if so, how?
|
|
|
|
|
Have you had a look at SetWindowsHookEx and its option WH_SYSMSGFILTER ?
WH_SYSMSGFILTER
Installs a hook procedure that monitors messages generated as a
result of an input event in a dialog box, message box, menu, or
scroll bar. The hook procedure monitors these messages for all
applications in the same desktop as the calling thread. For more
information, see the SysMsgProc hook procedure.
--
Arigato gozaimashita!
|
|
|
|
|
No, I have not, but will!
My main goal was to find out the parameters necessary to send to replicate the mouse click of the actual context menus menu item. If these will work, then great!
|
|
|
|
|
I have a subclassed listctrl in a dialog. In the listctrl class I handle the WM_MOUSEMOVE msg. When I move the mouse over the listctrl I get the WM_MOUSEMOVE msgs but only when I don't have any mouse button pressed. As soon as I get the WM_LBUTTONDOWN msg the WM_MOUSEMOVE messages stop coming until I let go of the mouse button. Why? I want to get the WM_MOUSEMOVE msgs also when I have the mouse button down, and I know I should get them but why don't I? Also the WM_LBUTTONUP doesn't come unless I double click the control.
Suggestions welcome.
|
|
|
|
|
ski2sky wrote:
As soon as I get the WM_LBUTTONDOWN msg the WM_MOUSEMOVE messages stop coming until I let go of the mouse button. Why?
This is because of the way the list control processes mouse messages. When it receives a WM_LBUTTONDOWN , it goes into a local message loop, checking for mouse messages and acting on them without passing them to DispatchMessage() . This means that the message does not go through the normal message processing and consequently you don't see them.
ski2sky wrote:
Also the WM_LBUTTONUP doesn't come unless I double click the control.
This is because of the same reason. The local message loop processes the WM_LBUTTONUP message without dispatching it, so you don't get it. Windows sends the following sequence of messages for a double click:
WM_LBUTTONDOWN WM_LBUTTONUP WM_LBUTTONDBLCLK WM_LBUTTONDOWN So the local message handler exits when the first WM_LBUTTONUP is received, so your application will get the second one as there is no further WM_LBUTTONDOWN message to start the local message handler.
ski2sky wrote:
I want to get the WM_MOUSEMOVE msgs also when I have the mouse button down
The only way I can see to get around this is to install a WH_GETMESSAGE hook on your thread.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
Is there any way to use icons in a CImageList instead of bitmaps?
[insert witty comment here]
bdiamond
|
|
|
|
|
Yes. You create an image list that can expand and use
imgList.Add(HICON)
If you vote me down, my score will only get lower
|
|
|
|
|
What Roger said. You can also use the macro ImageList_AddIcon() .
FWIW, I've found icons to be more pleasant to work with than bitmaps. You don't have to deal with separate masks or transparent colors.
Another nice benefit with icons is that when you load icons from the resources, the icon loader pays respect to the current bit depth of the screen. This means that Windows will pick out the icon which best matches the current screen bit depth.
--
Arigato gozaimashita!
|
|
|
|
|
Shorah All
I new to everything I just got MS Visual C++ .net and when I compiler my first Program.
I got syntax errors like iosteam.h is not declare. used Visual c++ ver 6.0
and there is a way to link other files and lib to the program.
I look for the same thing in the menus but cant find them.
come some one please tell is there a book for the comlier I can read or web site I can goto.
Please dont tell me goto MicroSoft Cor.
It one big frustration and I get lost and side tract.
|
|
|
|
|
Hey guys...How would I go about writing this method in the .cpp file?
METHOD
playTurn gives a player the opportunity to place a chip into the board. This should be a Boolean function to return true if this turn produces a winner (otherwise false should be the return value).
This is what I have for the .h file ...is it right?
bool playTurn();
I'm Not very good with bool.
|
|
|
|
|
That looks fine to me. You can treat a bool as you would nay other type. Its just limited in values, false or true
If you vote me down, my score will only get lower
|
|
|
|
|
Hi,Dears
How can i use Edit Control in View of SDI application?
Or How can i use View of SDI application such as Edit Control?
Best Regards.
MJM.
|
|
|
|
|
mostafa_pasha wrote:
How can i use Edit Control in View of SDI application?
Use a CFormView -based view.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks For your attention.
But when i use CFormView class , alerted me
CFormView does not support Printing service !
this means i write routin to support Printing ?
Best Regards.
MJM.
|
|
|
|
|
It helps to keep threads short by mentioning all of your requirements up front, rather than one at a time.
mostafa_pasha wrote:
CFormView does not support Printing service !
By default, printing and print preview are not supported by the CFormView class. To add printing support, override the OnPrint() method in your derived class.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks a lot.
But u say Threads!
i am writing application that use serial port to communicate
with PC.
I use two threads for Write and Read but i do not know how can i
Synchronize between these threads !
I wanna use Critical section But i do not have any expirement can u
know refrence or example about these?
Best Regards. ;)
MJM.
|
|
|
|
|
mostafa_pasha wrote:
But u say Threads!
Not that kind of thread. A thread is a set of posts on a newsgroup, composed of an initial post about a topic and all responses to it.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Oh, sorry to barge in on this thread. But this is something that is coming up that I'll eventually have to do also. I thought I remember being able to add printing support for a CFormView-based app in VC6, but now in VC7, I'm told the support won't be available. I haven't done anything with built-in print and print preview in a while, but in my OnPrint() how would I be able to use MFC's print preview? instead of the regular printer? Before it was pretty much taken care of for you.
BTW, there was also a feature in VC6 where you could make a custom appwizard and select "base on existing project" so that once I had the barebones code for a certain type of app, I could more or less make a template for that app a lot easier. I don't see this anymore either, and it makes me
[insert witty comment here]
bdiamond
|
|
|
|