_Convert_Files, _MakeDirectory, _SendFile, AppendFile, Convert_Files, CopyFile, DeleteFile, DeleteFileQuery, EditFile, ExistFile, FindFiles, Get_Filename, Get_FileSize, Get_FileTitle, GetFreeDiskSpace, GetOpenSaveFileName, MakeDirectory, OpenAsciiFile, ReadFile, ReadFileEx, RenameFile, SaveImageTextInfo, SelectFile, SelectImage, TraceToLogFile, WriteFile
Description
AppendFile( char *DestFile
, char *SourFile
);
This function appends the source file to the destination file.
See Also
ExistFile, CopyFile, RenameFile, WriteFile, ReadFile
Interactive command to this function: File > Import/Export > Convert Files
Description
Convert_Files( char *Dest_Directory
, char *sour_dir
, char *Sour_Filter
, intdest_fmt
, intdest_compr
, intsour_fmt
, intsubdir
, intx_resize
, inty_resize
, intimage_info
);
This function converts files from one directory to another. You can include subdirectories, change format and resize the images.
Parameters
dest_compr
Destination compression.
LIM format - lossless | |
LIM format - no compression | |
BMP format - no compression | |
TIF format - no compression | |
TIF format - LZW (key needed) | |
TIF format - CCIT (binary image only) | |
JPG format - level of compression | |
JP2 format - level of compression (0 = lossless) | |
GIF format - lossless (not binary image, key needed) | |
PNG format - no compression | |
ND2 format - lossless | |
AVI format - this parameter is ignored. Compression depends on the selected codec an its settings. |
See Also
_Convert_Files
Description
CopyFile( char *DestFile
, char *SourFile
);
This function copies g source file to a destination file.
See Also
ExistFile, RenameFile, ReadFile, AppendFile, WriteFile
Description
DeleteFile(
file_name
);
This function erases the file.
Note
This function is typically called, when you invoke the _ImageOpen and press Delete button.
See Also
DeleteFileQuery
Description
DeleteFileQuery(
file_name
);
This function erases the file. This function is typically called, when you Delete item under commands button. Before deleting the file, MessageBox with a warning appears.
See Also
DeleteFile
Description
EditFile(
char *Filename
);
This function enables you to edit a filename. The Edit File dialog box appears.
See Also
EditMacro
Description
int ExistFile(
char *Filename
);
This function tries to find the specified file.
If the Filename parameter specifies a filename and extension only the function searches for a matching file in the following directories (in this order): 1 The directory containing the executable file for the current task. 2 The Windows directory, 3 The Windows system directory (the directory containing such system files as GDI.EXE). 4 The directories listed in the PATH environment variable.
// ExistFile example - shows how to use different functions for File handling. dword key,keys[1]; char buf[1024], buffer[10000]; char press_enter[256]; char *str; strcpy(press_enter, "\tPress Enter to Continue."); keys[0] = VK_RETURN; SetCommandText("Working..."); Int_CreateTextWindow("API Example - ReadFile, CopyFile, WriteFile, SelectFile, RenameFile, AppendFile functions.", 0,RGB(0,0,128),RGB_WHITE,100); Wait(3); // Testing existance of C:\CONFIG.SYS if(ExistFile("c:/config.sys") == FALSE) { strcpy(buf, "ExistFile function... File c:\config.sys doesn't exist."); strcat(buf, press_enter); Int_CreateTextWindow(buf,5,RGB(0,0,128),RGB_WHITE,90); key=0; while(!key) key=Int_GetEvents(keys,1); goto end; } strcpy(buf, "ExistFile function... File c:\config.sys exists."); strcat(buf, press_enter); Int_CreateTextWindow(buf,5,RGB(0,0,128),RGB_WHITE,90); key=0; while(!key) key=Int_GetEvents(keys,1); // Copying C:\CONFIG.SYS to C:\CONFIG.DEL if(CopyFile("c:/config.del", "c:/config.sys") != TRUE) { strcpy(buf, "CopyFile function... File c:\config.sys cannot be copied to c:\config.del"); strcat(buf, press_enter); Int_CreateTextWindow(buf,5,RGB(0,0,128),RGB_WHITE,90); key=0; while(!key) key=Int_GetEvents(keys,1); goto end; } strcpy(buf, "CopyFile function... File c:\config.sys was succesfully copied to c:\config.del"); strcat(buf, press_enter); Int_CreateTextWindow(buf,5,RGB(0,0,128),RGB_WHITE,90); key=0; while(!key) key=Int_GetEvents(keys,1); // Renaming C:\CONFIG.DEL to C:\CONFIG.DUM, deleting if destination already exists if(ExistFile("c:/config.dum")) DeleteFile("c:\config.dum"); RenameFile("c:/config.dum", "c:/config.del"); strcpy(buf, "RenameFile function... File c:\config.del was succesfully renamed to config.dum"); strcat(buf, press_enter); Int_CreateTextWindow(buf,5,RGB(0,0,128),RGB_WHITE,90); key=0; while(!key) key=Int_GetEvents(keys,1); // Reading C:\CONFIG.DUM ReadFile("c:/config.dum", buffer, 10000); str = strchr(buffer, VK_RETURN); if(str) *str=0; sprintf(buf,"First line of config.dum:\t%s","buffer"); Int_CreateTextWindow(buf,5,RGB(0,0,128),RGB_WHITE,90); key=0; while(!key) key=Int_GetEvents(keys,1); // Overwriting C:\CONFIG.DUM with text "First Line." WriteFile("c:/config.dum", "First Line. ", 12); Int_CreateTextWindow("First line of CONFIG.DUM is overwritten with text 'First Line.",5,RGB(0,0,128),RGB_WHITE,90); key=0; while(!key) key=Int_GetEvents(keys,1); // Appending to C:\CONFIG.DUM the file C:\AUTOEXEC.BAT." AppendFile("c:/config.dum", "c:/autoexec.bat"); Int_CreateTextWindow("AUTOEXEC.BAT is appended to CONFIG.DUM.\tPress Enter to Continue. ",5,RGB(0,0,128),RGB_WHITE,90); key=0; while(!key) key=Int_GetEvents(keys,1); Int_CreateTextWindow("Viewing C:\CONFIG.DUM",0,RGB(0,0,128),RGB_WHITE,100); EditFile("c:/config.dum"); DeleteFile("c:/config.dum"); Int_CreateTextWindow("CONFIG.DUM was deleted just now.\tPress Enter to Continue. ",5,RGB(0,0,128),RGB_WHITE,90); key=0; while(!key) key=Int_GetEvents(keys,1); end: Int_CloseTextWindow();
See Also
CopyFile, RenameFile, ReadFile, AppendFile, WriteFile
Description
FindFiles( char *Buffer
, intCount
, char *Filename
, intonlyDir
);
This function fills the buffer with the specified files. Macro is responsible to allocate the buffer. Each filename has a constant width in the buffer - MAX_FILE_NAME. The filename parameter may use wildcards (* and ?).
Parameters
//FindFiles example - searches your hard disk C for LIM images and outputs list of images to the file RESULT1.TXT. char destfile[256]; char directory[256]; char buf[256],filenames[28800], buffer[28800]; char newline[5]; char *filename; int numfiles,qw; dword i, count; Int_CreateTextWindow("API Example - FindFiles function.", 0,RGB(0,0,128),RGB_WHITE,100); SetCommandText("Working..."); strcpy(destfile,"results1.txt"); qw = Int_Question("Searching hard disk C for LIM images","Do you want to continue?","&Yes","&No","","",1,0); newline[0]=13; newline[1]=10; newline[2]=0; if(qw == 1) { strcpy(buf,"Wait a moment, please...\tSearching hard disk C for LIM images"); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); numfiles = FindFiles(filenames, 28800, "c:\*.lim", 1); strcpy(buf,"List of files will be stored in RESULTS1.TXT on selected directory."); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); SelectFile(directory,"Text files|*.txt|",1); if(numfiles != 0) { *buffer = 0; for(i=0; i<numfiles; i=i+1) { filename = filenames+(i*MAX_FILE_NAME); strcat(filename, newline); strcat(buffer, filename); } sprintf(buf,"%s\%s","directory,destfile"); count = strlen(buffer); WriteFile(buf,buffer,count); EditFile(buf); } else { Int_Question("Example","No files were found!","OK", NULL, NULL,NULL, 1, 0); } } Int_CloseTextWindow();
Description
double GetFreeDiskSpace(
char *Directory
);
This function retrieves free space left on the disk specified.
Description
GetOpenSaveFileName( intOpenFile_bOpen
, char *OpenFile_StartDir
, char *OpenFile_Filter
, char *OpenFile_Title
, char *OpenFile_EndDir
, intOpenFile_EndDirLen
, char *OpenFile_FileName
, intOpenFile_FileLen
);
This function allows the user to select file in open or save dialog box.
Parameters
Description
Get_FileSize( char *Filename
, int *LpSize
);
This function retrieves the size of the file identified by the filename parameter.
Description
Get_FileTitle( char *Title
, char *Filename
);
This function retrieves the title of the file identified by the filename parameter.
Description
int Get_Filename( intwhat
, char *Filename
);
Retrieves various information - like filename or path to the data filename specified by the what parameter.
Parameters
what
Type of the file.
Object data filename. | |
Field data filename. | |
Length data filename. | |
Angle data filename. | |
Name of the currently selected macro. | |
Full path to the currently opened image. | |
Last opened image in the sequence. | |
Configuration (*.ini) file. | |
Executable filename of running program. | |
Windows directory. |
See Also
Get_Info, Get_FileTitle
Description
MakeDirectory(
char *Directory
);
This function creates a directory.
See Also
SetDrive, SetRelativePath
Description
ReadFile( char *DestFile
, char *Buffer
, intCount
);
This function reads data to the specified buffer. Count parameter specifies the number of bytes to be read from the file.
Parameters
See Also
ExistFile, RenameFile, CopyFile, AppendFile, WriteFile
Description
ReadFileEx( char *DestFile
, char *Buffer
, intCount
, intReadFileFlag
);
This function reads data to the specified buffer. Count parameter specifies the number of bytes to be read from the file.
Parameters
See Also
ReadFile, ExistFile, RenameFile, CopyFile, AppendFile, WriteFile
Description
int RenameFile( char *DestFile
, char *SourFile
);
This function renames the file or directory specified by sourfile parameter to the name given by the destfile. The sourfile name must be the path of an existing file or directory. The new name must not be the name of an existing file or directory.
Return Values
See Also
ExistFile, CopyFile, AppendFile, WriteFile
Description
SaveImageTextInfo(
char *Filename
);
This function saves the current document info into a text file.
Description
int SelectFile( char *dir
, charext
, intonlyDir
);
This function opens a dialog window and waits for the user to select a file or directory.
Parameters
Return Values
char filepath[260]; int returned; strcpy(filepath, "c:\"); returned = SelectFile(filepath, "Text files (*.txt;*.doc)|*.txt;*.doc|", 0); if (returned==TRUE) WaitText(0, filepath); else WaitText(0, "The user selected nothing");
See Also
FindFiles, CopyFile, ReadFile, WriteFile, AppendFile, RenameFile
Description
SelectImage(
char Directory
);
This function displays the Browse dialog box to enable an image selection.
Description
TraceToLogFile(
char *Buffer
);
This function writes a string (Buffer) to the application log file. The lxapp.log file is stored in the Application Data directory. (via Documents and Settings\All Users\Application Data\Laboratory Imaging\Platform)
Description
WriteFile( char *DestFile
, char *Buffer
, intCount
);
This function writes data from buffer to the specified file. Count parameter specifies the number of bytes to be written to the file.
Parameters
See Also
ExistFile, RenameFile, ReadFile, AppendFile, CopyFile
This function runs the File > Import/Export > Convert Files command.
Description
_Convert_Files();
This function converts files from one directory to another. It displays the Conversion of Files dialog box.
See Also
Convert_Files
Description
_SendFile();
This function sends a file to the mail recipient. First it shows the dialog for selecting the file with information about its size. Then it displays dialog for an empty message with previously selected file as an attachment. This dialog comes from the default e-mail client program and keeps its default settings.