File: w_main.srw
Size: 4307
Date: Mon, 31 Dec 2018 21:14:38 +0100
$PBExportHeader$w_main.srw
forward
global type w_main from window
end type
type st_3 from statictext within w_main
end type
type uo_vmfile from u_displayicon within w_main
end type
type st_2 from statictext within w_main
end type
type st_1 from statictext within w_main
end type
type uo_iconfile from u_displayicon within w_main
end type
type uo_exeicon from u_displayicon within w_main
end type
type cb_cancel from commandbutton within w_main
end type
end forward

global type w_main from window
integer width = 1253
integer height = 624
boolean titlebar = true
string title = "Display Icon"
boolean controlmenu = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
st_3 st_3
uo_vmfile uo_vmfile
st_2 st_2
st_1 st_1
uo_iconfile uo_iconfile
uo_exeicon uo_exeicon
cb_cancel cb_cancel
end type
global w_main w_main

type variables
String is_pbvmname
Long il_count
Long il_index

end variables

on w_main.create
this.st_3=create st_3
this.uo_vmfile=create uo_vmfile
this.st_2=create st_2
this.st_1=create st_1
this.uo_iconfile=create uo_iconfile
this.uo_exeicon=create uo_exeicon
this.cb_cancel=create cb_cancel
this.Control[]={this.st_3,&
this.uo_vmfile,&
this.st_2,&
this.st_1,&
this.uo_iconfile,&
this.uo_exeicon,&
this.cb_cancel}
end on

on w_main.destroy
destroy(this.st_3)
destroy(this.uo_vmfile)
destroy(this.st_2)
destroy(this.st_1)
destroy(this.uo_iconfile)
destroy(this.uo_exeicon)
destroy(this.cb_cancel)
end on

event open;// set pb vm name
is_pbvmname = "pbvm80.dll"

// load icon of current exe
uo_exeicon.of_LoadIcon()

// load specific icon file
uo_iconfile.of_LoadIcon("iconfile.ico")

// get icon count from file
il_count = uo_vmfile.of_IconCount(is_pbvmname)

// load the first icon in the file
uo_vmfile.of_LoadIcon(is_pbvmname, 0)

Timer(1)

end event

event timer;// increment counter
il_index = il_index + 1
If il_index = il_count Then
   il_index = 0
End If

// load the next icon
uo_vmfile.of_LoadIcon(is_pbvmname, il_index)

end event

type st_3 from statictext within w_main
integer x = 37
integer y = 388
integer width = 480
integer height = 60
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "Icons from PBVM:"
boolean focusrectangle = false
end type

type uo_vmfile from u_displayicon within w_main
integer x = 585
integer y = 352
integer taborder = 30
end type

on uo_vmfile.destroy
call u_displayicon::destroy
end on

type st_2 from statictext within w_main
integer x = 37
integer y = 228
integer width = 411
integer height = 60
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "From icon file:"
boolean focusrectangle = false
end type

type st_1 from statictext within w_main
integer x = 37
integer y = 68
integer width = 507
integer height = 60
integer textsize = -8
integer weight = 700
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
long backcolor = 67108864
string text = "From current exe:"
boolean focusrectangle = false
end type

type uo_iconfile from u_displayicon within w_main
integer x = 585
integer y = 192
integer taborder = 20
end type

on uo_iconfile.destroy
call u_displayicon::destroy
end on

type uo_exeicon from u_displayicon within w_main
integer x = 585
integer y = 32
integer taborder = 10
end type

on uo_exeicon.destroy
call u_displayicon::destroy
end on

type cb_cancel from commandbutton within w_main
integer x = 878
integer y = 384
integer width = 297
integer height = 100
integer taborder = 10
integer textsize = -8
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
string text = "Cancel"
boolean cancel = true
end type

event clicked;Close(Parent)

end event