HWND_TOPMOST not working ?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
conjure
Pro Scripter
Posts: 63
Joined: Thu Jan 12, 2012 3:05 pm

HWND_TOPMOST not working ?

Post by conjure » Sun Sep 27, 2020 1:37 pm

I used to run this compiled exe, with no problem , and HWND_TOPMOST was working fine.
After i added an icon to my executable, HWND_TOPMOST does not work anymore.
i didn't touch the code. What is wrong? Is it a bug?

Code: Select all


// COMPILE_OPTS|C:\Users\PC6\Desktop\SplashPositions.exe|R:\Hopstarter-Orb-Real-One.ico|CONSOLE=0|INCLUDES=1| /NOSYSTRAY /HIDE|RUNTIMES=1|BMPS=1
VBSTART

'Kills a process given its process name

Sub killProcess(pgm)

  set wmi = getobject("winmgmts:")

  sQuery = "select * from win32_process " & "where name='" & pgm & "'"

  set processes = wmi.execquery(sQuery)

  for each process in processes

    process.terminate

  next

End Sub



'returns the number of copies of ProcessName that are running

'will return 0 if ProcessName is not running

Function IsProcessRunning(ProcessName)

    Set oWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")

    Set colProcessList = oWMIService.ExecQuery ("Select Name from Win32_Process where Name='" & ProcessName & "'")

    IsProcessRunning = colProcessList.count

End Function

VBEND
VBStart
Sub Kill(Process)
 Dim oShell : Set oShell = CreateObject("WScript.Shell")
 oShell.Run "taskkill /f /im " & Process, , True
End Sub
VBEND

IfFileExists>C:\Users\PC6\Desktop\forsplash.txt
copyfile>C:\Users\PC6\Desktop\forsplash.txt,C:\Users\PC6\Desktop\forsplash2.txt
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,1,one
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,2,two
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,3,three
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,4,four
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,5,five
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,6,six
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,7,seven
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,8,eight
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,9,nine
DeleteFile>C:\Users\PC6\Desktop\forsplash2.txt
else



let>one=4
let>two=4
let>three=4
let>four=4
let>five=4
let>six=4
let>seven=4
let>eight=4
let>nine=4

endif
Dialog>SplashScreen1
   Caption=SplashScreen1
   Width=1
   Height=20
   Top=815
   Left=730
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=%one%,5,0
EndDialog>SplashScreen1
Dialog>SplashScreen2
   Caption=SplashScreen2
   Width=10
   Height=20
   Top=745
   Left=350
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=%two%,5,0,true
EndDialog>SplashScreen2
Dialog>SplashScreen3
   Caption=SplashScreen3
   Width=10
   Height=20
   Top=550
   Left=200
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=%three%,5,0,true
EndDialog>SplashScreen3
Dialog>SplashScreen4
   Caption=SplashScreen4
   Width=10
   Height=20
   Top=370
   Left=270
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=%four%,5,0,true
EndDialog>SplashScreen4
Dialog>SplashScreen5
   Caption=SplashScreen5
   Width=10
   Height=20
   Top=270
   Left=530
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=%five%,5,0,true
EndDialog>SplashScreen5
Dialog>SplashScreen6
   Caption=SplashScreen6
   Width=10
   Height=20
   Top=270
   Left=750
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=%six%,5,0,true
EndDialog>SplashScreen6
Dialog>SplashScreen7
   Caption=SplashScreen7
   Width=10
   Height=20
   Top=358
   Left=1005
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=%seven%,5,0,true
EndDialog>SplashScreen7
Dialog>SplashScreen8
   Caption=SplashScreen8
   Width=10
   Height=20
   Top=550
   Left=1080
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=%eight%,5,0,true
EndDialog>SplashScreen8
Dialog>SplashScreen9
   Caption=SplashScreen9
   Width=10
   Height=20
   Top=745
   Left=925
   Max=0
   Min=0
   Close=1
   Resize=0
   Label=%nine%,5,0,true
EndDialog>SplashScreen9

SetDialogObjectFont>SplashScreen1,msLabel1,Tahoma,28,1,255
SetDialogObjectFont>SplashScreen2,msLabel1,Tahoma,28,1,255
SetDialogObjectFont>SplashScreen3,msLabel1,Tahoma,28,1,255
SetDialogObjectFont>SplashScreen4,msLabel1,Tahoma,28,1,255
SetDialogObjectFont>SplashScreen5,msLabel1,Tahoma,28,1,255
SetDialogObjectFont>SplashScreen6,msLabel1,Tahoma,28,1,255
SetDialogObjectFont>SplashScreen7,msLabel1,Tahoma,28,1,255
SetDialogObjectFont>SplashScreen8,msLabel1,Tahoma,28,1,255
SetDialogObjectFont>SplashScreen9,msLabel1,Tahoma,28,1,255







//Borderless Dialog
LibFunc>user32,SetWindowLongA,sres,SplashScreen1.handle,-16,1073741824
LibFunc>user32,SetWindowLongA,sres,SplashScreen2.handle,-16,1073741824
LibFunc>user32,SetWindowLongA,sres,SplashScreen3.handle,-16,1073741824
LibFunc>user32,SetWindowLongA,sres,SplashScreen4.handle,-16,1073741824
LibFunc>user32,SetWindowLongA,sres,SplashScreen5.handle,-16,1073741824
LibFunc>user32,SetWindowLongA,sres,SplashScreen6.handle,-16,1073741824
LibFunc>user32,SetWindowLongA,sres,SplashScreen7.handle,-16,1073741824
LibFunc>user32,SetWindowLongA,sres,SplashScreen8.handle,-16,1073741824
LibFunc>user32,SetWindowLongA,sres,SplashScreen9.handle,-16,1073741824







//Make Dialog Transparent
Let>ByteOpacity=0
Let>GWL_EXSTYLE=-20
Let>WS_EX_LAYERED=524288
Let>LWA_ALPHA=2

//Get Style Attributes of Dialog Window
LibFunc>user32,GetWindowLongA,attribs,SplashScreen1.handle,GWL_EXSTYLE
LibFunc>user32,GetWindowLongA,attribs,SplashScreen2.handle,GWL_EXSTYLE
LibFunc>user32,GetWindowLongA,attribs,SplashScreen3.handle,GWL_EXSTYLE
LibFunc>user32,GetWindowLongA,attribs,SplashScreen4.handle,GWL_EXSTYLE
LibFunc>user32,GetWindowLongA,attribs,SplashScreen5.handle,GWL_EXSTYLE
LibFunc>user32,GetWindowLongA,attribs,SplashScreen6.handle,GWL_EXSTYLE
LibFunc>user32,GetWindowLongA,attribs,SplashScreen7.handle,GWL_EXSTYLE
LibFunc>user32,GetWindowLongA,attribs,SplashScreen8.handle,GWL_EXSTYLE
LibFunc>user32,GetWindowLongA,attribs,SplashScreen9.handle,GWL_EXSTYLE
Let>attribs={%attribs% OR %WS_EX_LAYERED%}

LibFunc>user32,SetWindowLongA,swl,SplashScreen.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen1.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen1

LibFunc>user32,SetWindowLongA,swl,SplashScreen2.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen2.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen2
LibFunc>user32,SetWindowLongA,swl,SplashScreen3.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen3.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen3
LibFunc>user32,SetWindowLongA,swl,SplashScreen4.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen4.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen4
LibFunc>user32,SetWindowLongA,swl,SplashScreen5.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen5.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen5
LibFunc>user32,SetWindowLongA,swl,SplashScreen6.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen6.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen6
LibFunc>user32,SetWindowLongA,swl,SplashScreen7.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen7.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen7
LibFunc>user32,SetWindowLongA,swl,SplashScreen8.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen8.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen8
LibFunc>user32,SetWindowLongA,swl,SplashScreen9.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen9.handle,0,ByteOpacity,LWA_ALPHA
show>SplashScreen9





ResizeWindow>SplashScreen1,50,50
ResizeWindow>SplashScreen2,50,50
ResizeWindow>SplashScreen3,50,50
ResizeWindow>SplashScreen4,50,50
ResizeWindow>SplashScreen5,50,50
ResizeWindow>SplashScreen6,50,50
ResizeWindow>SplashScreen7,50,50
ResizeWindow>SplashScreen8,50,50
ResizeWindow>SplashScreen9,50,50



Let>ByteOpacity=0
let>KK=0
add>KK,2
//Time to display Splash screen
if>KK>1000000,splash done
//Increase Dialog Opacity
add>ByteOpacity,254
if>ByteOpacity>254
Let>ByteOpacity=255
endif
//Change Dialog Opacity
LibFunc>user32,SetWindowLongA,swl,SplashScreen1.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen1.handle,0,ByteOpacity,LWA_ALPHA
LibFunc>user32,SetWindowLongA,swl,SplashScreen2.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen2.handle,0,ByteOpacity,LWA_ALPHA
LibFunc>user32,SetWindowLongA,swl,SplashScreen3.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen3.handle,0,ByteOpacity,LWA_ALPHA
LibFunc>user32,SetWindowLongA,swl,SplashScreen4.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen4.handle,0,ByteOpacity,LWA_ALPHA
LibFunc>user32,SetWindowLongA,swl,SplashScreen5.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen5.handle,0,ByteOpacity,LWA_ALPHA
LibFunc>user32,SetWindowLongA,swl,SplashScreen6.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen6.handle,0,ByteOpacity,LWA_ALPHA
LibFunc>user32,SetWindowLongA,swl,SplashScreen7.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen7.handle,0,ByteOpacity,LWA_ALPHA
LibFunc>user32,SetWindowLongA,swl,SplashScreen8.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen8.handle,0,ByteOpacity,LWA_ALPHA
LibFunc>user32,SetWindowLongA,swl,SplashScreen9.handle,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,SplashScreen9.handle,0,ByteOpacity,LWA_ALPHA


Let>HWND_TOPMOST=-1
Let>HWND_NOTOPMOST=-2
Let>SWP_NOSIZE=1
Let>SWP_NOMOVE=2
Let>SWP_NOACTIVATE=16
Let>SWP_SHOWWINDOW=64
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen9
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen8
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen7
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen6
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen5
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen4
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen3
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen2
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen1
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags

label>splash loop
IfWindowOpen>Splash Feed.exe
CloseWindow>Splash Feed.exe
endif

wait>0.3
IfFileExists>C:\Users\PC6\Desktop\forsplash.txt
copyfile>C:\Users\PC6\Desktop\forsplash.txt,C:\Users\PC6\Desktop\forsplash2.txt
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,1,one
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,2,two
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,3,three
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,4,four
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,5,five
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,6,six
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,7,seven
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,8,eight
ReadLn>C:\Users\PC6\Desktop\forsplash2.txt,9,nine
DeleteFile>C:\Users\PC6\Desktop\forsplash2.txt

GetDialogAction>SplashScreen1,r1
GetDialogAction>SplashScreen2,r2
GetDialogAction>SplashScreen3,r3
GetDialogAction>SplashScreen4,r4
GetDialogAction>SplashScreen5,r5
GetDialogAction>SplashScreen6,r6
GetDialogAction>SplashScreen7,r7
GetDialogAction>SplashScreen8,r8
GetDialogAction>SplashScreen9,r9


  Let>SplashScreen1.msLabel1=%one%
  Let>SplashScreen2.msLabel1=%two%
  Let>SplashScreen3.msLabel1=%three%
  Let>SplashScreen4.msLabel1=%four%
  Let>SplashScreen5.msLabel1=%five%
  Let>SplashScreen6.msLabel1=%six%
  Let>SplashScreen7.msLabel1=%seven%
  Let>SplashScreen8.msLabel1=%eight%
  Let>SplashScreen9.msLabel1=%nine%

  ResetDialogAction>SplashScreen1
  ResetDialogAction>SplashScreen2
  ResetDialogAction>SplashScreen3
  ResetDialogAction>SplashScreen4
  ResetDialogAction>SplashScreen5
  ResetDialogAction>SplashScreen6
  ResetDialogAction>SplashScreen7
  ResetDialogAction>SplashScreen8
  ResetDialogAction>SplashScreen9
  
  
Let>HWND_TOPMOST=-1
Let>HWND_NOTOPMOST=-2
Let>SWP_NOSIZE=1
Let>SWP_NOMOVE=2
Let>SWP_NOACTIVATE=16
Let>SWP_SHOWWINDOW=64
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen9
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen8
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen7
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen6
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen5
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen4
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen3
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen2
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags
LibFunc>user32,FindWindowA,dhwnd,TForm,SplashScreen1
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags

endif
goto>splash loop

label>splash done
cdg>SplashScreen


conjure
Pro Scripter
Posts: 63
Joined: Thu Jan 12, 2012 3:05 pm

Re: HWND_TOPMOST not working ?

Post by conjure » Mon Sep 28, 2020 7:00 am

I found that i have to use SetDialogProperty>SplashScreen1,,Formstyle,fsStayOnTop
Now i am having problem with the reset dialog.
I read that it does not work anymore on MS15.
Can someone tell me how to update the label inside the dialog?

Code: Select all


Dialog>SplashScreen1
   Caption=SplashScreen1


   Width=1
   Height=20
   Top=815
   Left=730
   Max=0
   Min=0
   Close=1
   Resize=0
Sec>Seconds


   Label=%Seconds%,5,0,true
EndDialog>SplashScreen1
SetDialogObjectFont>SplashScreen1,msLabel1,Tahoma,28,1,255
//Borderless Dialog
LibFunc>user32,SetWindowLongA,sres,SplashScreen1.handle,-16,1073741824
SetDialogProperty>SplashScreen1,,Formstyle,fsStayOnTop
Show>SplashScreen1
ResizeWindow>SplashScreen1,150,150
Label>Loop
  Wait>0.01
  //The next four lines only needed for compiled scripts
  Let>WIN_USEHANDLE=1
    GetWindowPos>SplashScreen1.handle,Dialog1X,Dialog1Y
    MoveWindow>SplashScreen1.handle,Dialog1X,Dialog1Y
      Let>WIN_USEHANDLE=0


Sec>Seconds


  SetDialogProperty>SplashScreen1,Label,,%Seconds%

msg Seconds
wait>3
Goto>Loop




User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: HWND_TOPMOST not working ?

Post by Marcus Tettmar » Mon Sep 28, 2020 7:30 am

To update a label just use the SetDialogProperty command and specify the Caption property:

SetDialogProperty>dialogname,labelname,caption,new caption

Reset is not needed. This is for legacy (very old) dialog code using the old dialog style.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

conjure
Pro Scripter
Posts: 63
Joined: Thu Jan 12, 2012 3:05 pm

Re: HWND_TOPMOST not working ?

Post by conjure » Mon Sep 28, 2020 8:00 am

Marcus Tettmar wrote:
Mon Sep 28, 2020 7:30 am
To update a label just use the SetDialogProperty command and specify the Caption property:

SetDialogProperty>dialogname,labelname,caption,new caption

Reset is not needed. This is for legacy (very old) dialog code using the old dialog style.
Thank you Marcus ..
I tried
SetDialogProperty>SplashScreen1,Label1,,%Seconds%
SetDialogProperty>SplashScreen1,Label,,%Seconds%
SetDialogProperty>SplashScreen1,Label1,Text,%Seconds%
SetDialogProperty>SplashScreen1,Label1,Label1,%Seconds%
But i am confused... I think i need some example to understand how it works

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: HWND_TOPMOST not working ?

Post by Marcus Tettmar » Mon Sep 28, 2020 8:05 am

Hi,

Just noticed you are mixing the old style dialog block syntax with the new functions. That won't work. Also your loop will never end and the number of seconds is never changing.

Not exactly sure what you are trying to do but here's a simple countdown from 10 seconds to 0 before the dialog closes again. Probably not exactly what you want to do but it might give you some pointers - it shows a simple dialog (made with the dialog designer) and a simple Repeat/Until loop:

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Left = 607
  Top = 264
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 211
  ClientWidth = 476
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object lblSeconds: TLabel
    Left = 184
    Top = 56
    Width = 32
    Height = 13
    Caption = 'Label1'
  end
end
EndDialog>Dialog1

Let>start_seconds=10
Let>end_seconds=0
SetDialogProperty>dialog1,lblSeconds,caption,start_seconds
Show>Dialog1

Let>seconds=start_seconds
Repeat>seconds
  Wait>1
  Let>seconds=seconds-1
  SetDialogProperty>dialog1,lblSeconds,caption,seconds
Until>seconds=end_seconds

CloseDialog>Dialog1
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts