Page 7 of 13

Re: DroopyLib

Posted: Sat Aug 04, 2012 12:13 pm
by Droopy
Sorry I don't understand
So you think your "Timer" is necessary
did you agree if i add the ApiTimer functions with the example code above ?

Re: DroopyLib

Posted: Sat Aug 04, 2012 2:43 pm
by Bisonte
Oh :oops:
I misunderstood...

Yes, of course !

Re: DroopyLib

Posted: Sun Aug 12, 2012 11:16 am
by Korolev Michael
Please, add Vista administrator mode request to Droopy Lib installer. Otherwise, it doesn't install with UAC enabled.

Re: DroopyLib

Posted: Sun Aug 12, 2012 5:55 pm
by SFSxOI
Korolev Michael wrote:Please, add Vista administrator mode request to Droopy Lib installer. Otherwise, it doesn't install with UAC enabled.

did you right click on the installer .exe - choose 'properties' then on the General tab click "unblock" - then right click on the file again and choose "Run As Administrator" ?

Re: DroopyLib

Posted: Mon Aug 13, 2012 9:08 pm
by Droopy
New version avalaible
Regards
13/08/12 : Library 4.61.008
Timer() Undeleted / tweaked by Bisonte
TimerKill() Undeleted / tweaked by Bisonte
SelfDelete() Tweaked (batch now self delete itself too)
PinItem() added
Using PBFastLib 4 : Installer Request Administrator mode for Windows Vista

Re: DroopyLib

Posted: Fri Aug 17, 2012 1:31 pm
by Droopy
Hello, new version avalaible :
17/08/12 : Library 4.61.009
ServiceStart() tweaked
ServiceStop() tweaked
ServiceStatus() added
ServiceConfig() added

Save & restore window position/size

Posted: Wed Aug 22, 2012 2:50 am
by jassing
Here's a couple of routines I wrote (using droopy registry funcs -- you can add these to droopy lib if you want)

The idea was to make it very simple for me to store the windows position/size on window-close; and then restore it on openwindow()
The "Identifier" should be unique, but if it's missing, it will use the window title; but if you use "" as identifier, and you have multiple windows with the same title, they will all try to use the same registry entry...

Anyway; not rocket science stuff; but simple to use...
(I used the base64 encoder purely to have "one registry entry" per window.)

Code: Select all

#WindowPositionRegistryKey = "HKEY_CURRENT_USER\Software\Windows\Position"

ProcedureDLL SaveWindowPosition( hWindow.l, cIdentifier.s="" )
	Protected.RECT iWinInfo
	Protected.l nSize, bSuccess = #False
	Protected.s cKey=#WindowPositionRegistryKey, cCode=Space(30)
  
  If IsWindow_(hWindow)
    If cIdentifier = "" : cIdentifier = GetWindowTitleEx(hWindow) : EndIf
    If cIdentifier <> ""
      If GetWindowRect_(hWindow,@iWinInfo)
        nSize = Base64Encoder(@iWinInfo,SizeOf(RECT),@cCode,30)
        If nSize
          If RegCreateKey(cKey,".")
            If RegSetValue(cKey,cIdentifier,Left(cCode,nSize-2),#REG_SZ,".")
              bSuccess = #True
            EndIf
          EndIf
        EndIf
      EndIf
    EndIf
  EndIf
  ProcedureReturn bSuccess
EndProcedure

ProcedureDLL.l RestoreWindowPosition( hWindow.l, cIdentifier.s = "")
	Protected.RECT iWinInfo
	Protected.l nSize, bSuccess = #False
	Protected.s cKey=#WindowPositionRegistryKey, cCode=Space(30)
  
  If IsWindow_(hWindow)
    If cIdentifier = "" : cIdentifier = GetWindowTitleEx(hWindow) : EndIf
    If cIdentifier <> ""
      cCode = RegGetValue(cKey,cIdentifier,".")+"=="
      If cCode <> "=="
        If Base64Decoder(@cCode,Len(cCode),@iWinInfo,SizeOf(RECT))
          With iWinInfo
          	If SetWindowPos_(hWindow,#HWND_TOP,\left,\top,\right-\left,\bottom-\top,#SWP_SHOWWINDOW);
          		bSuccess = #True
            EndIf
          EndWith
        EndIf
      EndIf
    EndIf
  EndIf
  ProcedureReturn bSuccess
EndProcedure

Re: DroopyLib

Posted: Wed Aug 22, 2012 7:59 pm
by Droopy
Hello jassing, nice code.
I already used this type of code for storing window position, using flag functions of the droopylib.

Code: Select all

FlagInit("HKEY_CURRENT_USER\Software\Windows\Position")
; Save position 
FlagSet("x",WindowX(#Window))
FlagSet("y",WindowY(#Window))

Re: DroopyLib

Posted: Tue Sep 04, 2012 8:07 pm
by Droopy
Hello, new version avalaible
04/09/12 : Library 4.61.010
Between() bug fixed
EditDefaultUserRegistry help added
FastHash() added
WindowsEnum() New example
FunctionAndPointer Tips added
IsWindowEx() Function added
WebgadgetDisableScriptError() Function added
GetWebgadgetSource() Function added
MultiWindow Tips added
SendStringInit() Function added
SendString() Function added
GetPidFromHandle() Function added
Windows Example added

Re: DroopyLib

Posted: Tue Sep 18, 2012 12:42 pm
by SeregaZ
dear Droopy, have you any FileSearchStop commands? i mean when user is not want to wait when search is end, press cancel button and search is stop.

Re: DroopyLib

Posted: Tue Sep 18, 2012 7:53 pm
by Droopy
@SeregaZ

No i don't have this, perhaps calling SearchFilesInit() in a thread ?

Re: DroopyLib

Posted: Tue Sep 18, 2012 8:15 pm
by Zebuddi123
@SeregaZ

do the file search via a thread. then when the user cancels the search kill the thread and release anything allocated

Zebuddi. :lol:

Re: DroopyLib

Posted: Wed Sep 19, 2012 6:05 am
by SeregaZ
already do, but i think killing the thread not safe. hard disk drive in this moment very active, i heard noise how it work. who knows how this killing can affect to hdd...
this code will work?

Code: Select all

Global FileSearchStop = #False

Procedure SearchFiles(Path.s,Mask.s)
  
  ;- Fill the LinkedList with the files found
  
  ; Add \ to Path if missing
  If Right(Path,1)<>"\" : Path+"\":EndIf
  
  ; Apply Structure
  lpFindFileData.WIN32_FIND_DATA
  
  ; Add Filter *.*
  Recherche.s=Path+Mask
  
  ; Initiate the Search
  Handle.l = FindFirstFile_(Recherche, @lpFindFileData)
  
  ; If search succeeds
  If Handle <> #INVALID_HANDLE_VALUE
    
    Repeat
      
      ; Trouve = File or Directory Found
      Trouve.s=PeekS(@lpFindFileData\cFileName)
      
      ; This is a not a directory
      If lpFindFileData\dwFileAttributes & #FILE_ATTRIBUTE_DIRECTORY =#False
        
        ; Display File found
        AddElement(Fichiers.s())
        Fichiers()=Path+Trouve
        ;Debug "--> "+Path+Trouve
        
      EndIf
      
      ; Exit when there is no more files
    Until FileSearchStop = #True Or FindNextFile_(Handle, @lpFindFileData)= #False
    
    ; Close the Api search Function
    if Handle
      FindClose_(Handle)
    Endif
    
  EndIf
  
  
EndProcedure
Global FileSearchStop = #False
***
Until FileSearchStop = #True Or FindNextFile_(Handle, @lpFindFileData)= #False

; Close the Api search Function
if Handle
FindClose_(Handle)
Endif
of course for applying and avoid conflict with droopy library i need to change name of fuctions. it will stop search process without killing thread?
and for SearchDirectory(Path.s,Mask.s) too.



and one more question - can GetSpecialFolderLocation shows path to "Programm Files (86)" in 64bits windows system? when my programm will be launch on 64bit - it will start wrong iexplorer - 64bit, but i need to start 32bit iexplorer when system is 64bit.

Re: DroopyLib

Posted: Wed Sep 19, 2012 8:20 pm
by Droopy
For FileSearchStop looking this in the next release.

For PFx86 you can use

Code: Select all

GetEnvironmentVariable("ProgramFiles(x86)")
Or 'Known Folders' (SHGetKnownFolderPath) can do this : see http://msdn.microsoft.com/en-us/library ... s.85).aspx

Re: DroopyLib

Posted: Mon Sep 24, 2012 8:54 pm
by SeregaZ
i cant see function for webshortcut. if you not have it - maybe my is fit?

Code: Select all

ProcedureDLL CreateWebShortcut(Path.s,WebLink.s)
  
  If CreateFile(0, Path)
    WriteStringN(0, "[InternetShortcut]")
    WriteStringN(0, "URL="+WebLink)
    CloseFile(0)
    Result = 1
  EndIf
  
  ProcedureReturn Result
EndProcedure

CreateWebShortcut("c:\PureBasic site.url","http://www.purebasic.fr")
web shortcut have hot key option too, but i dont know what key what code...
Hotkey=1617 for example is Ctrl + Alt + Q


and i have some problem with Windows 7. my install makes shortcut in start menu - programs. in XP all looks fine. on W7 - in big first menu fine, in programs looks like my shortcut not have ico:
Image

so if i see properties, and press the change icon button, but i am nothing change, just press OK - in this start menu starting show normal with icon, like it must show.