Ho questo codice (compilato a 64bit) che funziona perfettamente:
Imports System.Runtime.InteropServices
Module APIdefine
Public Const GWL_STYLE As Integer = -16
Public Const WS_MINIMIZEBOX As Integer = &H20000
Public Const WS_MAXIMIZEBOX As Integer = &H10000
Public Const WS_THICKFRAME As Integer = &H40000
<DllImport("user32.dll", SetLastError:=True)>
Public Function GetWindowLongPtr(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True)>
Public Function SetWindowLongPtr(ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As IntPtr) As IntPtr
End Function
End Module
Public Class Form1
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Dim proc = Process.Start("notepad.exe")
proc.WaitForInputIdle()
Threading.Thread.Sleep(1000) ' per sicurezza
Dim style = CLng(GetWindowLongPtr(proc.MainWindowHandle, GWL_STYLE))
style = style And (Not (WS_MINIMIZEBOX Or WS_MAXIMIZEBOX Or WS_THICKFRAME))
SetWindowLongPtr(proc.MainWindowHandle, GWL_STYLE, CType(style, IntPtr))
End Sub
End Class
Praticamente lancia il programma notepad.exe, aspetta un secondo per essere sicuri che sia tutto ok (ma soprattutto per il controllo visivo), e poi disabilita il MinimizeBox, il MaximizeBox e il ThickFrame (il resize)
Ma se al posto di “notepad.exe” metto “chrome.exe” non funziona più :-(
Qualche idea ???
Grazie
Sergio