topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday December 10, 2024, 12:51 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Powershell Script to block certain part of the screen like the taskbar  (Read 4856 times)

Etanoder

  • Participant
  • Joined in 2021
  • *
  • default avatar
  • Posts: 5
    • View Profile
    • Donate to Member
Hi,
I would like to have a code in powershell that will use the "SystemParametersInfoW" function in user32.dll from windows 10 and will set an area of the screen as a work area using the method
SPI_SETWORKAREA
0x002F

as explained here https://docs.microso...ystemparametersinfow

Thanks!

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,190
    • View Profile
    • Donate to Member
Do you really want this as a PowerShell script? It seems like a GUI to allow you to mark the area would be better than guesstimating the area to block off, IMO.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
I don't code in powershell but I have written small utilities to set the desktop work area.  I am chiming in just in case you may be unaware that it is a Windows quirk that if the Taskbar is not locked, the work area reported by the system will be the same as the current screen resolution, at least for single monitor systems.

In other words, if you like to run with a disappearing taskbar, setting the work area will have no effect.  I haven't heard anything about it being fixed in Windows 11 so I doubt it ever will be.   ;D

If you wish to try setting the work area to see the effect you are welcome to download my freeware SetWorkArea



Edit:  Also this article may be of interest:
https://docs.microso...nfo-work-incorrectly


« Last Edit: December 09, 2021, 09:59 AM by MilesAhead »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
You could also try my Desktop Coral app:
https://www.donation...ws-apps/desktopcoral

"DesktopCoral is an unusual program designed to "reserve" some portion of your desktop which is shielded from maximized applications..

Essentially, it acts like an invisible resizeable docking bar, which can be docked to any side of your desktop. This invisible dock acts as a barrier to maximized applications and essentially shields this area of your desktop from other applications.

Within this shielded area you might put certain application windows that you want to be always visible, or you might put one of the many desktop tools like a calendar or system information component.

Why would you need a tool like DesktopCoral?

DesktopCoral was requested by someone who uses the Samurize desktop system information utility. This fun utility and others like it draw text and graphics on top of your desktop. But when working with other programs, this information can be covered by these other windows. DesktopCoral solves this problem by reserving an area of your desktop where normal programs will not be expanded into."

Etanoder

  • Participant
  • Joined in 2021
  • *
  • default avatar
  • Posts: 5
    • View Profile
    • Donate to Member
Do you really want this as a PowerShell script? It seems like a GUI to allow you to mark the area would be better than guesstimating the area to block off, IMO.

that's true but i must see the code involved :(

Etanoder

  • Participant
  • Joined in 2021
  • *
  • default avatar
  • Posts: 5
    • View Profile
    • Donate to Member
re welcome
thanks you very for chiming in, then I will use it with taskbar visible and locked if I must, is it possible to see the code for your freeware?

Etanoder

  • Participant
  • Joined in 2021
  • *
  • default avatar
  • Posts: 5
    • View Profile
    • Donate to Member
You could also try my Desktop Coral app:
https://www.donation...ws-apps/desktopcoral

"DesktopCoral is an unusual program designed to "reserve" some portion of your desktop which is shielded from maximized applications..

Essentially, it acts like an invisible resizeable docking bar, which can be docked to any side of your desktop. This invisible dock acts as a barrier to maximized applications and essentially shields this area of your desktop from other applications.

Within this shielded area you might put certain application windows that you want to be always visible, or you might put one of the many desktop tools like a calendar or system information component.

Why would you need a tool like DesktopCoral?

DesktopCoral was requested by someone who uses the Samurize desktop system information utility. This fun utility and others like it draw text and graphics on top of your desktop. But when working with other programs, this information can be covered by these other windows. DesktopCoral solves this problem by reserving an area of your desktop where normal programs will not be expanded into."


thanks but like i said i must see the code involved and be able to run in windows 10

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,190
    • View Profile
    • Donate to Member
Do you really want this as a PowerShell script? It seems like a GUI to allow you to mark the area would be better than guesstimating the area to block off, IMO.

that's true but i must see the code involved :(

You didn't put that as a qualification in the first post. Though many voluntarily write, fewer open source their code. And to ask this so you can see the code- is there another reason behind this?

You can see examples of how to call a win api in powershell here- https://devblogs.mic...-windows-api-part-1/

You might be able to scrape it up yourself from that.

Etanoder

  • Participant
  • Joined in 2021
  • *
  • default avatar
  • Posts: 5
    • View Profile
    • Donate to Member
Do you really want this as a PowerShell script? It seems like a GUI to allow you to mark the area would be better than guesstimating the area to block off, IMO.

that's true but i must see the code involved :(

You didn't put that as a qualification in the first post. Though many voluntarily write, fewer open source their code. And to ask this so you can see the code- is there another reason behind this?

You can see examples of how to call a win api in powershell here- https://devblogs.mic...-windows-api-part-1/

You might be able to scrape it up yourself from that.

I completely understand, I was so buffled by this, it's new ground for me, I know powershell, I'll try getting it done myself

Thanks wraith!

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,644
    • View Profile
    • Donate to Member
Ignore me .... my brain hurts  :-\

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
re welcome
thanks you very for chiming in, then I will use it with taskbar visible and locked if I must, is it possible to see the code for your freeware?

I have no objection to you reading the code.  But I did it in AutoIt3 and there are many reusable routines scattered across a bunch of include files.  Since I am on a hiatus from programming I have the code in online storage with only links on my Laptop.  The Lappy has only 32 GB of storage so I eliminated local copies as a space saving measure.  But you could probably find example code online in forums dedicated to PowerShell.  The call to set the work area is not that complicated.  It is just that I forget which files load what others.  The upside of using include files is reusable code but the downside is including one file may actually chain in a bunch of others and it can be messy.

A stand alone example is probably your best bet.

Edit:  Now that I think of it I believe only the setting "auto hide the taskbar" causes the screen resolution to be given as the work area.  The "lock the taskbar" setting has no effect on the reported work area info.  It has been years since I wrote these utilities.   :o

« Last Edit: December 13, 2021, 01:58 PM by MilesAhead »