CODE:external(INT, "wsprintf", "wsprintfA", "User32.dll" );
external(INT, "GetOpenFileName", "GetOpenFileNameA", "Comdlg32.dll");
string path = OpenFileName(pathfolder()); // в функцию передаётся начальный каталог
messagebox(path);
function OpenFileName(string StartPath)
{
char path[256]= {0};
char OFNA[88], Filter[100], InitialDir[256], Title[256];
initialarray(#OFNA[0], 0);
wsprintf(address(#Filter[0]), "Текстовые файлы%c*.txt%c%c", 0, 0, 0); // тип файлов
strcpy(#InitialDir[0], StartPath); // начальный каталог
strcpy(#Title[0], "Открыть файл"); // заголовок диалога
writeaddress(sizearray(OFNA), address(#OFNA[0]));
writeaddress(address(#Filter[0]), address(#OFNA[12]));
writeaddress(address(#path[0]), address(#OFNA[28]));
writeaddress(sizearray(path), address(#OFNA[32]));
writeaddress(address(#InitialDir[0]), address(#OFNA[44]));
writeaddress(address(#Title[0]), address(#OFNA[48]));
if(GetOpenFileName(address(#OFNA[0])))return format(#path[0]);
return "";
} |