Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is there any way to position the inputbox$ window?
#3
Thanks @BPlus, that's an interesting little program!
But no, I meant a popup specifically outside the program window, not one that is sitting over any part of the program window. Like the Inputbox$ control, with the default value selected so you can copy it to the clipboard.

The QB64PE one looks identical to the one in vbscript / VBA / VB6 (which can be moved, run the below vbscript) 
so it must be system-level, so it's probably possible to edit the QB64PE IDE to add those parameters, but that would be a lot of work. 
Another option would be to generate a vbscript on the fly and shell out to it, or have it accept command line args. 

A simpler solution for my purpose is display a prompt in _TITLE, collect input with _KeyDown, update clipboard with _Clipboard$. 

Thanks again! That code might come in handy for some other projects! 
Do you have a version that can display & detect clicks on OK / Cancel / Yes / No buttons??  Smile

Code: (Select All)
' "PositionInputbox.vbs" = A vbscript that demostrates how to position inputbox
Dim m_ProgramPath: m_ProgramPath = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\")) ' executable path
Dim m_ProgramName: m_ProgramName = Mid(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\") + 1) ' executable filename
dim strComputer : dim objWMIService : dim colItems : dim objItem
Dim ScreenWidth: Dim ScreenHeight : dim xMax : dim yMax : dim xMin : dim yMin
Dim xPos : Dim yPos : Dim dx : Dim dy
dim sValue : dim sPrompt : dim sTitle : dim sDefault : Dim xTwips : Dim yTwips
dim sError : sError = ""
if len(sError)=0 then
    ' Get screen size
    ' Author: Demon
    ' Website: http://demon.tw
    ' Date: 2012/5/7
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_DesktopMonitor",,48)
    For Each objItem in colItems
        ScreenWidth = objItem.ScreenWidth
        ScreenHeight = objItem.ScreenHeight
        if len(ScreenWidth) > 0 and len(ScreenHeight) > 0 then exit for
    Next
    if len(ScreenWidth) = 0 or len(ScreenHeight) = 0 then sError = "Error: can't determine screen resolution. Exiting."
end if
if len(sError)=0 then
    ' Move inputbox around
    ' https://www.devguru.com/content/technologies/vbscript/functions-inputbox.html
    ' https://www.vbforums.com/showthread.php?419303-Screen-Position-of-the-InputBox
    xMin = 0 : yMin = 0 : xMax = ScreenWidth - 375 : yMax = ScreenHeight - 240
    xPos = xMin : yPos = yMin : dx = 100 : dy = 200
    Do
        sPrompt = "Press Enter or cick OK to see InputBox move."  & vbcrlf & _
            "Clear the text and click OK to quit." & vbcrlf & _
            "Screen resolution = " & xMax & "x" & yMax
        sTitle = m_ProgramName
        sDefault = xPos & "," & yPos
        xTwips = 15 * xPos : yTwips = 15 * yPos
        sValue = InputBox(sPrompt, sTitle, sDefault, xTwips, yTwips)
        if len(sValue) = 0 then exit do
        xPos = xPos + dx
        if xPos < xMin then dx = 0 - dx : xPos = xMin : dx = 0 : if dy = 0 then dy = 100
        if yPos < yMin then dy = 0 - dy : yPos = yMin : dy = 0 : if dx = 0 then dx = -200
        yPos = yPos + dy
        if xPos > xMax then dx = 0 - dx : xPos = xMax : dx = 0 : if dy = 0 then dy = -100
        if yPos > yMax then dy = 0 - dy : yPos = yMax : dy = 0 : if dx = 0 then dx = 200
    Loop
end if
if len(sError) > 0 then msgbox sError
if IsObject(objItem) then set objItem = nothing
if IsObject(colItems) then set colItems = nothing
if IsObject(objWMIService) then set objWMIService = nothing
WScript.Quit()
Reply


Messages In This Thread
RE: is there any way to position the inputbox$ window? - by madscijr - 10-31-2025, 03:16 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Enlarging window for older BAS programs (ie. Screen 7 mode) paulel 5 388 12-24-2025, 09:36 PM
Last Post: paulel
  auto-detecting screen resolution for optimal window size on non-Windows systems madscijr 11 1,050 11-10-2025, 07:23 PM
Last Post: madscijr
  auto-detecting screen resolution for optimal window size on non-Windows systems madscijr 0 214 10-26-2025, 06:58 PM
Last Post: madscijr
  Play wav file in the background without a window on the forground Rudy M 12 1,126 09-18-2025, 07:08 PM
Last Post: Pete
  file.. open dialog window pmackay 2 397 08-31-2025, 11:27 PM
Last Post: pmackay

Forum Jump:


Users browsing this thread: 1 Guest(s)