DroopyLib

Developed or developing a new product in PureBasic? Tell the world about it.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: DroopyLib

Post by Rinzwind »

Slightly adjusted from http://forums.purebasic.fr/english/view ... =7&t=47410 to fit into the format of RegGetValue

Structure Registry_CharacterArray
c.c[0]
EndStructure
.
.

Case #REG_MULTI_SZ
GetHandle = RegQueryValueEx_(hKey, ValueName, 0, @lType, #Null, @Length)
If GetHandle = 0
*Buffer = AllocateMemory(Length)
RegQueryValueEx_(hKey, ValueName, 0, @lType, *Buffer, @Length)
Length / SizeOf(Character) - 2
For i = 0 To Length
If *Buffer\c = #Null : Lines + 1 : EndIf
Next
Length = 0
For i = 0 To Lines
ts.s = PeekS(@*Buffer\c[Length])
If GetValue <> "": GetValue + #CRLF$: EndIf
GetValue + ts
Length + Len(ts) + 1
Next
FreeMemory(*Buffer)
EndIf
EndSelect
.
.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: DroopyLib

Post by Rinzwind »

Btw why not using EnableExplicit in DroopyLib? How many times did you bump your head because of accidental variable creation troubles?
SeregaZ
Enthusiast
Enthusiast
Posts: 617
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: DroopyLib

Post by SeregaZ »

how to set two search options for SearchFilesInit command?

NbFiles=SearchFilesInit(wherekeys$,"*.one",1)
blablabla
NbFiles=SearchFilesInit(wherekeys$,"*.two",1)
blablabla

or

SearchFilesInit(wherekeys$,"*.*",1)
Repeat
File.s=SearchFilesGet()
tmp$ = Right(File, 3)
Select tmp$
Case "one"
blablabla
Case "two"
blablabla

this "*.*" will make very slow search or it will be same, like "*.one"?
Mythros
Enthusiast
Enthusiast
Posts: 306
Joined: Mon Aug 19, 2013 3:28 pm

Re: DroopyLib

Post by Mythros »

How do I use the new DroopyLib HMOD after I install it?

Thank You!

Mythros
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

Begin your code with

Code: Select all

XIncludeFile #PB_Compiler_Home+"hmod\DroopyLib.pbi"
UseModule DroopyLib
Hit CTRL+F1 on DroopyLib function to get help
to get autocompetion open DroopyLib.pbi (with CTRL+F12) in a tab and set autocompletion (in the editor) for all open files
loulou2522
Enthusiast
Enthusiast
Posts: 495
Joined: Tue Oct 14, 2014 12:09 pm

Re: DroopyLib

Post by loulou2522 »

Droopy wrote:Begin your code with

Code: Select all

XIncludeFile #PB_Compiler_Home+"hmod\DroopyLib.pbi"
UseModule DroopyLib
Hit CTRL+F1 on DroopyLib function to get help
to get autocompetion open DroopyLib.pbi (with CTRL+F12) in a tab and set autocompletion (in the editor) for all open files
Hi droopy,
Regread key won't work in your lib with windows10. Can you see please ?
THanks in advance
loulou2522
Enthusiast
Enthusiast
Posts: 495
Joined: Tue Oct 14, 2014 12:09 pm

Re: DroopyLib

Post by loulou2522 »

Droopy wrote:Begin your code with

Code: Select all

XIncludeFile #PB_Compiler_Home+"hmod\DroopyLib.pbi"
UseModule DroopyLib
Hit CTRL+F1 on DroopyLib function to get help
to get autocompetion open DroopyLib.pbi (with CTRL+F12) in a tab and set autocompletion (in the editor) for all open files
Hi droopy,
Regread key won't work in your lib with windows10. Can you see please ?
THanks in advance
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

i just test some registry function (over windows 10) with no problems :

Code: Select all

XIncludeFile #PB_Compiler_Home+"hmod\DroopyLib.pbi"
UseModule DroopyLib

; Create the Test Key

RegCreateKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Test",".")

; Write Value
RegSetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Test","SZ Value","SZ",#REG_SZ,".")

; Read Value
MessageRequester("",RegGetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Test","SZ Value","."))
loulou2522
Enthusiast
Enthusiast
Posts: 495
Joined: Tue Oct 14, 2014 12:09 pm

Re: DroopyLib

Post by loulou2522 »

Droopy wrote:i just test some registry function (over windows 10) with no problems :

Code: Select all

XIncludeFile #PB_Compiler_Home+"hmod\DroopyLib.pbi"
UseModule DroopyLib

; Create the Test Key

RegCreateKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Test",".")

; Write Value
RegSetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Test","SZ Value","SZ",#REG_SZ,".")

; Read Value
MessageRequester("",RegGetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Test","SZ Value","."))
Hi droopy,
Right,
it works when droopy lib is in purebasic directory if not it dosen't work
Thanks for solving,
SeregaZ
Enthusiast
Enthusiast
Posts: 617
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: DroopyLib

Post by SeregaZ »

and exe file need to be start with admin rights for this registry functions.
loulou2522
Enthusiast
Enthusiast
Posts: 495
Joined: Tue Oct 14, 2014 12:09 pm

Re: DroopyLib

Post by loulou2522 »

When compile in X64 version with purifier enabled

Code: Select all

Procedure.s GetFileVersion(FileName.s,Which,FieldName) ;+++
in droopy lib give an error on line

Code: Select all

   Result      = CallFunction(1,"VerQueryValueW",*pBlock,@lpSubBlock$,@lplpBuffer,@puLen) 


Procedure stack has been coorupted
and the programm crash

If i generate an exe the programm don't crash
Thanks
User avatar
Droopy
Enthusiast
Enthusiast
Posts: 658
Joined: Thu Sep 16, 2004 9:50 pm
Location: France
Contact:

Re: DroopyLib

Post by Droopy »

could you try with debugger disabled ?
SeregaZ
Enthusiast
Enthusiast
Posts: 617
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: DroopyLib

Post by SeregaZ »

i have old verstion of Droopy, becouse i have old vestion of PB - 5.31. and in a help i see code for get pixel code:

Code: Select all

ProcedureDLL GetPixelColor(x,y) ; Returns the RGB color of the pixel at the specified coordinates or #CLR_INVALID (-1) if coordinate is outside of the screen
  sysviewDC = GetDC_( hwndSysview ) 
  ProcedureReturn GetPixel_( sysviewDC,x, y ) 
EndProcedure
it is same for new version? if yes - it have memory leak. after 10 minuts of active using this function - application is freeze.

this GetDC need to be free. some kind of:

Code: Select all

ProcedureDLL GetPixelColor(x,y) ; Returns the RGB color of the pixel at the specified coordinates or #CLR_INVALID (-1) if coordinate is outside of the screen
  sysviewDC = GetDC_( hwndSysview ) 
  color = GetPixel_(sysviewDC, x, y)
  ReleaseDC_(hwndSysview, sysviewDC) 
  ProcedureReturn color
EndProcedure
User avatar
Bisonte
Addict
Addict
Posts: 1226
Joined: Tue Oct 09, 2007 2:15 am

Re: DroopyLib

Post by Bisonte »

SeregaZ is right. And I could not find any declaration of the variable : hwndSysView so it is 0.

So it gets alsways the DC from the mainscreen (see MSDN)

Code: Select all

Procedure GetPixelColor(x, y) ;+++
  
  ;/// Returns the RGB color of the pixel at the specified coordinates or #CLR_INVALID (-1) if coordinate is outside of the screen
  
  Protected SysViewDC, Color = -1
  
  SysViewDC = GetDC_(#Null)
  
  If SysViewDC
    Color = GetPixel_(SysViewDC, x, y) 
    ReleaseDC_(SysViewDC)
  EndIf
  
  ProcedureReturn Color
  
EndProcedure
PureBasic 6.04 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
loulou2522
Enthusiast
Enthusiast
Posts: 495
Joined: Tue Oct 14, 2014 12:09 pm

Re: DroopyLib

Post by loulou2522 »

Droopy wrote:could you try with debugger disabled ?
I try it and it works perfectly even if debugger is enabled, the problem comes from the purifier in every case where it is check
Post Reply