How to implement WM_CREATE message?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

How to implement WM_CREATE message?

Postby tiplip » Fri Apr 21, 2017 7:43 am

hi,

I want to add some hook with SetWindowsHookEx on WM_CREATE like:

Code: Select all
LRESULT CALLBACK RootWindowWin::RootWndProc(HWND hWnd, UINT message,
                                            WPARAM wParam, LPARAM lParam) {
  switch (message) {
    case WM_CREATE:
      keyboard_hook_ = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardProc, NULL, 0);
      break;


It seems fail, I set breakpoint on the line, but never hit, what's happend?

OS: Win7
Version: 2924
tiplip
Mentor
 
Posts: 77
Joined: Thu Mar 26, 2015 3:09 am

Re: How to implement WM_CREATE message?

Postby magreenblatt » Fri Apr 21, 2017 10:51 am

What are you trying to accomplish?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to implement WM_CREATE message?

Postby tiplip » Fri Apr 21, 2017 7:06 pm

magreenblatt wrote:What are you trying to accomplish?

I want to implement the case:

user double click Ctrl, cefclient will show or hide(minimized), that is, working like global hot key.
I hope cefclient.exe can response even though it is in background mode, say minimized, overlapped by other program or in tray system.
tiplip
Mentor
 
Posts: 77
Joined: Thu Mar 26, 2015 3:09 am

Re: How to implement WM_CREATE message?

Postby magreenblatt » Fri Apr 21, 2017 7:16 pm

You might have better success with RegisterHotKey.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to implement WM_CREATE message?

Postby tiplip » Fri Apr 21, 2017 7:31 pm

magreenblatt wrote:You might have better success with RegisterHotKey.

the problem is not what api should be used, now is WM_CREATE is not hit, so where can I place my code?
WM_CREATE message will not be listened by RootWindowWin::RootWndProc
and RegisterHotKey can not make it possible that cefclient still can response when it is not focused.
tiplip
Mentor
 
Posts: 77
Joined: Thu Mar 26, 2015 3:09 am

Re: How to implement WM_CREATE message?

Postby magreenblatt » Fri Apr 21, 2017 7:59 pm

You can put your code in RootWindowWin::CreateRootWindow after the CreateWindow call.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to implement WM_CREATE message?

Postby tiplip » Fri Apr 21, 2017 9:25 pm

magreenblatt wrote:You can put your code in RootWindowWin::CreateRootWindow after the CreateWindow call.

thanks, it works fine.
tiplip
Mentor
 
Posts: 77
Joined: Thu Mar 26, 2015 3:09 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 103 guests