How to launch windows app (EXE) in Angular

How to launch windows app (EXE) in Angular

How to launch an exe file such as notepad.exe from a component. (Confirmed only in IE11)

To run Angular in IE, you need to edit polyfills.ts under src.

Angular でウィンドウズアプリ(EXE)を起動する方法

All of the above comments must be removed.

Otherwise, if you want to use web-animations-js in IE, you need to enable the import statement for that location.

Launch notepad.exe in Angular 6

Now let’s start notepad.exe.

app.component.ts

import { Component } from '@angular/core';
interface ActiveXObject {
  new(s: string): any;
}
declare const ActiveXObject: ActiveXObject;
@Component({
  selector: 'app-root',
  template:
  `
  <button (click)='onClick()'<ボタン>/button>
  `,
  styleUrls: ['./app.component.styl']
})
export class AppComponent {
  public onClick(){
    const app = new ActiveXObject('WScript.Shell');
    app.Run('notepad.exe');
  }
}

Change the local intranet settings in IE11 as follows

Angular でウィンドウズアプリ(EXE)を起動する方法

Now run ng serve –open and start IE11.

button to start notepad.

Angular でウィンドウズアプリ(EXE)を起動する方法

Angular でウィンドウズアプリ(EXE)を起動する方法

コメント

Discover more from 株式会社CONFRAGE ITソリューション事業部

Subscribe now to keep reading and get access to the full archive.

Continue reading

Copied title and URL