. . . Electronics Business Intelligence
     
          Eng.   中文
DistStock Enterprise Technical Information

Starting DistiStock searches from other applications

DistiStock can be launched, and searches can be started, from any application that allows access to the Windows command line. Assuming you have installed DistiStock into the default directory, the full command line to start a DistiStock search for part number MAX232ACSE+, for example, would be as follows:
c:\dististock\bin\dististock4.exe pn=MAX232ACSE+
In a more generalized form that application developers will be familiar with, the command line needs to be formatted like this:
path_to_dististock_bin_directory\dististock4.exe [pn=part_number_to_search]
If DistiStock is not already running, DistiStock will be launched and the search will begin.

If DistiStock is already running, the DistiStock window will come to the top and the search will begin. Any searches still in progress will be cancelled.

The part number entered on the command line must be at least 3 characters long. If not, DistiStock will still open but you will get an error message asking you to enter at least 3 characters.


Example of starting DistiStock from Internet Explorer™ using Javascript

The following example is provided for reference only. It shows how to integrate DistiStock into a web application that is run in Internet Explorer™. Note that this code will only work in IE and even then, only if IE is configured correctly.

To use this example you need:

  • the Enterprise Plan of DistiStock installed into the default directory
  • Internet Explorer configured to enable "ActiveX controls not marked as safe for scripting".
  • Internet Explorer configured to "Allow active content to run in files on My Computer".
Now, suppose you have the following HTML in your web page.
<input type="text" name="partnumber" id="partnumber">
<button type="button" onclick="startSearch()">Start Searching</button>
The following javascript function will open DistiStock on the part number you entered and begin the search when you click Start Searching.
function startSearch() {
	var pn = document.getElementById("partnumber").value;
	var shell = new ActiveXObject("Shell.Application");
	var app = 'C:\\DistiStock\\bin\\Dististock4.exe';
	var params = "pn=" + pn;
	var workdir = 'C:\\DistiStock\\bin';
	shell.ShellExecute( app, params, workdir, "open", "1");
}
If you meet the requirements shown above, you can try it here:    

Other Languages

All serious programming languages intended for Windows development, support launching an external application or a new process from inside an already running application. The specifics will be dependent on the language used, but in essence they all call either ShellExecute or ShellExecuteEx in Shell32.dll.

For .NET applications, refer to Process.Start
For Native windows applications, refer to ShellExecute or ShellExecuteEx.

关于我们      联系方式      意见反馈      法律申明     

Copyright © 2010-2024 Smart Data Works Ltd. All rights reserved.

All logos and trademarks are the property of the respective trademark owners. ® and denote registered trademarks in the United States and other countries.