Results 1 to 7 of 7

Thread: Wm_activateapp !!

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    43

    Wm_activateapp !!

    Is there a code that prevents the user from activating a particular running application ?

    So let's say MS Word is running. I want to prevent Word from being activated either via the TaskBar, ALT + TAB , or any other way.

    I have already been experimenting with some subclassing code to intercept the WM_ACTIVATEAPP but I 've had no luck so far.

    Any working code anyone ?

    Please no DLLs solutions as I am using VBA.

    Thanks.

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Wm_activateapp !!

    Post #6 in this thread shows how I've used wm_activateapp - I got this solution from someone else on the forum here...

    In this implementation we are listening for that message on the "main" form of our own app - so we can determine when it is left and returned to. I would venture to guess you could listen for that message on other apps as well.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    43

    Re: Wm_activateapp !!

    Thanks,

    I think you forgot to add the link to the suggested Post !

    Anyway, it is easy to detect when the App is deactivated ...what is difficult is to detect which of the foreign running applications gets activated .

    Any thoughts ?

    Thanks.

  4. #4
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Re: Wm_activateapp !!

    Please no DLLs solutions as I am using VBA
    How are you doing subclassing in VBA? I didn't know that was possible.

  5. #5
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Wm_activateapp !!

    Quote Originally Posted by BLUE_SEA
    Thanks,

    I think you forgot to add the link to the suggested Post !

    Anyway, it is easy to detect when the App is deactivated ...what is difficult is to detect which of the foreign running applications gets activated .

    Any thoughts ?

    Thanks.
    oops - here's the link...

    http://www.vbforums.com/showthread.php?p=1975442

    Although I know nothing about VBA...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  6. #6

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    43

    Re: Wm_activateapp !!

    Quote Originally Posted by Merrion
    How are you doing subclassing in VBA? I didn't know that was possible.
    Well, Subclassing\Hooking Office applications\VBA is a nightmare and not fully supported but Yes, I have manged to get it working in a limited number of scenarios .

    Thanks.

  7. #7

    Thread Starter
    Member
    Join Date
    Dec 2005
    Posts
    43

    Re: Wm_activateapp !!

    Quote Originally Posted by szlamany
    oops - here's the link...

    http://www.vbforums.com/showthread.php?p=1975442

    Although I know nothing about VBA...

    As I said the callback procedure in your post only detects when the subclassed Application is activated or deactivated by checking the value of the uMsg and WParam .It doesn't actually retrieve the application being activated.

    According to the Documentation, If the Subclassed Application is being deactivated ie WParam=False then lParam is the identifier of the thread that owns the window being activated which is what I want to know.

    In theory this should work but I just can't make it work :

    I have searched this board and found a sugested solution using the RegisterShellHookWindow which I have tried implementing in EXCEL but I have been unsucceful so far.

    Any help anyone ?

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width