Jump to content

Disable buttons in Dot Net application


bcnx
 Share

Recommended Posts

Hi all,

I successfully managed to disable the minimize, maximize and close buttons on a Notepad instance by means of code I found on this forum. 

However, when I tried to apply this on a .Net application, even after successfully identifying the window's name and class, the buttons remain active.

Is there a way to get this working for a .Net application? Can it also be forced to startup fully maximized?

 

Thank!

 

BC

Link to comment
Share on other sites

Maybe GUISetState @SW_MAXIMIZE.

Else winmove to @desktopwidth/height

As for the disabling of buttons, i don't know, i can't remember if i have a .net application to test.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

If you point me to a application i can download and test it would help.

What was the result on the winmove?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

The application I am looking at is part of a commercial software suite to manage desktops (Novell Zenworks) and is not downloadable as such. I can send you the agent install exe, but it is around 500 MB. I have not tried the winmove yet, as the disabling of the buttons is a prerequisite: if that does not work, the maximizing is not needed anymore.

Cheers,

 

BC

Link to comment
Share on other sites

What was the code you used that worked? i mean in the normal windows.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

I managed to disable the close button in that application you pointed me to, the "File Shredder" with the code in the page you pointed out.

; Original script: http://www.autoitscript.com/forum/topic/100125-disable-close-button/#entry716490
; USer32.dll functions: http://msdn.microsoft.com/en-us/library/ms647985(v=vs.85).aspx
#include <GuiMenu.au3>

;Run("Notepad")
WinWait("File Shredder - Free to use")

$handle = WinGetHandle("File Shredder - Free to use")
ConsoleWrite('+ Window Handle: ' & $handle & @CRLF)

DisableButton($handle, $SC_CLOSE)
;~ EnableButton($handle, $SC_CLOSE)

DisableButton($handle, $SC_MAXIMIZE)
DisableButton($handle, $SC_RESTORE)
DisableButton($handle, $SC_MOVE)

Func DisableButton($hWnd, $iButton)
$hSysMenu = _GUICtrlMenu_GetSystemMenu($hWnd, 0)
_GUICtrlMenu_RemoveMenu($hSysMenu, $iButton, False)
_GUICtrlMenu_DrawMenuBar($hWnd)

EndFunc

Func EnableButton($hWnd, $iButton)
$hSysMenu = _GUICtrlMenu_GetSystemMenu($hWnd, 1)
_GUICtrlMenu_RemoveMenu($hSysMenu, $iButton, False)
_GUICtrlMenu_DrawMenuBar($hWnd)
EndFunc

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Hi,

I was able to test this today (sorry for the delay) with our specific application and the script does not seem to work with this app. I replaced the Window Title info  with the new data, but still no go. 

Will try some things to get this going,

thx,

 

BC

Link to comment
Share on other sites

OK, did some research and the problem is simple: I choose File Shredder as a test application because the Sourceforge page mentioned it was also built on .Net 4.5, plus the screenshots showed the same style of windows buttons as our application. However, when launching File Shredder on my machine, it seems that the buttons follow the same standard for the buttons as Notepad does. They are not the same as the screenshots. That is probably the reason why the code for Notepad works as well for File Shredder, but not for our application.

If anyone knows how to handle these buttons, please share,

 

cheers!

 

BC

 

Link to comment
Share on other sites

Any chance you can move the window so that the close, min, maximize are off screen? Maybe you could move the window up a bit, and keep a script running to keep the window there, or instead of just moving, maybe resizing in such a way that the buttons are hidden.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...