How can you open a file with the program associated with its file extension?

前端 未结 6 1516
半阙折子戏
半阙折子戏 2020-12-24 13:50

Is there a simple way to open a file by its associated program in windows? (like double clicking it in windows explorer but done automatically with my code)

For exam

6条回答
  •  生来不讨喜
    2020-12-24 14:16

    According to the MS Knowledge Base, ShellExecute should work (we do this in Delphi all the time):

    ShellExecute(Handle, "Open", Filename, "", "C:\", SW_SHOWNORMAL)
    

提交回复
热议问题