/* Popfile.h */

//
// Modifications History
//
//$LB (7/11/2004) : add the _DLGOpenDir scol function, to select a directory
//
//$LB (8/11/2004) : add the _DLGClose scol function
//
//$LB (8/11/2004) : add threadH and threadID fields in the structs : the user is now able to force the dialog to close
//                  with the DLGClose function. It's a polymorphic function (takes all kind of scol dialog box in argument),
//                  so we have to check that the given argument is really a dialog box, that's why we added the magicnum fields too...
//



#ifndef __POPFILE_H__
#define __POPFILE_H__


#include <windows.h>
#include <shlobj.h>


#define DLGTYPE_OPENFILE 1
#define DLGTYPE_SAVEFILE 2
#define DLGTYPE_OPENDIR 3
#define DLGTYPE_MESSAGEBOX 4

typedef struct OFNArg
{
  char magicnum[4];

  int id;
  SOCKET sock;
  HWND hwnd;

  

  HANDLE threadH;
  DWORD threadID;

  OPENFILENAME ofn;
  BOOL err;
} OFNArg;


//$LB (7/11/2004) : BROWSEINFO Arg
typedef struct BRIArg
{
  char magicnum[4];

  int id;
  SOCKET sock;
  HWND hwnd;


  HANDLE threadH;
  DWORD threadID;

  
  BROWSEINFO bi;
  char directory[FILENAME_MAX];
  BOOL err;
} BRIArg;


typedef struct MBOXArg
{
  char magicnum[4];

  int id;
  SOCKET sock;
  HWND hwnd;

  HANDLE threadH;
  DWORD threadID;

  char * string;
  char * title;
  int flags;
  int ret;
  int err;
} MBOXArg;

#define MAX_FILES 128

typedef struct TSCFile
{
  FILE * file;
  int socket;
} TSCFile;


//////////////////////////////////////////////////////////

int FILEOpen(mmachine m);
int FILEClose (mmachine m);
int FILESeek (mmachine m);
int FILETell (mmachine m);
int FILESize (mmachine m);
int FILEWrite (mmachine m);
int FILEPrint (mmachine m);
int FILERead (mmachine m);
int GetFileNameFromP (mmachine m);

#endif // define __POPFILE_H__