DroopyLib

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

Hello,

The file format for .url is descibed here : http://www.fmtz.com/formats/url-file-format/article for url format ?
SeregaZ
Enthusiast
Enthusiast
Posts: 628
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: DroopyLib

Post by SeregaZ »

no. i mean i have a small problem with your shortcut. in start menu it shows like file without icon.
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post 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
User avatar
Sveinung
Enthusiast
Enthusiast
Posts: 142
Joined: Tue Oct 07, 2003 11:03 am
Location: Bergen, Norway

Re: DroopyLib

Post by Sveinung »

Thank you!

Sveinung
SeregaZ
Enthusiast
Enthusiast
Posts: 628
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: DroopyLib

Post 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
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post 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)
SeregaZ
Enthusiast
Enthusiast
Posts: 628
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: DroopyLib

Post by SeregaZ »

it means for change 1 item - i need to rewrite whole file? :cry:
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post 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
SeregaZ
Enthusiast
Enthusiast
Posts: 628
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: DroopyLib

Post 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
SeregaZ
Enthusiast
Enthusiast
Posts: 628
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: DroopyLib

Post 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?
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: DroopyLib

Post 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...
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
SeregaZ
Enthusiast
Enthusiast
Posts: 628
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: DroopyLib

Post 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
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post 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)
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: DroopyLib

Post by jassing »

For GetFileVersion(), is it possible to retrieve "other fields" in the resource's version table?
ie: Email or Website?
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

I don't know :|
Post Reply