Помощь - Поиск - Пользователи - Календарь
Полная версия: showwindow() win10 problem
UoKit.com Форумы > Кликер > UO Pilot
neves
Hello everyone. I have a problem with showwindow() state commands.
In the wiki page are given only these states:
Код
HIDE: спрятать окно
MAXIMIZE: развернуть во весь экран
MINIMIZE: свернуть
RESTORE: развернуть
SHOW: показать
TOP: вытащить на поверхность.

My question is: Are there any other states which I can use, because none of these worked for my problem?
I am trying to minimize and restore given window in windows 10 virtual desktops, without switching between the desktops automatically. I need more like a popup state. When I use RESTORE or MAXIMIZE state, it switches to the virtual desktop where the window is located automatically.
cirus
Extract the archive to the exe folder.
Нажмите для просмотра прикрепленного файла
Код
--lua
package.path = "LuaPlugins\\winapi\\?.lua;" .. package.path
package.path = "LuaPlugins\\glue\\?.lua;" .. package.path
setfenv(1, require'winapi')
require[[winapi.winuser]]

local ffi = require("ffi")
ffi.cdef[[
BOOL ShowWindow(int hWnd, int nCmdShow);
]]

local SW_SHOWNOACTIVATE =  4
local SW_MINIMIZE = 6



C.ShowWindow(workwindow(), SW_MINIMIZE)
wait (3000)
C.ShowWindow(workwindow(), SW_SHOWNOACTIVATE)
neves
Amazing! It works exact how I wanted.
I understand the use of winapi here, but why glue package is needed in this example?
cirus
steq, если версия пилота 2.41, то удалите lua5.1.dll и перезапустите пилот. Скорее всего не та длл.
steq
Цитата(cirus @ 15.3.2020, 19:06) *

steq, если версия пилота 2.41, то удалите lua5.1.dll и перезапустите пилот. Скорее всего не та длл.

Помогло
neves
Цитата(cirus @ 15.3.2020, 16:09) *

Код
--lua
package.path = "LuaPlugins\\winapi\\?.lua;" .. package.path
package.path = "LuaPlugins\\glue\\?.lua;" .. package.path
setfenv(1, require'winapi')
require[[winapi.winuser]]

local ffi = require("ffi")
ffi.cdef[[
BOOL ShowWindow(int hWnd, int nCmdShow);
]]

local SW_SHOWNOACTIVATE =  4
local SW_MINIMIZE = 6
C.ShowWindow(workwindow(), SW_MINIMIZE)
wait (3000)
C.ShowWindow(workwindow(), SW_SHOWNOACTIVATE)


Why when I add new function at the bottom of this script, I can't reach it from other script.

Example:
test.lua
Код
--lua 
package.path = "LuaPlugins\\winapi\\?.lua;" .. package.path
package.path = "LuaPlugins\\glue\\?.lua;" .. package.path
setfenv (1, require'winapi')
require [[winapi.winuser]]

local ffi = require ("ffi")
ffi.cdef [[
BOOL ShowWindow (int hWnd, int nCmdShow);
]]

local SW_SHOWNOACTIVATE = 4
local SW_MINIMIZE = 6

C.ShowWindow (workwindow (), SW_MINIMIZE)
wait (3000)
C.ShowWindow (workwindow (), SW_SHOWNOACTIVATE)

function test()
    log('yes')
end


script0.txt
Код
--lua
require("test")

test()


returns
Изображение
cirus
Код
-- the function first
function test()
    log('yes')
end
setfenv (1, require'winapi')
neves
Gives error.
Цитата(cirus @ 17.3.2020, 0:35) *

Код
-- the function first
function test()
    log('yes')
end
setfenv (1, require'winapi')

Изображение
cirus
Код
--lua 
package.path = "LuaPlugins\\winapi\\?.lua;" .. package.path
package.path = "LuaPlugins\\glue\\?.lua;" .. package.path

function test()
    log('yes')
end
setfenv (1, require'winapi')
require [[winapi.winuser]]

local ffi = require ("ffi")
ffi.cdef [[
BOOL ShowWindow (int hWnd, int nCmdShow);
]]

local SW_SHOWNOACTIVATE = 4
local SW_MINIMIZE = 6

C.ShowWindow (workwindow (), SW_MINIMIZE)
wait (3000)
C.ShowWindow (workwindow (), SW_SHOWNOACTIVATE)
neves
Is it possible to remove setfenv (1, require'winapi') or to replace it with something else, because it cause some problems.
Example: If I wanna use ShowWindow() inside test() again it cause problems.
Код
--lua 
package.path = "E:\\pilot_packages\\LuaPlugins\\winapi\\?.lua;" .. package.path
package.path = "E:\\pilot_packages\\LuaPlugins\\glue\\?.lua;" .. package.path
function test()
C.ShowWindow (workwindow (), SW_MINIMIZE)
wait (3000)
C.ShowWindow (workwindow (), SW_SHOWNOACTIVATE)
end
setfenv (1, require'winapi')
require [[winapi.winuser]]

local ffi = require ("ffi")
ffi.cdef [[
BOOL ShowWindow (int hWnd, int nCmdShow);
]]

local SW_SHOWNOACTIVATE = 4
local SW_MINIMIZE = 6

Изображение
cirus
Цитата
Is it possible to remove setfenv (1, require'winapi') or to replace it with something

Don't know.
Это текстовая версия — только основной контент. Для просмотра полной версии этой страницы, пожалуйста, нажмите сюда.
Русская версия Invision Power Board © 2001-2024 Invision Power Services, Inc.