Look @ this quickly
DroopyLib
Re: DroopyLib
A special thansk to ABBKlaus30/07/12 : Library 4.61.006
String2Unicode() added
Unicode2String() added
WMI() Unicode bug fixed by ABBKlaus
GuidAPI() Unicode bug fixed
NetUserEnum() Unicode bug fixed
NetLocalGroupEnum() NetLocalGroupEnum()
MozillaVersion() added
-
SeregaZ
- Enthusiast

- Posts: 629
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: DroopyLib
UserLibUnicodeThreadSafe you didnt fixed? and do not forget Break!



Re: DroopyLib
its compiled in multilib-mode, no need to specify a library subsystem.SeregaZ wrote:UserLibUnicodeThreadSafe you didnt fixed? and do not forget Break!
Re: DroopyLib
Hello, try setting compiler options 'Create unicode executable'
Break is already added in GetPidProcess().
Break is already added in GetPidProcess().
-
SeregaZ
- Enthusiast

- Posts: 629
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: DroopyLib
are you sure? in old 4.30 with old droopy and another libraries this Library Subsystem field in options was necessary.ABBKlaus wrote: its compiled in multilib-mode, no need to specify a library subsystem.
Re: DroopyLib
Yes. Its not needed anymore, all four modes are now inside the lib in the Userlibraries folder. Thats why you have to delete the old droopy libs in the subsystem folder(s) otherwise the old libs get prioritySeregaZ wrote:are you sure? in old 4.30 with old droopy and another libraries this Library Subsystem field in options was necessary.
-
SeregaZ
- Enthusiast

- Posts: 629
- Joined: Fri Feb 20, 2009 9:24 am
- Location: Almaty (Kazakhstan. not Borat, but Triple G)
- Contact:
Re: DroopyLib
thanks.
Re: DroopyLib
Hi Droopy, may here a little bugfix...
Edit : Replaced : If IsWindow(hWnd) to If hWnd ... my mistake 
Code: Select all
; These procedures are wrong. You use a fixed Window...
ProcedureDLL Timer(TimerId,Delay,ProcedureAdress) ; Create a Timer which calls a Procedure
;// Delay is in Ms
SetTimer_(WindowID(0),TimerId,Delay,ProcedureAdress)
EndProcedure
ProcedureDLL TimerKill(TimerId) ; Kill the Timer specified by Timerid
KillTimer_(WindowID(0),TimerId)
EndProcedure
; This procedures have an extra parameter and a check if the window exists
; also its equal if 'Window' is a PB-Object No. or the OS-Handle
; and they return #True if they sucess
ProcedureDLL Timer(Window, TimerID, msDelay, ProcedureAdress)
Protected Result = #False
Protected hWnd = #False
If IsWindow_(Window)
hWnd = Window
Else
hWnd = WindowID(Window)
EndIf
If hWnd
SetTimer_(hWnd, TimerID, msDelay, ProcedureAdress)
Result = #True
EndIf
ProcedureReturn Result
EndProcedure
ProcedureDLL KillTimer(Window, TimerID)
Protected Result = #False
Protected hWnd = #False
If IsWindow_(Window)
hWnd = Window
Else
hWnd = WindowID(Window)
EndIf
If hWnd
KillTimer_(hWnd,TimerID)
Result = #True
EndIf
ProcedureReturn Result
EndProcedure
Last edited by Bisonte on Thu Aug 02, 2012 11:15 pm, edited 2 times in total.
Re: DroopyLib
Thanks Bisonte for helping debugging the library
02/08/12 : Library 4.61.007
Timer() deleted (replaced by PureBasic function AddWindowTimer())
TimerKill() deleted (replaced by PureBasic function RemoveWindowTimer())
SetProxy() added
Re: DroopyLib
Why you delete the Timer Procs ?
With AddWindowTimer() you can't add a callback
With AddWindowTimer() you can't add a callback
Re: DroopyLib
I delete these functions because AddWindowTimer() could create timer easily.
Could you explain why SetTimer_ with callback is an advantage over AddWindowTimer() ?
Could you explain why SetTimer_ with callback is an advantage over AddWindowTimer() ?
Code: Select all
Enumeration
#LabelListView
#LabelListIcon
#LabelEditor
#ListView
#ListIcon
#Editor
EndEnumeration
OpenWindow(0,0,0,340,200,"PureBasic AutoScroll Gadget Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
TextGadget(#LabelListView,10,10,100,20,"ListView")
TextGadget(#LabelListIcon,120,10,100,20,"ListIcon")
TextGadget(#LabelEditor,230,10,100,20,"Editor")
ListViewGadget(#ListView,10,30,100,150)
ListIconGadget(#ListIcon,120,30,100,150,"Test",70)
EditorGadget(#Editor,230,30,100,150)
AddWindowTimer(0,123,50)
Repeat
evt=WaitWindowEvent()
If evt= #PB_Event_Timer And EventTimer()=123
AddGadgetItem(#ListView,-1,Str(Compteur))
AddGadgetItem(#ListIcon,-1,Str(Compteur))
AddGadgetItem(#Editor,-1,Str(Compteur))
SetGadgetState(#ListView,CountGadgetItems(#ListView)-1) ;/ ListView
SendMessage_(GadgetID(#ListIcon),#LVM_ENSUREVISIBLE,CountGadgetItems(#ListIcon)-1,#True) ;/ ListIcon
SendMessage_(GadgetID(#Editor), #EM_SCROLLCARET, #False,#False) ;/ EditorGadget
Compteur+1
EndIf
Until evt=#PB_Event_CloseWindow
Re: DroopyLib
The advantage....
In your example... if you click on a slider, all stops, and continue if you release the mousebutton.
With callback, nothing stops...
and the code of an eventloop can look clearer
In your example... if you click on a slider, all stops, and continue if you release the mousebutton.
With callback, nothing stops...
and the code of an eventloop can look clearer
Code: Select all
Enumeration
#LabelListView
#LabelListIcon
#LabelEditor
#ListView
#ListIcon
#Editor
EndEnumeration
Procedure TimerCallBack(hWnd, uMsg, TimerID, Elapsedms)
Static Compteur
If TimerID = 123
AddGadgetItem(#ListView,-1,Str(Compteur))
AddGadgetItem(#ListIcon,-1,Str(Compteur))
AddGadgetItem(#Editor,-1,Str(Compteur))
SetGadgetState(#ListView,CountGadgetItems(#ListView)-1) ;/ ListView
SendMessage_(GadgetID(#ListIcon),#LVM_ENSUREVISIBLE,CountGadgetItems(#ListIcon)-1,#True) ;/ ListIcon
SendMessage_(GadgetID(#Editor), #EM_SCROLLCARET, #False,#False) ;/ EditorGadget
Compteur+1
If Compteur >= 100 ; Stops the Timer if it reached 100 times of execution
KillTimer_(hWnd, TimerID)
EndIf
EndIf
EndProcedure
OpenWindow(0,0,0,340,200,"PureBasic AutoScroll Gadget Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
TextGadget(#LabelListView,10,10,100,20,"ListView")
TextGadget(#LabelListIcon,120,10,100,20,"ListIcon")
TextGadget(#LabelEditor,230,10,100,20,"Editor")
ListViewGadget(#ListView,10,30,100,150)
ListIconGadget(#ListIcon,120,30,100,150,"Test",70)
EditorGadget(#Editor,230,30,100,150)
;AddWindowTimer(0,123,50)
SetTimer_(WindowID(0), 123, 50, @TimerCallBack())
Repeat
evt=WaitWindowEvent()
; No Code cause its in the Callback
Until evt=#PB_Event_CloseWindowRe: DroopyLib
Hello Bisonte
What do you think about an example mixing callback and functions ?
I don't understand Elapsedms parameter 
What do you think about an example mixing callback and functions ?
Code: Select all
ProcedureDLL Timer(Window, TimerID, msDelay, ProcedureAdress)
Protected Result = #False
Protected hWnd = #False
If IsWindow_(Window)
hWnd = Window
Else
hWnd = WindowID(Window)
EndIf
If hWnd
SetTimer_(hWnd, TimerID, msDelay, ProcedureAdress)
Result = #True
EndIf
ProcedureReturn Result
EndProcedure
ProcedureDLL TimerKill(Window, TimerID)
Protected Result = #False
Protected hWnd = #False
If IsWindow_(Window)
hWnd = Window
Else
hWnd = WindowID(Window)
EndIf
If hWnd
KillTimer_(hWnd,TimerID)
Result = #True
EndIf
ProcedureReturn Result
EndProcedure
Procedure Timer1() ; First ProgressBarGadget
SetGadgetState(0,GetGadgetState(0)+1)
beep_(700,100)
EndProcedure
Procedure TimerCallBack(hWnd,uMsg,TimerID,Elapsedms)
Static Compteur
If TimerID = 2
SetGadgetState(1,GetGadgetState(1)+1)
beep_(1000,100)
EndIf
EndProcedure
Procedure Timer3()
SetGadgetText(2,"Timer 3 Kill Timer 1 and 2")
TimerKill(0,1) ;/ Kill Timer #1
TimerKill(0,2) ;/ Kill Timer #2
beep_(1500,500)
TimerKill(0,3)
EndProcedure
OpenWindow(0,0,0,230,120,"API Timers with Callback",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ProgressBarGadget(0,10,10,210,30,0,65,#PB_ProgressBar_Smooth)
ProgressBarGadget(1,10,45,210,30,0,9,#PB_ProgressBar_Smooth)
SetGadgetState(0,0)
SetGadgetState(1,0)
TextGadget(2,10,80,210,30,"Timer 1/2/3 Started",#PB_Text_Center)
;/ Starting Timers
Timer(0,1,150,@Timer1()) ; Timer #1 each 150 ms
Timer(0,2,1000,@TimerCallBack()) ; Timer managed in a callback
Timer(0,3,10000,@Timer3()) ; Timer #3 each 10 seconds
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
Re: DroopyLib
So you think your "Timer" is necessaryDroopy wrote:Hello Bisonte
What do you think about an example mixing callback and functions ?
see : http://msdn.microsoft.com/en-us/library ... 85%29.aspxDroopy wrote:I don't understand Elapsedms parameter
ok the right names for the parameters are :
TimerProc(hWnd, uMsg, idEvent, dwTime)
Additional you can make the "ProcedureAdress" Parameter optional with Timer(Window, TimerID, TimeOut, ProcedureAdress= #Null)
