Показать сообщение отдельно
Старый 28.02.2020, 14:45   #3  
Pustik is offline
Pustik
Участник
 
807 / 372 (14) ++++++
Регистрация: 04.06.2004
первый параметр этой функции должен быть int (_hwnd), а у Вас : "Please select your file"
X++:
client static str #fileNamelength getOpenFileName(int              _hwnd,
                           FilenameFilter   _conFilter,
                           str              _strInitialPath,
                           str              _dialogTitle,
                           str              _strDefaultExtension='',
                           str              _strDefaultFileName='',
                           int              _flags = #OFN_FILEMUSTEXIST)
вот job-ик с примером
X++:
static void JobOpenFileName(Args _args)
{
    FileNameFilter filter = ['Все файлы','*.*'];
    str filename;
    ;
    filename = Winapi::getOpenFileName(0,filter,'', 'Выберите файл', '*.*','');
    
    if (filename)
    {
        info('ok');
        info(filename);
    }
    else
    {
        info('отмена');
    }
    
}
можно использовать .NET
X++:
static void JobOpenFileName_NET(Args _args)
{
    System.Windows.Forms.OpenFileDialog _Dialog;
    System.Windows.Forms.DialogResult   _DialogResult;
    System.Windows.Forms.DialogResult   okResult;
    str                                 selectedPath;
    int                                 resultValue;
    int                                 okValue;
    ; 
    _Dialog = new System.Windows.Forms.OpenFileDialog();
    
    _DialogResult = _Dialog.ShowDialog();    
 
    // Get the value from the dialog
    resultValue = CLRInterop::getAnyTypeForObject(_DialogResult);

    // Parse the OK enumeration of the enum DialogResult
    okResult = CLRInterop::parseClrEnum('System.Windows.Forms.DialogResult', 'OK');
    
    // Get the int value of the OK enumeration
    okValue = CLRInterop::getAnyTypeForObject(okResult);

    // If the dialog is ended with OK, get the value or set it to blank
    selectedPath = okValue & resultValue ? _Dialog.get_FileName() : '';        
    
    if (selectedPath)
    {
        info('ok');
        info(selectedPath);
    }
    else
    {
        info('отмена');
    }
}
__________________
-Ты в гномиков веришь?
-Нет.
-А они в тебя верят, смотри, не подведи их.

Последний раз редактировалось Pustik; 28.02.2020 в 15:24.