get program associated with the document extension

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

get program associated with the document extension

Post by BackupUser »

Code updated for 5.20+

Restored from previous forum. Originally posted by wayne1.

Code: Select all

;returns path to program associated with the document extension
;FOR DOCUMENTS ONLY!!
;Returns a value greater than 32 if successful, or a value less 
;than or equal to 32 otherwise. 


If OpenWindow(0, 100, 100, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)

  *Memory = AllocateMemory(100) ;buffer for return string

  FindExecutable_("eula.1028.txt", "c:\", *Memory);set to valid path
  ;returns path to program associated with the document extension
  ;FOR DOCUMENTS ONLY!!

  Path$ = PeekS(*Memory)
  MessageRequester("Associated Program and Path", Path$, 0)


  Repeat
    EventID = WaitWindowEvent()

    If EventID = #PB_Event_CloseWindow 
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf

End


Edited by - wayne1 on 03 October 2001 05:41:36