This uses the inbuilt compilers in Windows 10 - there are three VB.NET compilers and three C# compilers - just copy each text file into the same folder and double click the batch file to make the program.
Window Manipulation Posts
REM SizeWindow.bat
REM This file compiles SizeWindow.vb to SizeWindow.exe
REM SizeWindow changes the size of a window
REM To use
REM SizeWindow nnnnxnnnn
REM E.G.
REM SizeWindow 300x400 Untitled - Notepad
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe" /target:winexe /out:"%~dp0\SizeWindow.exe" "%~dp0\SizeWindow.vb" /verbose
pause
'TopMost.vb
Imports System
Imports System.IO
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Public Module TopMost
Public Declare UNICODE Function FindWindowW Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As IntPtr, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOZORDER = &h4
Sub Main()
On Error Resume Next
Dim hWindows as IntPtr
Dim CmdLine as String
Dim Ret as Integer
CmdLine = Command()
Dim A as String()
Dim B as String()
A = Split(CmdLine, Chr(32), 2, 1)
B = Split(A(0), "x", 2, 1)
hwindows = FindWindowW(vbNullString, A(1))
If hwindows = 0 then
Msgbox(A(1) & " cannot be found.")
Else
Ret = SetWindowPos(hwindows, HWND_NOTOPMOST, 0, 0, B(0), B(1), SWP_NOMOVE + SWP_NOZORDER)
If Ret = 0 Then MsgBox("Set Pos Error is " & Err.LastDllError)
End If
End Sub
End Module
wrong VB code.. sizevisual.vb missing
ReplyDelete