DonationCoder.com Forum

DonationCoder.com Software => Coding Snacks => Post New Requests Here => Topic started by: Uncle John on June 01, 2006, 05:10 PM

Title: IDEA: WinCovers
Post by: Uncle John on June 01, 2006, 05:10 PM
The idea is to prevent users of a PC making changes to the settings of an application.
 
For example, the following picture shows the Windows Calculator in the default Scientific view:

[ You are not allowed to view attachments ]

This picture shows Windows Calculator with some WinCovers added:

[ You are not allowed to view attachments ]

The "covers" prevent users altering selected calculator settings.
Title: Re: IDEA: WinCovers
Post by: nudone on June 01, 2006, 05:35 PM
are your images working, Uncle John?

(they don't appear to be there in my browser.)
Title: Re: IDEA: WinCovers
Post by: mouser on June 01, 2006, 05:36 PM
i see them ok - it's an interesting idea.. is the intended use to prevent yourself from changing stuff, or prevent others from modifying stuff you don't want them to?
Title: Re: IDEA: WinCovers
Post by: Veign on June 01, 2006, 06:15 PM
I don't see the pictures either

(using Firefox)
Title: Re: IDEA: WinCovers
Post by: mouser on June 01, 2006, 06:18 PM
it's probably an issue with firefox, since the images are non-standard links
http://f3.yahoofs.com/users/41c4b6f9zd4142693/1c43scd/__sr_/845dscd.jpg?phop2fEB9u00Navh
http://f3.yahoofs.com/users/41c4b6f9zd4142693/1c43scd/__sr_/e0c0scd.jpg?phop2fEBFZLPpbFh

anyone want to recommend a better image uploader site for uncle john;
alternatively john you can just upload and attach images to posts.
Title: Re: IDEA: WinCovers
Post by: skrommel on June 01, 2006, 06:48 PM
 :tellme: I can't see the images either.

Skrommel
Title: Re: IDEA: WinCovers
Post by: app103 on June 01, 2006, 07:07 PM
anyone want to recommend a better image uploader site for uncle john;
alternatively john you can just upload and attach images to posts.

http://www.imageshack.us

You don't need an account and they have a tool that will put the option to upload an image right on the context menu of explorer, if you would like that better (I do).
Title: Re: IDEA: WinCovers
Post by: nudone on June 02, 2006, 02:30 AM
i'm using maxthon (internet explorer engine) and can't see the pictures so it's not just a firefox issue.
Title: Re: IDEA: WinCovers
Post by: jgpaiva on June 02, 2006, 03:00 AM
I'm using opera, and right now i can't see them too. But the curious part is that yesterday i could!  ;D
Title: Re: IDEA: WinCovers
Post by: Uncle John on June 02, 2006, 03:06 AM
Sorry.....Should be able to see the pictures now.
Title: Re: IDEA: WinCovers
Post by: skrommel on June 02, 2006, 03:35 AM
 :tellme: Do you want the actual covers, or is graying/disabling OK? If so I could extend NoClose for this use.

Covers could be needed for non-standard controls, though.

Skrommel
Title: Re: IDEA: WinCovers
Post by: Uncle John on June 02, 2006, 04:08 AM
Covers would be better since users would not be tempted to ask "What does this button do?"
I'm thinking of a situation where you are training a user to use an application. First you take them through the basic features. Then the intermediate features. And then the advanced features. It would help for them to not have distractions as they progress through each stage.   
Title: Re: IDEA: WinCovers
Post by: skrommel on June 02, 2006, 01:24 PM
 :tellme: How about hiding them all together?

Skrommel
Title: Re: IDEA: WinCovers
Post by: Uncle John on June 02, 2006, 04:48 PM
That's even more ambitious.
I suspect this utility will be very popular so the extra programming involved would be worthwhile. :Thmbsup:

-----------------------------------------------------------------------------------
"Satire is a sort of glass, wherein beholders do generally discover everybody's face but their own"--Johathan Swift
Title: Re: IDEA: WinCovers
Post by: Uncle John on June 02, 2006, 05:06 PM
FYI. I've talked about this idea with a lot of programmers in the past and they all say it can't be done.
Title: Re: IDEA: WinCovers
Post by: Rover on June 03, 2006, 12:17 AM
The best will be when you ask about it after it's done, and they'll tell you it can't be. :)

When I was programming for a living.... I won't bore you with the details... They always say you can't do that, especially after you've just done it.  :P
Title: Re: IDEA: WinCovers
Post by: nudone on June 03, 2006, 02:27 AM
my suspicion is that skrommel already knows how to do it  :)
Title: Re: IDEA: WinCovers
Post by: skrommel on June 03, 2006, 07:33 PM
 :) Default windows controls is no problem at all.

(https://www.donationcoder.com/Software/Skrommel/AHK/TakeControlsScreen.jpg)

I'm thinking Alt-LClick to remove, Alt-LDrag to cover.

Skrommel
Title: Re: IDEA: WinCovers
Post by: Uncle John on June 03, 2006, 11:21 PM
 :Thmbsup: That's pretty impressive.

Can you extend the functionality to cover buttons too?

Example:

[ You are not allowed to view attachments ]
Title: Re: IDEA: WinCovers
Post by: Uncle John on June 03, 2006, 11:29 PM
BTW The reason I chose the calculator as an example is that it is available to everyone.

The sort of application I really had in mind was Multisim.

Multisim without covers:

[ You are not allowed to view attachments ]

Multisim with covers:

[ You are not allowed to view attachments ]
Title: Re: IDEA: WinCovers
Post by: mouser on June 04, 2006, 01:36 AM
i can see how that would be useful for teaching students..
Title: Re: IDEA: WinCovers
Post by: Uncle John on June 04, 2006, 06:31 PM
If I remember correctly, programmers I've talked to in the past suggest that the Windows API won't allow for this sort functionality.

I don't know that much about the Windows API but I can't see why each rectangular "WinCover" couldn't be a blank "Window" object. This would prevent the button underneath being clicked.

Is there a flaw in my logic? :tellme:
Title: Re: IDEA: WinCovers
Post by: nite_monkey on June 05, 2006, 12:17 PM
sweet idea man! Ok now jimmy push the next button...uh excuse me mrs. bing bong...yes jimmy?...uh wheres the next button...ok who put white out all over the screen?!...its not white out, its WINCOVER!!!...Sweet gimmie!...it hasn't been made yet...aw poo.
Title: Re: IDEA: WinCovers
Post by: Uncle John on June 06, 2006, 04:02 PM
It's more like, "OK, lets add a 10 Ohm resistor to the string and see how that effects things". Meanwhile half your class of 12 students are distracted with all sorts of other things such as personalizing their desktop background, screensavers, email etc, etc.

I can use the XP shared computer toolkit ( http://www.microsoft.com/windowsxp/sharedaccess/default.mspx (http://www.microsoft.com/windowsxp/sharedaccess/default.mspx) , http://www.tweakxp.com/Article37921.aspx (http://www.tweakxp.com/Article37921.aspx) ) to address a lot of these distractions but it doesn't address the operation of controls at the application level.  ;)
Title: Re: IDEA: WinCovers
Post by: Uncle John on June 12, 2006, 06:52 AM
:Thmbsup: Wow, "CutAway" seems to have the potential to achieve the desired results if it can be made to work reliably.
Title: Re: IDEA: WinCovers
Post by: Uncle John on August 25, 2006, 05:01 PM
Yikes. It just occurred to me that I might be infringing copyright by implementing this WinCovers idea.

Anyone thought about this issue b4?
Title: Re: IDEA: WinCovers
Post by: nite_monkey on September 11, 2006, 04:49 PM
If you are wanting to temp disable the stuff (just that one use) then you can use a program called showin, it lets you disable, or remove tons of stuff, but just that one time, when you close than reopen the prog they are back
Title: IDEA: WinCover
Post by: Uncle John on September 15, 2006, 01:54 AM
Are you refering to ShoWin? http://www.foundstone.com/index.htm?subnav=resources/navigation.htm&subcontent=/resources/proddesc/showin.htm (http://www.foundstone.com/index.htm?subnav=resources/navigation.htm&subcontent=/resources/proddesc/showin.htm)

Haven't tried it but the description seems to indicate that in uncovers stuff rather than covering it.

Anyway I've had a bash at programing a solution. See attachments...

My solution uses the the TransColor command. Silver pixels in the "Trigonometry Calculator" window are transparant and reveal only the desired features in the Calculator below.

But there are a few problems.....
1. How do I ensure the Calculator starts Scientific mode?
2. How do ensure that the "Trigonometry Calculator" (TC) is always directly above the Calculator and when the TC is moved the Calculator is also moved and stays directly below.
3. How do I prevent users turning off the Calculator (ie. by right clicking it's icon on the task bar)?
4. How do I close the TC and the Calculator Simulataneously?

I'll have a go at tackling these issues over the next few days but I wouldn't mind some suggestions.
Title: Re: IDEA: WinCover (was WinCovers)
Post by: Uncle John on September 16, 2006, 06:30 AM
Attached is the latest version.

Now there are three problems remaining to be solved.....
1. How do I ensure the Calculator starts Scientific mode?
2. How do I ensure that the "Trigonometry Calculator" (TC) is always directly above the Calculator and when the TC is moved the Calculator is also moved and stays directly below?
3. How do I prevent users turning off the Calculator (ie. by right clicking it's icon on the task bar)?
Title: Re: IDEA: WinCovers
Post by: brett on September 16, 2006, 07:24 AM
Hi John

I have not had a chance to read your latest script, will do so soon.

But after your post on the 15th , I thought I would have a stab.

This is just a 1st attempt using only the Calculator to see if we are on the right track,
I have not decided the layout for saving to different windows, or if and how settings are saved to a ini.
So calculator will be the test for now.

The limitations
- with AHK splashimage is that you have only ten covers to work with . but it seems very effective.
- to destroy the wincovers when a different window is active, I minimized the Calculator window to the taskbar.
- it does not stop Shortcut Keys.

[ You are not allowed to view attachments ]

FYI. I've talked about this idea with a lot of programmers in the past and they all say it can't be done.
Luckily I have never spoke to a programmer, so this does not apply to me.  :)
(Todays learning for dB, AHK splashimage)

Thanks
Feedback welcome
dB
doublebogey



Title: Re: IDEA: WinCovers
Post by: Uncle John on September 16, 2006, 08:07 AM
Hi doublebogey,

Thanks for educating me about Splashimage etc. It's a much easier way of doing things.

Had a good laugh about the message to the Principal etc. ;D

Title: Re: IDEA: WinCovers
Post by: Uncle John on September 19, 2006, 05:25 AM
Hi Db,

Making the following change switches off SplashImages when no Windows are active:

If Title=                                               ;If title is blank,. then
    {
      Return                                            ;return, do nothing
    }

changed to

If Title=                                                ;If title is blank,. then
    {
      SplashImage 1:Off                                  ;Turn off Wincover 1   
      SplashImage 2:off
      SplashImage 3:off
      Return                                             ;return
    }

However restoring another minimized window terminates the script leaving the Calculator running without covering SplashImages when the Calculator is again restored.

This problem still needs to be solved.

Cheers.
Title: Re: IDEA: WinCovers
Post by: brett on September 20, 2006, 01:40 AM
on the road for a couple for days, be back soon

dB
Title: Re: IDEA: WinCovers
Post by: Uncle John on September 20, 2006, 02:45 AM
Another approach...
From what I've been told the code can be simplified by making each SplashImage the child of the Calculator Window through the use of the  "ControlGet Hwnd" command and the DllCall("SetParent"...) function call.

Not sure how to go about this. Any volunteers?
Title: Re: IDEA: WinCovers
Post by: Uncle John on September 20, 2006, 07:13 PM
Cover.bmp is a grey rectangle W230 H170:

Run, %SystemRoot%\System32\calc.exe
WinWaitActive, Calculator
ControlGet, hWndNewParent, Hwnd,,, Calculator
WinGetPos, X, Y,,, Calculator
x:=X+55
y:=Y+140
SplashImage, cover.bmp, B X%x% Y%y%
ControlGet, hWndChild, Hwnd,,, SplashImage
DllCall("SetParent", hWndChild, hWndNewParent)
Sleep, 10000
SplashImage, Off

I'm try to get the SplashImage to move with Calculator when I drag Calculator.

What did I do wrong?
Title: Re: IDEA: WinCovers
Post by: Uncle John on October 16, 2006, 04:08 PM
I couldn't get the SetParent based solution to work.
Nor could I get the "timingloop" based solution, where the Calculator is minimised when another window becomes active, to work satisfactorily.
One reasons I'm not satisfied is that having the script minimise the window then puts it under the control of the task bar button Calculator icon. Then if you press the Calculator icon the script locks up and Calculator stays minimized.
Another reason I'd prefer to explore a different solution is aesthetic. It's impossible to remove the jerkiness from the cover movement when the Calculator is dragged.

The approach I exploring now avoids the Calculator window being de-activated or moved by:
- Closing all windows b4 starting the Calculator script, 
- Hiding the Task Bar,
- Removing the Calculator Menu Bar,
- Placing an Splashimage over the Title Bar.

Here is the code. As you can see the "close all windows" part has been commented out for convenience while I'm trying to fix/develop other parts of the script:

#SingleInstance Force
#NoEnv
SetBatchLines -1
#Persistent

/*WinGet, id, list, , , Program Manager ; Close all windows
Loop, %id%
{
   StringTrimRight, this_id, id%a_index%, 0
   WinGetTitle, this_title, ahk_id %this_id%
   winclose,%this_title%
}
*/
WinHide ahk_class Shell_TrayWnd
Run calc.exe, , , PID
WinWait ahk_pid %PID%
DllCall("SetMenu", uint, WinExist(), uint, 0)  ; Remove menu bar of "last found window".
WinMove, ahk_pid %PID%,,0, 0 ; Move the Calculator window to the top left corner.
SplashImage, , B w455 h30 x0 y0 CWBlue, , , SICalcCover
;WinSet.... 
;SplashImage, , B w175 h165 x55 y125 CWSilver, , , SICalcCover
SetTimer Follow, 100
Follow:
IfWinNotExist ahk_pid %PID%
{
Winshow ahk_class Shell_TrayWnd
ExitApp   ; Calc has been closed
}
Return

I'm trying to work out how I can make a transparent hole over the Calculator Close button because you can still drag by clicking on the right hand edge of the title bar. Does anyone know how to make a hole in a SplashImage?

I'm also trying to get multiple SplashImages working. Only the title bar cover works at the moment. Doublebogey are you there? Do you have any suggestions on this?
Title: Re: IDEA: WinCovers
Post by: brett on October 17, 2006, 02:37 AM
I have not forgotten.
Just keep running into dead ends myself with each path I try.

dB
doublebogey
Title: Re: IDEA: WinCovers
Post by: skrommel on December 16, 2006, 06:27 PM
 :) I don't know if you still need this one...

(https://www.donationcoder.com/Software/Skrommel/UnderCover/UnderCover.gif) UnderCover  (http://www.1hoursoftware.com) - Automatically hide a window's buttons and other controls.

Features:
- Ctrl-Rightclick to hide a control
- Change settings using Settings in the tray menu

The hidden controls are saved to an ini file, so whenever a new window of the same class is run, it automatically loses it's controls.

(https://www.donationcoder.com/Software/Skrommel/UnderCover/UnderCoverScreen.gif) (http://www.1hoursoftware.com)

You'll find the downloads and more info at  1 Hour Software by Skrommel (http://www.1hoursoftware.com).

Skrommel
Title: Re: IDEA: WinCovers
Post by: Uncle John on December 21, 2006, 04:15 PM
Hi Skrommel,

Wow :)

Thanks for this. It is certainIy very useful to me and I suspect many others will find it useful too. :Thmbsup: 

Back on June 3 you mentioned that your script would work on all Windows default controls. I'm starting to appreciate the extent of those controls.

I'm still a pretty raw newbie so it'll take me a while to analyse your script and understand all it's implications. I really appreciate your having shared it with us.

Thanks and season's greetings to you and your family.
Title: Re: IDEA: WinCovers
Post by: skrommel on December 21, 2006, 06:48 PM
 :) So it's better late than never, then? Merry Christmas to you, too!

Skrommel
Title: Re: IDEA: WinCovers
Post by: Uncle John on December 21, 2006, 09:41 PM
Maybe even better late than early. As you can see from the above posts the delay has given me some time to learn a little more about Autohotkey and the Win32 API etc. :D

Thanks again.