Page 8 of 13

Re: DroopyLib

Posted: Tue Sep 25, 2012 7:21 pm
by Droopy
Hello,

The file format for .url is descibed here : http://www.fmtz.com/formats/url-file-format/article for url format ?

Re: DroopyLib

Posted: Tue Sep 25, 2012 10:53 pm
by SeregaZ
no. i mean i have a small problem with your shortcut. in start menu it shows like file without icon.

Re: DroopyLib

Posted: Sun Sep 30, 2012 4:07 pm
by Droopy
Hello, version 4.61.011 avalaible
28/09/12 : Library 4.61.011
Compiled with PbFastLib 6 (indent of examples fixed)
SearchFileStop() Function added
GetDiskSpace() Function added
GetHandleEx() Function added
GetClassName() Function added
Windows example changed
SimulatePurebasicEvent (tips) code changed
ShortcutTarget() Function added
WindowsInformation Tips added
ApplicationInstallation Tips added
WindowsControl_GetHandle() Function added
WindowsControl_WaitPresence() Function added
WindowsControl_Click() Function added
WindowsControl_ClickEx() Function added
WindowsControl_WriteText() Function added

Re: DroopyLib

Posted: Sun Sep 30, 2012 11:39 pm
by Sveinung
Thank you!

Sveinung

Re: DroopyLib

Posted: Mon Oct 01, 2012 12:26 pm
by SeregaZ
how i can teach read ini and write ini to read and write with #PB_Unicode flag?

now when it write - replace some special symbols like іңғұүқөқұәіғ to ??????? symbols:

Code: Select all

CompilerIf (#PB_Compiler_Unicode = 0)
 CompilerError "Turn on: Create Unicode executable"
CompilerEndIf

If OpenWindow(5, 216, 0, 250, 100, "edit", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_TitleBar)
  
  TextGadget(5000, 90, 10, 200, 20, "іңғұүқөқұәіғ")
  
  TextGadget(501, 30, 37, 20, 20, "INI")
  TextGadget(502, 10, 67, 50, 20, "Unicode")
  StringGadget(5001, 78, 35, 166, 20, "")
  StringGadget(5002, 78, 65, 166, 20, "")

  If IniWrite("C:\test.ini", "MAIN", "somekey", "іңғұүқөқұәіғ")
    SetGadgetText(5001, IniRead("C:\test.ini", "MAIN", "somekey"))
  EndIf
  
  If CreateFile(0, "C:\test2.ini")
    WriteStringN(0, "іңғұүқөқұәіғ", #PB_Unicode)  
    CloseFile(0)
    
    If ReadFile(0, "C:\test2.ini")
      SetGadgetText(5002, ReadString(0, #PB_Unicode))
      CloseFile(0)
    EndIf
  EndIf
  
  
  Repeat
    
  WEvent = WaitWindowEvent()
  If WEvent = #PB_Event_CloseWindow
    Quit35 = 1
  EndIf
        
  Until Quit35 = 1 
  
EndIf

Re: DroopyLib

Posted: Mon Oct 01, 2012 4:29 pm
by Droopy
Hello, i try to use the api to write unicode value, but it fails.
It works with PureBasic natvie functions.

Code: Select all

ProcedureDLL IniWrite2(INIFile.s,Section.s,Key.s,string.s) ; Writes a key to an Ini File
  
  CompilerIf #PB_Compiler_Unicode  
    
    lid=OpenLibrary(#PB_Any,"Kernel32.dll")
    ret=CallFunction(lid,"WritePrivateProfileStringW",@Section,@Key.s,@string,@INIFile)
    CloseLibrary(fid)
     
  CompilerElse
    
    ret=WritePrivateProfileString_(@Section,@Key,@string,@INIFile)
    
  CompilerEndIf
  
  If ret<>0 : ret=1:EndIf
  ProcedureReturn ret
  
EndProcedure


Inp.s=InputRequester("","","")

;/ Droopy Way
IniWrite2("C:\droopy.ini","","text",Inp)

;/ Native way
CreatePreferences("C:\Native.ini")
WritePreferenceString("Text",Inp)

Re: DroopyLib

Posted: Mon Oct 01, 2012 6:43 pm
by SeregaZ
it means for change 1 item - i need to rewrite whole file? :cry:

Re: DroopyLib

Posted: Mon Oct 01, 2012 8:50 pm
by Droopy
SeregaZ wrote:it means for change 1 item - i need to rewrite whole file? :cry:
Just replace IniWrite in your code with IniWrite2

Code: Select all

ProcedureDLL IniWrite2(INIFile.s,Section.s,Key.s,string.s) ; Writes a key to an Ini File
  
  OpenPreferences(INIFile)
  PreferenceGroup(Section)
  WritePreferenceString(Key,string)
  ClosePreferences()
  
EndProcedure

Re: DroopyLib

Posted: Thu Oct 18, 2012 9:47 am
by SeregaZ
i have some problem with fantom ini file :)

by my plan procedure reads some information from ini file - so if variable with file name is empty - procedure is not fill whole string field. so as you can see filename is empty, but readini still is read some fantom file :)
Image

Re: DroopyLib

Posted: Thu Oct 18, 2012 10:17 am
by SeregaZ
i try to change this code to:

Code: Select all

Procedure Reg(filenamein.s)
;Procedure Reg(filename.s)
  
  Protected filename.s

  filename = filenamein
it is right?

Re: DroopyLib

Posted: Thu Oct 18, 2012 10:30 am
by Bisonte
Why not this :

Code: Select all

  Procedure Reg(filename.s)
    
    ;this
    If filename <> "" 
    ;or this
    If FileSize(filename)>0
check if filename is empty or check if the "IniFile" exists...

Re: DroopyLib

Posted: Thu Oct 18, 2012 10:53 am
by SeregaZ
to many code :) for your variant needs two variant read ini function for all string fields - one for empty, second for not empty. in my case one code for both variant. but i see this fantom ini file :) protected is fix this problem, but i am still cant understand why read ini from not existing file is reads some information :)


probably problem is source if read ini. my system is work by this:
1. search any ini files in special folder
2. if not find any ini file - create path for future creation ini file like 1.ini

in my case 1.ini was exist, but i delite it. 1.ini not exist any more, but read ini still read from it strings :) now i see the same problem in another place of my code. so i think:

Code: Select all

ProcedureDLL.s IniRead(INIFile.s,Section.s,Key.s) ; Returns the contents of a key from an Ini File
  ret.s=Space(512)
  GetPrivateProfileString_(@Section,@Key,@"",@ret,512,@INIFile)
  ProcedureReturn ret
EndProcedure
needs to change someting like this:

Code: Select all

ProcedureDLL.s IniRead(INIFile.s,Section.s,Key.s) ; Returns the contents of a key from an Ini File
  if INIFile = "" or FileSize(INIFile) < 0
    ProcedureReturn ""
  else
    ret.s=Space(512)
    GetPrivateProfileString_(@Section,@Key,@"",@ret,512,@INIFile)
    ProcedureReturn ret
  endif
EndProcedure

Re: DroopyLib

Posted: Tue Nov 13, 2012 10:17 am
by Droopy
Hello, new version available
13/11/12 : Library 5.00.001
GraphGadget Example modified
GraphClear() Added
CreateShortcut() Tweaked (PB5 don't support 'Not' with String)

Re: DroopyLib

Posted: Sat Dec 01, 2012 9:06 am
by jassing
For GetFileVersion(), is it possible to retrieve "other fields" in the resource's version table?
ie: Email or Website?

Re: DroopyLib

Posted: Sat Dec 01, 2012 9:06 pm
by Droopy
I don't know :|