December 04, 2020, 11:21:39 AM

Author Topic: [bb] find mydocuments by b32 [ 1+ years ago ]  (Read 532 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] find mydocuments by b32 [ 1+ years ago ]
« on: June 29, 2017, 12:28:42 AM »
Title : find mydocuments
Author : b32
Posted : 1+ years ago

Description : Uses SHGetFolderPathA to obtain the 'mydocuments' folder path.

Code :
Code: BlitzBasic
  1. ;Save these lines as a textfile in the directory c:program fileslitz3duserlibs
  2. ;and call the file 'shell32.decls'
  3. ;-------------------------------------
  4. ;.lib "shell32.dll"
  5.  
  6. ;api_GetFolderPath%(hwnd, p1, p2, p3, out*) : "SHGetFolderPathA"
  7. ;-------------------------------------
  8. ;it will enable the api_getfolderpath command
  9.  
  10.  
  11.         Print GetMyDocumentsPath$()
  12.        
  13.         WaitKey()      
  14.         End
  15.  
  16. ;-------------------------------------------------------------------------------------------------------
  17. ;                                                                                       GetMyDocumentsPath()
  18. ;-------------------------------------------------------------------------------------------------------
  19. ;uses SHGetFolderPathA to get the mydocuments folder
  20. Function GetMyDocumentsPath$()
  21.  
  22.         bank = CreateBank(256)
  23.        
  24.         api_GetFolderPath(0, $5, 0, 0, bank)
  25.        
  26.         s$ = ""
  27.         For i = 0 To 255
  28.                 b = PeekByte(bank, i)
  29.                 If b = 0 Then Exit
  30.                 s$ = s$ + Chr$(b)
  31.         Next
  32.        
  33.         FreeBank bank
  34.        
  35.         If Right$(s$, 1) <> "" Then s$ = s$ + ""
  36.        
  37.         Return s$
  38.        
  39. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal