Skip to main content

Problem:

This example program demonstrates how to find the executable program name which is associated with a particular file extension and then use it to open the specified file. It uses the two Win32 API functions FindExecutable and CreateProcess.

Resolution:

INTRODUCTION

==========

This example program demonstrates how to find the executable program name which is associated with a particular file extension and then use it to open the specified file. It uses the two Win32 API functions FindExecutable and CreateProcess.

File associations are made in Windows Explorer under the File Types option. This example uses the filename DUMMY.CBL which is associated with Net Express when it is installed.

SOURCE FILES:

==========

Program Files         Description

-------------------     -----------------------------------------------------------

FINDEXE.CBL         Program that calls the Win32 API functions.

DUMMY.CBL           Program which will be opened in Net Express.

MINIWIN.CPY        These files contain converted C structures and types for use with Net Express

WINTYPES.CPY      and Windows API calls. WINUSER.CPY WINBASE.CPY

SHELL32.LIB           Import Library which resolves links to the FindExecutable function call. This

                               library is part of the Windows SDK files delivered with Net Express. It must be

                               referenced in the Project Build Settings/Link/Advanced settings for

                               FINDEXE.EXE.

REQUIREMENTS:

==========

This sample should run in all environments that have Net Express installed.

OPERATION:

========

Rebuild this project to create the file findexe.exe. This is a character mode program that will execute a new instance of Net Express to open the file DUMMY.CBL.

==========================================================

Keywords: demonstration, sample, example, demo, win32 api, findexe.zip

demo.ex

demo.ne

Attachments:

findexe.zip

Old KB# 4169