Notifications
Clear all
[Closed] Set TopMost on dialog
Oct 09, 2010 12:49 am
Hello guys!
I’m trying to set topmost on a maxscript dialog. I think the only thing I still need to figure out, is how to send the message to the window. Do I even have to use “windows.sendMessage”?
This is what I got so far, the line in red is not working:
fn dialogSetTopMost =
(
local children = windows.getChildrenHWND (windows.getDesktopHWND())
for child in children do (
if (child[5] == "Dialog") do (
windows.sendMessage (hwnd = child[1]) (HWND_TOPMOST = -2) (wparam = 0) (lparam = 0)
)
)
)
dialogSetTopMost()
4 Replies
1 Reply
to set a window TOPMOST you have to call SetWindowPos function. You can find it in this forum using search.
the function to set a window TOPMOST or NOTOPMOST by name might be:
fn showTopmost name act:on = if (hwnd = windows.getChildHWND 0 name) != undefined do
(
HWND_TOPMOST = -1
HWND_NOTOPMOST = -2
setWindowPos hwnd[1] (if act then HWND_TOPMOST else HWND_NOTOPMOST) 0 0 0 0 0x3 -- (SWP_NOSIZE = 0x1 and SWP_NOMOVE = 0x2)
act
)
Oct 09, 2010 12:49 am
Thank you Denis!
But I’m having a small problem, I’m using:
fn showTopmost name act:on = if (hwnd = windows.getChildHWND 0 name) != undefined do
(
HWND_TOPMOST = -1
HWND_NOTOPMOST = -2
setWindowPos hwnd[1] (if act then HWND_TOPMOST else HWND_NOTOPMOST) 0 0 0 0 0x3 -- (SWP_NOSIZE = 0x1 and SWP_NOMOVE = 0x2)
act
)
showTopmost "Dialog"
It seems to find my dialog called “Dialog” but I’m getting a
– Type error: Call needs function or class, got: undefined
in the listener
What am I missing?
Thanks once again!
1 Reply
- your dialog has a class “Dialog”. You have to specify the NAME (title)
2. setWindowPos is undefined for you. It’s not an originally MAX function. You have to wrote it yourself or used for example my version (search this forum for it).