- Tweak Added : Skeleton
Function Added : NovellClientVersion
Function Added : ComputerSerialNumber
Function Added : RegGetType
Function Addon : RegGetValue can now read #REG_BINARY type
Function Addon : RegSetValue can now write #REG_BINARY type
Droopy's Lib
Droopy I really like your lib!
I did notice one thing (just a docs deal). This is about the Timer procedure.
I did notice one thing (just a docs deal). This is about the Timer procedure.
Thanks again for the lib! *thumbs up*Procedure Test()
ForEver ; Should be Repeat right?
Delay(500) ; Specify your delay here
XXXXXXX ; Your code here
ForEver
EndProcedure
Intrigued - Registered PureBasic, lifetime updates user
Thanks for the lib Droopy, DL'd it the other nite & have been have a lot of fun with it.
Think I have found a little bug with your LdbOpen(Database.s) in that if the specified path or file does not exist the debugger gives an "invalid memory access" error. You might like to have a look at this & maybe look at modifying your command to test the path string & give a return result in your next update.
Below code is a quick workaround for us in the meantime..
Regards,
Baldrick
Think I have found a little bug with your LdbOpen(Database.s) in that if the specified path or file does not exist the debugger gives an "invalid memory access" error. You might like to have a look at this & maybe look at modifying your command to test the path string & give a return result in your next update.
Below code is a quick workaround for us in the meantime..
Regards,
Baldrick
Code: Select all
; Baldricks little work around procedure for invalid memory access bug in
; LdbOpen(Database.s) in droopy's lib V1.25 if file doesn't exist.
; Example based on Droopy's Ldb String Test example from help file.
; Maybe some1 will find it usefull :)
Enumeration
#Validate
EndEnumeration
Procedure OpenLdb(SomeDbFile.s)
valid.l=ReadFile(#Validate,SomeDbFile) ; check to see if file opens prior
If valid ; to using LdbOpen(Database.s) command
CloseFile(#Validate)
LdbOpen(SomeDbFile)
EndIf
ProcedureReturn valid
EndProcedure
;- Create a Database with 7 Fields
LdbCreate("c:\test.txt","Field 1,Field 2,Field 3,Field 4,Field 5,Field 6,Field 7")
;- Save & Close the Database
LdbSaveDatabase()
LdbCloseDatabase()
;-- now try to open it again using new procedure
mydb=OpenLdb("c:\test.txt") ; comment this &
;mydb=OpenLdb("c:\test.dbz") ; uncomment this to get invalid file path
Debug "Database file validation number = "+Str(mydb) ; which will now
If mydb ; work error free
;- Add 9 Records
For n=1 To 9
LdbInsertRecord(-1)
For i= 1 To 7
LdbWrite(i,Str(n)+"-"+Str(i))
Next
Next
;- Insert a record as 2nd record
LdbInsertRecord(2)
;- Write to the 2nd record
LdbWrite(3,"4444")
LdbWrite(1,"11111")
;- Add a record @ the end of the database & Write to this record
LdbInsertRecord(-1)
LdbWrite(1,"fin")
;- Search for record that match "2-1" in the 1st Field
LdbSearchInit(1,"2-1",0)
Repeat
x= LdbSearch()
If x=0 : Break : EndIf
Debug x
ForEver
;- Save & Close the Database
LdbSaveDatabase()
LdbCloseDatabase()
Else
Debug "Invalid database file path, no actions carried out"
EndIf
End
Something like this :
Code: Select all
;- Open an existing Database ( Return 1 if success / 0 if fail )
ProcedureDLL LdbOpen(Database.s)
LdbInit()
If ReadFile(0,Database)
retour=1
CloseFile(0)
LdbDatabaseFile=Database
ClearList(LdbBdd.s())
OpenFile(0,LdbDatabaseFile)
Repeat
If Eof(0) : Break : EndIf
AddElement(LdbBdd())
LdbBdd()=ReadString()
ForEver
CloseFile(0)
LdbCountField()
EndIf
ProcedureReturn retour
EndProcedureSoz Droopy, think I found another little bug in your lib in the InputPasswordRequester function.
If you use a constant of "0" on your main window it creates a conflict with your gadget in your requester procedure.
Run the little code snippet below & you will see the main window closes when you click on OK in your requester leaving the requester staranded.
I have had a look at your source & have come up with a solution using #PB_Any in your lib. Recompiled & seems to work great. Also posted below.
Regards,
Baldrick
Test window to replicate fault:
My idea for a solution. See if you think this is ok.
If you use a constant of "0" on your main window it creates a conflict with your gadget in your requester procedure.
Run the little code snippet below & you will see the main window closes when you click on OK in your requester leaving the requester staranded.
I have had a look at your source & have come up with a solution using #PB_Any in your lib. Recompiled & seems to work great. Also posted below.
Regards,
Baldrick
Test window to replicate fault:
Code: Select all
#mainWindow =0
#winw=500
#winh=400
#winx = 0
#winy= 0
pgmname.s="Test Window"
Enumeration
#M0
#MI0
#MI1
#MI2
#Button1
EndEnumeration
mainwin.l = OpenWindow(#mainWindow,#winx,#winy,#winw,#winh,#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered,pgmname)
If mainwin
CreateMenu(#M0, mainwin)
MenuTitle("&File")
MenuItem(#MI0, "&Menu Item")
MenuBar()
MenuItem(#MI1, "&Exit")
AddKeyboardShortcut(#mainWindow,#PB_Shortcut_Escape ,#MI1)
MenuTitle("&Help")
MenuItem(#MI2,"H&elp")
EndIf
CreateGadgetList(mainwin)
ButtonGadget(#button1,#winx+10,#winy+10,50,20,"Pass")
Repeat
EventID.l = WindowEvent()
Delay(1)
currentfocus=GetFocus_()
If EventID = #PB_EventMenu
Select EventMenuID()
Case #MI1
Quit = 1
EndSelect
EndIf
If EventID = #PB_EventGadget
Select EventGadgetID()
Case #Button1
Password.s=InputPasswordRequester("Type a Password")
Debug password
EndSelect
EndIf
If EventID = #PB_Event_CloseWindow:Quit = 1:EndIf:Until Quit = 1:End
Code: Select all
ProcedureDLL.s InputPasswordRequester(Title.s) ;Password Requester title string.- Returns password as Result.s
WinPass.l=OpenWindow(#PB_Any, 398, 199, 152, 98, #PB_Window_WindowCentered |#PB_Window_ScreenCentered , Title)
CreateGadgetList(WindowID())
StG1.l=StringGadget(#PB_Any, 10, 10, 130, 20, "",#PB_String_Password)
BtG1.l=ButtonGadget(#PB_Any, 10, 40, 130, 50, "OK")
;AddKeyboardShortcut(0, #PB_Shortcut_Return, 1) ;<--------- really meant to be menu driven
ActivateGadget(StG1) ;and not working correctly with these mods
Repeat ; anyway. See EventwParam()=#VK_RETURN
Event = WaitWindowEvent() ; below.
If EventGadgetID() =BtG1 Or EventwParam()=#VK_RETURN: Break : EndIf
ForEver
Password.s=GetGadgetText(StG1)
CloseWindow(WinPass)
ProcedureReturn Password
EndProcedure
Thanks Baldrick
Next version like this :
Code: Select all
ProcedureDLL.s InputPasswordRequesterS(Title.s)
Temp=OpenWindow(#PB_Any, 398, 199, 152, 98, #PB_Window_WindowCentered |#PB_Window_ScreenCentered , Title)
CreateGadgetList(WindowID())
StringGadget(0, 10, 10, 130, 20, "",#PB_String_Password)
ButtonGadget(1, 10, 40, 130, 50, "OK")
ActivateGadget(0)
Repeat
Event = WaitWindowEvent()
Until EventGadgetID() =1 Or EventwParam()=#VK_RETURN
Password.s=GetGadgetText(0)
CloseWindow(Temp)
ProcedureReturn Password
EndProcedureVersion 1.27 avalaible
Changelog :
Changelog :
Wrap Fixed : NetUserAdd
Option Recurse Added for SearchFileInit
Function Added : GetPartOfFile
Function Added : LocaleDate
Function Added : NextDirectory
Function Changed : RunProgramAtStartup
Function Added : DelProgramAtStartup
Function Added : IsProgramRunAtStartup
Function Added : Week

