how do i make a popup window in the lower right corner of the screen
for example like AutoIt

Code: Select all
ExamineDesktops()
Procedure WindowProc(hWnd,uMsg,wParam,lParam)
Result = #PB_ProcessPureBasicEvents
Select uMsg
Case #WM_NCACTIVATE
Result = 1
EndSelect
ProcedureReturn Result
EndProcedure
LoadFont(0,"broadway",14)
flags = #PB_Window_SystemMenu| #PB_Window_MaximizeGadget| #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered | #PB_Window_SizeGadget
OpenWindow(0,0,0,400,300,"Test",Flags)
SetWindowCallback(@WindowProc())
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @Desktop.RECT, 0)
OpenWindow(1,DesktopWidth(0)-405,Desktop\bottom - 145,400,140,"Test",#WS_BORDER|#WS_POPUP|#PB_Window_Invisible)
StickyWindow(1,1)
ImageGadget(0,0,0,400,140,0,#PB_Image_Border)
CreateImage(0,400,140,24)
StartDrawing(ImageOutput(0))
DrawingFont(FontID(0))
DrawingMode(#PB_2DDrawing_Transparent )
Box(0,0,400,140,$FDA701)
DrawText(100,50,"Hi it is just a test",$01F0FD)
StopDrawing()
SetGadgetState(0,ImageID(0))
UseGadgetList(WindowID(0))
ButtonGadget(1,10,270,60,25,"RUN")
AddWindowTimer(0,125,10)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Timer
If flag = 1
time = ElapsedMilliseconds() - start
If time >= 5000
AnimateWindow_(WindowID(1),1000,#AW_HIDE|#AW_CENTER)
flag = 0
EndIf
EndIf
Case #PB_Event_Gadget
Select EventGadget()
Case 1
flag = 1
start = ElapsedMilliseconds()
AnimateWindow_(WindowID(1),1000,#AW_ACTIVATE|#AW_CENTER)
EndSelect
EndSelect
Until Quit = 1
End
RASHAD wrote:Hi and welcome to PB adventure
Next is a simple and direct way to do itCode: Select all
Code: Select all
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @Desktop.RECT, 0)
LoadFont(0,"broadway",14)
OpenWindow(0,0,0,0,0,"Test",#WS_BORDER|#WS_POPUP)
StickyWindow(0,1)
ImageGadget(0,0,0,400,140,0,#PB_Image_Border)
CreateImage(0,400,140,24)
StartDrawing(ImageOutput(0))
DrawingFont(FontID(0))
DrawingMode(#PB_2DDrawing_Transparent )
Box(0,0,400,140,$FDA701)
DrawText(100,50,"Hi it is just a test",$01F0FD)
StopDrawing()
SetGadgetState(0,ImageID(0))
AddWindowTimer(0,125,10)
Repeat
Select WaitWindowEvent()
Case #WM_KEYDOWN
If EventwParam() = 27
End
ElseIf EventwParam() = 9
ResizeWindow(0,GetSystemMetrics_(#SM_CXSCREEN)-405,Desktop\bottom - 145,400,140)
HideWindow(0,1)
flag = 1
start = ElapsedMilliseconds()
AnimateWindow_(WindowID(0),1000,#AW_ACTIVATE|#AW_CENTER)
EndIf
Case #PB_Event_Timer
If flag = 1
time = ElapsedMilliseconds() - start
If time >= 5000
AnimateWindow_(WindowID(0),1000,#AW_HIDE|#AW_CENTER)
flag = 0
EndIf
EndIf
EndSelect
ForEver
End
Code: Select all
Global flag,Desktop.RECT,desktopw
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @Desktop.RECT, 0)
desktopw = GetSystemMetrics_(#SM_CXSCREEN)
Procedure animate(par)
Repeat
If flag = 1 And IsWindow(0)
flag = 0
ResizeWindow(0,desktopw-405,Desktop\bottom - 145,400,140)
For OP = 0 To 255
SetLayeredWindowAttributes_(WindowID(0),0,OP,#LWA_ALPHA)
Delay(15)
Next
Delay(2500)
For OP = 255 To 0 Step -1
SetLayeredWindowAttributes_(WindowID(0),0,OP,#LWA_ALPHA)
Delay(15)
Next
ResizeWindow(0,-405,Desktop\bottom - 145,400,140)
EndIf
ForEver
EndProcedure
LoadFont(0,"broadway",14)
OpenWindow(0,-405,Desktop\bottom - 145,400,140,"Test",#WS_BORDER|#WS_POPUP)
SetWindowLongPtr_(WindowID(0),#GWL_EXSTYLE,#WS_EX_LAYERED)
SetLayeredWindowAttributes_(WindowID(0),0,0,#LWA_ALPHA)
StickyWindow(0,1)
ImageGadget(0,0,0,400,140,0,#PB_Image_Border)
CreateImage(0,400,140,24)
StartDrawing(ImageOutput(0))
DrawingFont(FontID(0))
DrawingMode(#PB_2DDrawing_Transparent )
Box(0,0,400,140,$FDA701)
DrawText(100,50,"Hi it is just a test",$01F0FD)
StopDrawing()
SetGadgetState(0,ImageID(0))
thread = CreateThread(@animate(),30)
Repeat
Select WaitWindowEvent()
Case #WM_KEYDOWN
If EventwParam() = 27
End
ElseIf EventwParam() = 9
flag = 1
EndIf
EndSelect
ForEver
End
Code: Select all
Global flag,Desktop.RECT,desktopw
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @Desktop.RECT, 0)
desktopw = GetSystemMetrics_(#SM_CXSCREEN)
Procedure animate(par)
Repeat
If flag = 1 And IsWindow(0)
flag = 0
For x = 0 To 405
ResizeWindow(0,desktopw-x,Desktop\bottom - 145,400,140)
Delay(5)
Next
Delay(2500)
For x = 405 To 0 Step -1
ResizeWindow(0,desktopw-x,Desktop\bottom - 145,400,140)
Delay(5)
Next
EndIf
ForEver
EndProcedure
LoadFont(0,"broadway",14)
OpenWindow(0,desktopw,Desktop\bottom - 145,400,140,"Test",#WS_POPUP)
StickyWindow(0,1)
ImageGadget(0,0,0,400,140,0,#PB_Image_Border)
CreateImage(0,400,140,24)
StartDrawing(ImageOutput(0))
DrawingFont(FontID(0))
DrawingMode(#PB_2DDrawing_Transparent )
Box(0,0,400,140,$FDA701)
DrawText(100,50,"Hi it is just a test",$01F0FD)
StopDrawing()
SetGadgetState(0,ImageID(0))
thread = CreateThread(@animate(),30)
Repeat
Select WaitWindowEvent()
Case #WM_KEYDOWN
If EventwParam() = 27
End
ElseIf EventwParam() = 9
flag = 1
EndIf
EndSelect
ForEver
End
Code: Select all
ExamineDesktops()
x=DesktopWidth(0) - 240
y=DesktopHeight(0) - 150
LoadFont(0,"Arial",-12)
OpenWindow(0, x, y, 220, 70, " App Installer", #PB_Window_Tool)
If CreateImage(0, 220, 70) And StartDrawing(ImageOutput(0))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0, 0, 220, 70, RGB(240, 240, 240))
DrawingFont(FontID(0))
DrawText(12,10,"Program is now installing...",0)
DrawText(75,40,"~ byTest ~",0)
StopDrawing()
ImageGadget(0, 0, 0, 0, 0, ImageID(0))
EndIf
Repeat
Event = WindowEvent()
Until Event = ?????????????????????Delay(800)??????????????????????????????????????
Code: Select all
#NoTrayIcon
$x = @DesktopWidth - 240
$y = @DesktopHeight - 150
$SplashTittle = " App Installer"
SplashTextOn($SplashTittle, " The program is now loading..." & @LF & "" & @LF & " ~ byTest ~", 220, 70, $x, $y, 0 + 32 + 4, "Arial", 10, 400)
Sleep(2000)
Run("charmap.exe")
Sleep(1000)
if ProcessExists("charmap.exe") Then
SplashTextOn($SplashTittle, " Charmap.exe now running..." & @LF & "" & @LF & " ~ byTest ~", 220, 70, $x, $y, 0 + 32 + 4, "Arial", 10, 400)
Sleep(1000)
EndIf
ProcessWaitClose("charmap.exe", 5)
Run('taskkill /F /IM charmap.exe', "", @SW_HIDE)
sleep(1000)
if not ProcessExists("charmap.exe") Then
SplashTextOn($SplashTittle, " Charmap.exe closed." & @LF & "" & @LF & " ~ byTest ~", 220, 70, $x, $y, 0 + 32 + 4, "Arial", 10, 400)
Sleep(1000)
EndIf
Sleep(2000)
SplashTextOn($SplashTittle, " Installation completed." & @LF & "" & @LF & " ~ byTest ~", 220, 70, $x, $y, 0 + 32 + 4, "Arial", 10, 400)
Sleep(3000)
Code: Select all
Global icon1=LoadIcon_(#Null,#IDI_EXCLAMATION)
Global icon2=LoadIcon_(#Null,#IDI_ERROR)
Structure _NOTIFYICONDATA
cbSize.l
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
PB_Alignment1.b[4]
CompilerEndIf
hWnd.i
uId.l
uFlags.l
uCallbackMessage.l
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
PB_Alignment2.b[4]
CompilerEndIf
hIcon.i
StructureUnion
szTip.s{64}
szTipEx.s{128}
EndStructureUnion
dwState.l
dwStateMark.l
szInfo.s{256}
StructureUnion
uTimeout.l
uVersion.l
EndStructureUnion
szInfoTitle.s{64}
dwInfoFlags.l
guidItem.GUID
hBalloonIcon.i
EndStructure
Global STInfo._NOTIFYICONDATA
Procedure SystrayBalloon(Title.s,Text.s,Flag,Message=#NIM_MODIFY)
STInfo\cbSize=SizeOf(_NOTIFYICONDATA)
If STInfo\cbSize
If Message=#NIM_ADD
STInfo\uVersion=#NOTIFYICON_VERSION
STInfo\uCallbackMessage=#WM_NOTIFYICON
STInfo\uId=1
STInfo\uFlags=#NIF_ICON|#NIF_INFO|#NIF_MESSAGE|#NIF_TIP
STInfo\uTimeout=1000 ;Duration time
STInfo\hwnd=HandleMyWin
STInfo\hIcon=icon1
STInfo\hBalloonIcon=icon2
STInfo\dwInfoFlags=#NIIF_INFO
STInfo\dwState=#NIS_SHAREDICON
STInfo\szTip="And also a nice tooltip message..."
EndIf
If Flag = 0
STInfo\dwInfoFlags=#NIIF_INFO
ElseIf Flag = 1
STInfo\dwInfoFlags=#NIIF_WARNING
EndIf
STInfo\szInfoTitle=Left(Title,63)
STInfo\szInfo=Left(Text,255)
ProcedureReturn Shell_NotifyIcon_(Message,@STInfo)
EndIf
ProcedureReturn #False
EndProcedure
Procedure SystrayBalloonOff()
STInfo\szInfo = ""
Shell_NotifyIcon_(#NIM_MODIFY,STInfo)
EndProcedure
SystrayBalloon("Hey"," "+#CRLF$+"This is the initial information..."+#CRLF$+" ",0,#NIM_ADD)