Skip to content
View in the app

A better way to browse. Learn more.

#T/N/X/T

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Externes Programm starten

Hallo,

 

Ich will ein externes Programm starten.

 

Mein Code:


#define SW_HIDE             0
#define SW_SHOWNORMAL       1
#define SW_NORMAL           1
#define SW_SHOWMINIMIZED    2
#define SW_SHOWMAXIMIZED    3
#define SW_MAXIMIZE         3
#define SW_SHOWNOACTIVATE   4
#define SW_SHOW             5
#define SW_MINIMIZE         6
#define SW_SHOWMINNOACTIVE  7
#define SW_SHOWNA           8
#define SW_RESTORE          9
#define SW_SHOWDEFAULT      10
#define SW_FORCEMINIMIZE    11
#define SW_MAX              11


#import "shell32.dll" 
int ShellExecuteA(int hWnd,int lpVerb,string lpFile,int lpParameters,int lpDirectory,int nCmdShow); 
#import


int start()
 {
//----
  ShellExecuteA(0,"open","C:\test.exe",0,0,SW_SHOW);
//----
  return(0);
 }

 

Leider wird das Programm nicht gestartet. Hat jemand eine Idee?

Ich hab Windows 7 vieleicht liegt es ja daran.

 

Gruß Bernd

Edited by Bernd

Featured Replies

#import "shell32.dll" 
int ShellExecuteA(int hWnd,int lpVerb,string lpFile,int lpParameters,int lpDirectory,int nCmdShow); 
#import

  ShellExecuteA(0,"open","C:\test.exe",0,0,SW_SHOW);

Kann es sein, dass dein 2. Übergabeparamerter nicht paßt? Es wird ein int erwartet, du übergibst aber einen String ("open")?

Hi Bernd,

 

ShellExecute wird versuchen test.exe zu öffnen. Es sieht diese Datei als Dokument an und sucht ein Programm mit dem man diese exe Datei öffnen kann. Funktionieren würde ein „open“ mit „test.txt“ – vorausgesetzt natürlich, dass die Datei test.txt auch existiert und geöffnet werden kann. Ich befürchte, dass das was Du vorhast wird so nicht funktionieren wird. Es kann auch sein, dass Du „C:\\test.exe“ nehmen musst statt „C:\test.exe“ (doppelter backslash) – aber ich kenne mich nicht mit MQL aus, daher weiß ich nicht, ob es das sein kann?

 

Du kannst aber auch mal das hier versuchen:

 

STARTUPINFO si;

PROCESS_INFORMATION pi;

ZeroMemory( &si, sizeof(si) );

si.cb = sizeof(si);

ZeroMemory( &pi, sizeof(pi) );

 

if( CreateProcessA( NULL, "C:\\Test.exe", NULL, NULL, FALSE, 0, NULL, NULL, &si,&pi ) )

{

WaitForSingleObject( pi.hProcess, INFINITE );

 

CloseHandle( pi.hProcess );

CloseHandle( pi.hThread );

}

 

Mit dem WaitForSingleObject wartest du, bis das Programm beendet ist. Wenn Du nicht warten willst, kannst du diese Zeile einfach löschen, aber nicht das Schließen der Handels!

Die Funktionen sind in Kernel32.dll implementiert....

 

 

Daniel

  • Author

Hallo,

 

Vielen Dank euch beiden, ich werd es mal Ausprobieren.

 

Gruß Bernd

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.