API calls

Does anyone know if it’s possible from C/Side to make API calls? I need to be able to use the API function shellexecute() - any ideas?

Calling API’s directly is not possible (a few excepted, perhaps). Many API’s require parameters you don’t have available in C/AL. You could make an OCX for the task (and when using VB for this, take a look at www.allapi.net for samples and syntax). What is it you want to use ShellExecute for? Is Shell not enough? Did you try Hyperlink (works for more than the web, i.e. you can call a Word document this way)? John

Thanks John for your reply. I thought I’d need to create an OCX so thanks for the confirmation. First of all, I dont want to have to specify first, what to open the file up with. I would like the Open With window to appear. Secondly with regards to the Hyperlink option - I dont know. Maybe this is the answer, I’ll have to research that avenue. Thanks again for your correspondence.

As far as I know things like the following API-call are NOT possible in C/AL: ShellExecute (Handle,“print”, “something.txt”,0,0,SW_HIDE); Any suggestions? Anolis Sittard Netherlands

use SHELL(Name [, Param, …])

The hyperlink is working very fine for that purpose. You should use the following syntax: HYPERLINK(‘FILE://some.txt’); If you have connected an application for the desired extention the OS should automatically with the right program, but I do not know what happens, if there is no application connected to the extention.

The next way to open with “open with” is to exececute the following statement SHELL(‘cmd.exe /c start c:\winzip.xxas’); If the extention is registered, it will be opened with the desired program, if not the “open with” dialog appears. This is the standard for the command “start” of your dos-prompt. You only should check if you are working an 95/98 or NT for selecting the right command-interpreter (cmd.exe or command.com) the syntax should be the same.

There are variables from the old MSDOS environment which you can get at from Navision. One of these, COMSPEC tells you where the command intepreter is and what its name is. Yeah, I know Navision is a Windoze product, but the Navision’s SHELL command still uses MSDOS, which is part of the Windows package. You should try to avoid hardwiring the filespec for the command processor into your Navision code, if at all possible :slight_smile: ------- Tim Horrigan