Page 4 of 5

Posted: Tue Sep 06, 2005 9:07 pm
by Droopy
New Version 1.25 8)
  • 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

Posted: Tue Sep 06, 2005 11:22 pm
by GeoTrail
Brilliant, as always ;)
Thanks Droopy

Posted: Tue Sep 06, 2005 11:47 pm
by okasvi
dont know why, but i had to manually remove everything :? before it installed new version, and in window which opens when you start installer it says that "PureBasic 3.93"

edit: forgot to say how great your lib is :D
its really great :D

Posted: Wed Sep 07, 2005 7:58 am
by Droopy
okasvi wrote:dont know why, but i had to manually remove everything :? before it installed new version, and in window which opens when you start installer it says that "PureBasic 3.93"
I use Num3 Library Installer 2 and i don't know how to solve this :?:

Posted: Fri Sep 09, 2005 4:56 am
by Intrigued
Droopy I really like your lib!

I did notice one thing (just a docs deal). This is about the Timer procedure.
Procedure Test()
ForEver ; Should be Repeat right?
Delay(500) ; Specify your delay here
XXXXXXX ; Your code here
ForEver
EndProcedure
Thanks again for the lib! *thumbs up*

Posted: Fri Sep 09, 2005 8:19 am
by Droopy
Yes it should be repeat forever

In fact this procedure is launched as a Thread, and the delay is specified in this procedure .

Posted: Thu Sep 22, 2005 12:05 pm
by Baldrick
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

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


Posted: Thu Sep 22, 2005 1:44 pm
by Droopy
Ok I try to put this in the next release 8)

Posted: Thu Sep 22, 2005 6:55 pm
by Droopy
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
EndProcedure

Posted: Mon Sep 26, 2005 3:30 pm
by Baldrick
Soz Droopy, think I found another little bug in your lib in the InputPasswordRequester function. :oops:
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
My idea for a solution. See if you think this is ok.

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

Posted: Mon Sep 26, 2005 8:55 pm
by Droopy
Thanks Baldrick 8) 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
EndProcedure

Posted: Mon Sep 26, 2005 10:11 pm
by Droopy
Version 1.26 Avalaible 8)

Changelog in the Chm ...

Posted: Wed Oct 12, 2005 6:45 pm
by Droopy
Version 1.27 avalaible 8)

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

Posted: Wed Oct 12, 2005 7:35 pm
by GeoTrail
GetPartOfFile, what does that do?

Posted: Wed Oct 12, 2005 7:46 pm
by Droopy
GetPartOfFile : Return a part of file
This function can replace : GetPathPart() GetFilePart() GetExtensionPart()

Use this constants ( Pipe Allowed )
#GFP_Drive=1
#GFP_Path=2
#GFP_File=4
#GFP_Extension=8