|
Hmmm. But I ran into another problem. Since I only needed Desktop's ListView (SysListView32) mouse events. I used WH_MOUSE because it can be thread specific whereas WH_MOUSE_LL can be global hook only that's why.
Now when I did this change, I'm not getting any events when I click on the desktop icons or anywhere in the desktop.
hookMouse = SetWindowsHookEx(WH_MOUSE, (HOOKPROC)InternalMouseHookCallback, g_appInstance, threadID);
Here g_appInstance is the address of the DLL. threadID is the ID of the thread in which there is the SysListView32 (which is the desktop). InternalMouseHookCallback is a callback of .NET function.
But now its not working. Please help me out. I'm using the Global System Hooks in .NET
|
|
|
|
|
The first parameter is wrong.
hookMouse = SetWindowsHookEx(WH_MOUSE, (HOOKPROC)InternalMouseHookCallback, g_appInstance, threadID);
You should handle "WM_MOUSE" in the "InternalMouseHookCallback".
|
|
|
|
|
|
transoft wrote: The first parameter is wrong.
No, WH_MOUSE is correct.
transoft wrote: You should handle "WM_MOUSE" in the "InternalMouseHookCallback".
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I am writing a C++ application using Win32 API (i.e. no MFC, no .NET). I want to process some major messages such as WM_PAINT, WM_MOUSEMOVE, and WM_CHAR in the dialog procedure (let's call it DialogProc). The dialog is created using DialogBox or DialogBoxIndirect in some cases, and DialogProc is passed as the fourth argument to DialogBox. My problem is these aforementioned messages (WM_PAINT etc.) are not passed to DialogProc. Is there any way to catch and handle these messages in a dialog box procedure? or do I have to create a dialog box using RegisterClass and CreateWindow? I appreciate your help.
|
|
|
|
|
You can try to register your class.
|
|
|
|
|
On Mac OS there is a command called "CreateWindowGroup" which allows you to group two or more windows together. These windows move, minimize and maximize as a single unit. I am looking for something similar for Windows. I am coding in C++
Does Windows have something like this built in or would I need to roll my own?
modified on Thursday, October 29, 2009 3:25 PM
|
|
|
|
|
shaosean wrote: ...would I need to roll my own?
Yes. See the example here. Basically it just enables/disables all controls that are contained within the group.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Not a group of controls, but a group of windows.. Open two NotePad windows up, move one of them and pretend the other one was moving too 
|
|
|
|
|
shaosean wrote: Not a group of controls, but a group of windows..
In Windows, everything is a window. You are referring to an application window rather than a control window.
shaosean wrote: Open two NotePad windows up, move one of them and pretend the other one was moving too
I've never seen such behavior.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
(I just started programming for Windows today so some of the lingo is a little different from one OS to the next)
Yes, an application window.. If everything is a window, would the same concept of grouping control windows work with application windows? Something for me to test out when I get back home..
|
|
|
|
|
shaosean wrote: If everything is a window, would the same concept of grouping control windows work with application windows?
Without digging into it deeper, I can't say for sure. If it is, I doubt it's 5-6 lines of code like that example I referenced.
Just out of curiosity, why would you want/need such behavior?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Two keep two windows linked together of course
The plugin I wrote on the Mac has this feature (part of the OS) and someone had requested this feature for Windows and seeing as I am starting the Windows version of the plugin I thought I would try to tackle it but it seems like I may need to wait for this feature..
|
|
|
|
|
shaosean wrote: Two keep two windows linked together of course
Admitingly, I've only been using Windows for 20 years, but in all that time, I've never had the need to link two separate windows together. Other peoples' mileage may vary, however.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I have used Windows since 2.0, Mac since 6.0 and have not really seen much of a need for this feature either, but since I started writing little C++ plugins for the language I normally code in I get all kinds of requests, this being one of them (they liked the feature in the Mac plugin and asked if I could do the same on Windows)
Thanks for all the replies but it looks like this is not something standard in Windows.. Anyone willing to try to do this? I have a whole 20 CAD in PayPal I can part with (I am jobless and only program for fun and learning)
|
|
|
|
|
shaosean wrote: Open two NotePad windows up, move one of them and pretend the other one was moving too
Two notepad windows means two different processes. You need to do some IPC for this.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I think the OP wrote that as an example ...
This signature was proudly tested on animals.
|
|
|
|
|
Yes it was an example.. As previously mentioned I am coming from a Mac background where two document windows in an application is only one process..
|
|
|
|
|
AFAIK, nothing in Windows do that.
You need to code that yourself; it's not technically that hard, but specifications and requirements can make it a b*tch to implement.
This signature was proudly tested on animals.
|
|
|
|
|
HI all,
In property sheet and property pages,the by default font is fixed,iwant to set Font "Verdana(8)" to all pages and propety sheet also.
so i m taking help of this article.
http://support.microsoft.com/kb/142170[^]
all thinngs are done ,now i want to bold the caption of groupbox those are placed on property pages.
but its not done.
so please help me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Le@rner wrote: now i want to bold the caption of groupbox those are placed on property pages.
See the Extras section of this article. It shows how to bold a static control. You can do the same thing for a button (i.e., group) control.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi,
how can i get handle to static control in combobox..
i tried
COMBOBOXINFO cbi;
cbi.cbSize = sizeof(COMBOBOXINFO);
m_ComboBox.GetComboBoxInfo(&cbi);
but cbi gives the handle for edit control but not static control....
Please help me regarding the same..
|
|
|
|
|
What static control do you mean?
A combobox doesn't have a static control.
Maybe you mean a label before the combobox?
|
|
|
|
|
Hi,
I'm creating a simple program wherein, the dialog contains only 2 elements, an edit box and a button(OK).
I've initiated a member variable for the edit box of the type 'int'.
After I run the application, enter a number and press OK, the number I've entered must be saved into the variable that I've already created.
After saving the number, the variable is used in a further part of the program, which is not relevant to this problem.
But the number is not being saved, resulting in halting the program.
Plzz help me in solving this problem.
Is my approach correct?
Thank You
|
|
|
|
|
Your approach does seem to be the correct one. I guess (as always) the devil's in the detail..
Don't know if you're using mfc or just plain c. Here's some code that works without mfc.
STEP 1: Create the main program window and the necessary controls.
#define IDC_EDIT 1001
HFONT hfont0 = CreateFont(-11, 0, 0, 0, 400, FALSE, FALSE, FALSE, 1, 400, 0, 0, 0, ("Ms Shell Dlg 2"));
hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_APPWINDOW, szClassName, "Dialog", WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU, 0, 0, 285, 78, 0, 0, hThisInstance, 0);
HWND hCtrl0_0 = CreateWindowEx(0, WC_BUTTON, ("OK"), WS_VISIBLE | WS_CHILD | WS_TABSTOP | 0x00000001, 234, 15, 35, 23, hwnd, (HMENU)IDOK, hThisInstance, 0);
HWND hCtrl0_1 = CreateWindowEx(0, WC_EDIT, 0, WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_BORDER | ES_AUTOHSCROLL, 162, 15, 66, 23, hwnd, (HMENU)IDC_EDIT, hThisInstance, 0);
HWND hCtrl0_2 = CreateWindowEx(0, WC_STATIC, ("Enter a +ive Int:"), WS_VISIBLE | WS_CHILD | WS_GROUP | SS_LEFT, 63, 24, 84, 13, hwnd, (HMENU)-1, hThisInstance, 0);
SendMessage(hCtrl0_0, WM_SETFONT, (WPARAM)hfont0, FALSE);
SendMessage(hCtrl0_1, WM_SETFONT, (WPARAM)hfont0, FALSE);
SendMessage(hCtrl0_2, WM_SETFONT, (WPARAM)hfont0, FALSE);
STEP 2: Handle the WM_COMMAND message in our message handling function
(and in this example, show the number entered as well as 2x the number entered)
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
tmp = GetDlgItemInt(hwnd, IDC_EDIT, &didSucceed, false);
sprintf(successStr, "%d\n2 * num = %d", tmp, tmp*2);
if (didSucceed)
MessageBox(NULL, successStr, "Number entered:", MB_OK);
else
MessageBox(NULL, "Invalid number!", "Error", MB_OK);
}
break;
modified on Thursday, October 29, 2009 10:37 PM
|
|
|
|
|