niedziela, 19 marca 2017

WinExec and ShellExecute in class (C++ Builder)


#include <vcl.h>
#include <ShellApi.h>

class my_Execute
{
private:

wchar_t *temp;

UnicodeString text;
public:
my_Execute(TEdit *edit);
void run_WinExec();
void run_ShellExecute();

};


my_Execute::my_Execute(TEdit *edit)
{
 temp=edit->Text.c_str();
 text=edit->Text;
}

void my_Execute::run_WinExec()
{
char *value;
wcstombs(value,temp,24);
WinExec(value,SW_NORMAL);
}

void my_Execute::run_ShellExecute()
{

  ShellExecute(Application->Handle,("open"),LPCSTR(temp),NULL,NULL,SW_SHOWNORMAL);
}

Brak komentarzy:

Prześlij komentarz