Click here to Skip to main content
15,914,222 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: Wizard Control in vc++ express Pin
led mike14-Sep-06 8:11
led mike14-Sep-06 8:11 
Questionbios.h and terminos.h in Dev c++ compiler Pin
prashw13-Sep-06 21:55
prashw13-Sep-06 21:55 
AnswerRe: bios.h and terminos.h in Dev c++ compiler Pin
Christian Graus14-Sep-06 19:32
protectorChristian Graus14-Sep-06 19:32 
Questionalternate code for cp command Pin
vinod_kumar23313-Sep-06 1:40
vinod_kumar23313-Sep-06 1:40 
AnswerRe: alternate code for cp command Pin
Christian Graus14-Sep-06 19:35
protectorChristian Graus14-Sep-06 19:35 
GeneralRe: alternate code for cp command Pin
vinod_kumar23314-Sep-06 21:44
vinod_kumar23314-Sep-06 21:44 
GeneralRe: alternate code for cp command Pin
Christian Graus14-Sep-06 22:20
protectorChristian Graus14-Sep-06 22:20 
QuestionGlobal hook for system menu events Pin
Harshabhi12-Sep-06 15:22
Harshabhi12-Sep-06 15:22 
Hi all,

I am trying to get an event in my application when the user clicks system menu of any window. I have tried to implement this using global hooks. I have made a DLL which is installing hook in the following manner:

HINSTANCE hins;
BOOL __declspec(dllexport)__stdcall installhook()
{
hkb=SetWindowsHookEx(WH_SYSMSGFILTER,(HOOKPROC)SysMsgProc,hins,0);
//hkb=SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTProc,hins,0);
return TRUE;
}
where hins takes value from:
BOOL CHookdllApp::InitInstance ()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
hins = AfxGetInstanceHandle();
return TRUE;

}

The Callback function:

LRESULT __declspec(dllexport)__stdcall CALLBACK SysMsgProc(int nCode, WPARAM wParam, LPARAM lParam)
{

if(MSGF_MENU == nCode)
{
LPMSG msg = (LPMSG)lParam;
//if(WM_MENUSELECT == msg->message)
//if(WM_MENUCOMMAND == msg->message)
if(WM_SYSCOMMAND == msg->message)
{
OutputDebugString("\n Got it!! \n");

}
}
return CallNextHookEx( hkb, nCode, wParam, lParam );

}

In this callback function, I get the event WM_MENUSELECT from all windows but I am not getting WM_SYSCOMMAND event which I need because I want the event when user clicks the system menu of any window.

I also tried using WH_CBT, the callback function for this is:

LRESULT __declspec(dllexport)__stdcall CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if(nCode < 0)
{
return CallNextHookEx( hkb, nCode, wParam, lParam );
}

else if(HCBT_SYSCOMMAND == nCode)
{
OutputDebugString("\n Got it!! \n");
}
return 0;

}
The problem with this hook is that I am getting events for the menu click from my application only and not from any other window.

Is there any way I can get these events?
Thanks in advance for yr help!
QuestionStatus window in DLL Pin
mparent12-Sep-06 11:45
mparent12-Sep-06 11:45 
Questionlistview and columns Pin
aguest12-Sep-06 11:26
aguest12-Sep-06 11:26 
QuestionReferenced namespace in another project not linking Pin
Klempie12-Sep-06 2:49
Klempie12-Sep-06 2:49 
QuestionMaking a dot net wrapper [modified] Pin
User 58385211-Sep-06 15:25
User 58385211-Sep-06 15:25 
AnswerRe: Making a dot net wrapper Pin
User 58385211-Sep-06 19:50
User 58385211-Sep-06 19:50 
QuestionTree View Control Pin
LakshmiPathiRao10-Sep-06 21:52
LakshmiPathiRao10-Sep-06 21:52 
AnswerRe: Tree View Control Pin
shezh12-Sep-06 5:25
shezh12-Sep-06 5:25 
QuestionStrange template behaviour? [modified] Pin
Zigenstein10-Sep-06 19:59
Zigenstein10-Sep-06 19:59 
AnswerRe: Strange template behaviour? [modified] Pin
George L. Jackson13-Sep-06 15:36
George L. Jackson13-Sep-06 15:36 
Questionstrange behaviour!!!!!!!!! Pin
hadez80310-Sep-06 13:02
hadez80310-Sep-06 13:02 
AnswerRe: strange behaviour!!!!!!!!! Pin
bob1697210-Sep-06 14:20
bob1697210-Sep-06 14:20 
Questiontic-tac-toe Pin
SwatiPathania10-Sep-06 5:50
SwatiPathania10-Sep-06 5:50 
AnswerRe: tic-tac-toe Pin
toxcct10-Sep-06 6:47
toxcct10-Sep-06 6:47 
QuestionHow can I make an editor, using C++? Pin
SwatiPathania10-Sep-06 5:49
SwatiPathania10-Sep-06 5:49 
QuestionSeeking hands Pin
kcynic8-Sep-06 21:40
kcynic8-Sep-06 21:40 
AnswerRe: Seeking hands Pin
toxcct10-Sep-06 6:50
toxcct10-Sep-06 6:50 
QuestionVC++ Express and GTK+ Pin
delphidab8-Sep-06 14:21
delphidab8-Sep-06 14:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.