Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    stop the user exiting an application

    I need to prevent a user from running more than one application at a time. In windows 95 there was apparently a 'system modal' function that forced a window(application) to be closed before another could be opened. Is there an equivalent in win98 ?

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    Hey, I have a great idea! Get that user an IBM model 51 (the PC) with 640K of RAM and DOS 2.1. That's more than enough power to run 1 app. And they'll be forced to run one program at a time (unless they figure out how to load SideKick -- then they'll be able to hot-key to that snazzy TSR notepad and calculator).

    (I hope you can see me grinning and having a bit of fun at your expense. Sorry, I couldn't resist.) <img src=/S/rofl.gif border=0 alt=rofl width=15 height=15>
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    Fr Jack,
    <img src=/w3timages/greenline.gif width=33% height=2>

    From a Microsoft Visual Basic for Windows program under Windows 95, Windows 98, or Windows 3.x, you can disable the ability to switch to other Windows programs by calling the Windows API function SetSysModalWindow. The method outlined below will not work with Windows NT.

    <img src=/w3timages/greenline.gif width=33% height=2>
    That is the intro to <A target="_blank" HREF=http://support.microsoft.com/support/kb/articles/q147/8/17.asp?>Q147817</A> so check it out if it looks like what you want.

    Hope it helps

    Andrew C

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    Fatherjack,

    Seriously, though, you can accomplish this quite easily if you've got access to (and knowledge of) the Windows System Policy Editor. It's a part of the Windows Resource Kit (at least it was prior to Win2000). It's a powerful tool for configuring clients by computer, user or groups of the same.

    The poledit.exe program is actually a registry editor, so the settings you need to accomplish the one program thing are registry-based. The Policy Editor just gives you UI access to the hives. You're going to have to do some research at MS to get properly informed. Keep in mind, you can use this tool on a stand-alone computer -- you don't have to manage policies remotely. This might get you started:
    <A target="_blank" HREF=http://www.microsoft.com/WINDOWS2000/library/resources/reskit/samplechapters/dsec/dsec_pol_nrqn.asp>http://www.microsoft.com/WINDOWS2000/libra...ec_pol_nrqn.asp</A>
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    I've got more info for you on System Policies that might interest you.

    On a Win2k box run poledit.exe (very similar on 9x and ME)

    Click Options>Policy Template>Add

    Select common.adm. Click Ok

    Open the Default User icon

    Click down the tree: System>Restrictions

    Check the box: Run Only Allowed Windows Applications

    You'll get a list box into which you can put the app.exe. Then ONLY that app will be able to start on that PC for that user.

    How's that?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    genius, why didnt i think of it sooner. There should be plenty of those going cheep, and think of the budget saving for 300 staff !!!!

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    This looks good but how do i identify the hwnd value ?
    Is that the value returned by the shell command ?

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    Kevin, you've done a lot with this, many thanks,
    I tried policies but ran into this problem...
    I am writing an app that will replace the windows desktop and provide icons to click on to launch various apps.
    now the tricky bit, i dont want the people to leave the app that they launch by any means other than closing it. If they do currently then it goes to the back of the z-order and they are then able to launch a 2nd,3rd,4th.. instance which causes crashes. Once they close an app then they should be able to launch another window(same app or different)from my app.
    I think the SetSysModalWindow dohicky suggested above may be what i need if is can sort out what hwnd is for each launch.

  9. #9
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    Declare Function GetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long

    The above function can be called the get the handle to the active window,so you could use

    Success% = SetSysModalWindow(GetActiveWindow)

    Or in a similar vein , Declare Function GetFocus Lib "user32" Alias "GetFocus" () As Long.

    Take a look at <A target="_blank" HREF=http://www.allapi.net/api/grpWindowHandles.php>Window Handles</A> at AllAPI.Net for other possible calls to suit your exact circumstances.

    Andrew

  10. #10
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    Andrew, how does this tie in with your suggestion ?
    <A target="_blank" HREF=http://msdn.microsoft.com/library/psdk/winui/windows_9g6v.htm>http://msdn.microsoft.com/library/psdk/win...indows_9g6v.htm</A>
    back to the drawing board maybe ?

  11. #11
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    What is the significance of success% ?
    is this just a variable to contain a returned value indicationg success or failure or am i missing the point ?

  12. #12
    kelliel
    Guest

    Re: stop the user exiting an application

    http://www.allapi.net

    What a great resource. Thanks

  13. #13
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    FatherJack

    It ties in by providing the hWnd value (the window handle) which identifies the actual window. I think that is what you asked with <This looks good but how do i identify the hwnd value ?>. Which function is best would depend on the nature of the Window. Before experimenting too much be prepared for a possible system freeze.

    Re success% = you are not missing the point, you described it correctly.

    Andrew

  14. #14
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: stop the user exiting an application

    Lawrence,

    If you have not already, then doownload the <A target="_blank" HREF=http://www.allapi.net/agnet/apiguide.php>API-Guide
    </A> a searchable database of calls. It may not be totally exhaustive but has much valuable information.

    Andrew

  15. #15
    kelliel
    Guest

    Re: stop the user exiting an application

    Thanks. When I went to ALLAPI.net, I saw the guide. Downloaded it.

    great tool

Page 1 of 2 12 LastLast

Posting Permissions

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