"Oleg Prosvetov" <[EMAIL PROTECTED]> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × 
ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: news:[EMAIL PROTECTED]
> éç> îÁ ñÆÉÌÅ ÍÙ ÔÁËÏÅ ÄÅÌÁÌÉ Ó ÐÏÍÏÝØÀ UDF, ÐÒÁ×ÄÁ ÖÅÓÔËÏÇÏ ÒÁÚÇÒÁÎÉÞÅÎÉÑ
> éç> ÐÏ ÐÒÁ×ÁÍ Õ ÎÁÓ ÎÅ ÂÙÌÏ.
> éç> üÔÏ ÂÙÌÉ Ú×ÕËÏ×ÙÅ ÆÁÊÌÙ ÌÏÇÏ× Ó ËÏÔÏÒÙÍÉ ÍÏÖÎÏ ÂÙÌÏ ÒÁÂÏÔÁÔØ ËÁË
> éç> ÓÒÅÄÓÔ×ÁÍÉ ïó ÔÁË É ÎÁÛÅÊ ÐÒÏÇÒÁÍÍÏÊ É ÐÏ ÉÓÔÅÞÅÎÉÉ ÓÒÏËÁ ÈÒÁÎÅÎÉÑ
> éç> ÎÕÖÎÏ ÂÙÌÏ ÉÈ ÕÄÁÌÑÔØ.
>
> îÅ ÎÁÊÄÅÔÓÑ ÄÌÑ ÐÒÉÍÅÒÞÉËÁ ÔÁËÏÊ ÆÕÎËÃÉÉ UDF ?
>
ðÏÖÁÌÕÊÓÔÁ
//---------------------------------------------------------------------------
#include <Windows.hpp>
#include <SysInit.hpp>
#include <System.hpp>
#include <Sysutils.hpp>
#include <Dialogs.hpp>

#include <stdio.h>
#include <time.h>
#include <ibase.h>

typedef struct blob {
 short (*blob_get_segment) (void*, char*, int, short*);
 void *blob_handle;
 long blob_number_segments;
 long blob_max_segment;
 long blob_total_length;
 void (*blob_put_segment) (void *, char *, unsigned short);
} *IB_BLOB;

extern "C" __declspec(dllexport) int   fn_FileExists(char* str);
extern "C" __declspec(dllexport) int   fn_FileDelete(char* str);

extern "C" __declspec(dllexport) char* fn_FindFirst(char* str);
extern "C" __declspec(dllexport) char* fn_FindNext(void);
extern "C" __declspec(dllexport) int   fn_FindClose(void);

extern "C" __declspec(dllexport) void  fn_PutBlob(char* str, IB_BLOB in_B, 
IB_BLOB out_B);


char buffer[256];
char str_dt[256];
char str_date[256];
char str_dtInc[256];
char str_Access[20];
char str_None[]   = "---";
char str_Denied[] = "xxx";
char str_FileName[256];
char str_Sub[256];
char str_Cat[256];
char str_Param[256];
char str_AsDate[256];
char str_TalonWork[256];

int  iDate_Day;
int  iDate_Hour;
int  iDate_Min;

AnsiString strFolder;
TSearchRec srFile;
int        fSearchInProcess = 0;
tm      tmstruct;
tm      tmstruct_D;
tm      tmstruct_H;
tm      tmstruct_M;
tm      tmstruct_T;
long     msec;


#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* 
lpReserved)
{
    return 1;
}
/---------------------------------------------------------------------------
int fn_FileExists(char* str)
{
    return (int)FileExists(str);
}
//---------------------------------------------------------------------------
int fn_FileDelete(char* str)
{
    DeleteFile( ChangeFileExt(str, ".txt") );

    return (int)DeleteFile(str);
}
//---------------------------------------------------------------------------
char* fn_FindFirst(char* str)
{
    if (fSearchInProcess)
        return str_Denied;

    fSearchInProcess = 1;

    strFolder = str;

    if (FindFirst(SlashSep(str, "*.*"), faArchive, srFile) != 0)
    {
        fSearchInProcess = 0;
        return str_None;
    }

    strncpy(str_FileName, AnsiUpperCase(SlashSep(strFolder, 
srFile.Name)).c_str(), 255 );
    return str_FileName;
}
//---------------------------------------------------------------------------
char* fn_FindNext(void)
{
    if (FindNext(srFile) != 0)
    {
        memset(str_FileName, 0, 5);
        return str_FileName;
    }
    Sleep(10);
    strncpy(str_FileName, AnsiUpperCase(SlashSep(strFolder, 
srFile.Name)).c_str(), 255 );
    return str_FileName;
}
//---------------------------------------------------------------------------
int fn_FindClose(void)
{
    fSearchInProcess = 0;
    FindClose(srFile);
    return 0;
}
//---------------------------------------------------------------------------

üÔÏ ÂÌÏÂ ËÌÁÄÅÍ × ÂÁÚÕ
//---------------------------------------------------------------------------
void fn_PutBlob(char* str, IB_BLOB in_B, IB_BLOB out_B)
{
    char    *buf, *ptr, *pStart, *pEnd;
 short   length, actual_length;

 if (!in_B->blob_handle)
  return;

    // ×ÙÄÅÌÉÔØ ÐÁÍÑÔØ ÐÏÄ BLOB
 length = in_B->blob_total_length + strlen(str) + 10L;
 buf = (char *) malloc (length);

    ptr = buf;
    while ((*in_B->blob_get_segment) (in_B->blob_handle, ptr, length, 
&actual_length))
    {
        ptr[actual_length] = 0;
        ptr += actual_length;
    }

    ptr[actual_length] = 0;

//    MessageBox(0, buf, ptr, MB_OK | MB_ICONINFORMATION);
    strcat(buf, str);
//    MessageBox(0, buf, str, MB_OK | MB_ICONINFORMATION);
 if (out_B->blob_handle)
    {
  (*out_B->blob_put_segment) (out_B->blob_handle, buf, strlen(buf));
    }

    return;
}
//---------------------------------------------------------------------------
üÔÏ ÞÉÔÁÅÍ, Õ ÎÁÓ × ÔÅËÓÔÏ×ÏÍ ÂÌÏÂÅ ÈÒÁÎÉÔÓÑ ÉÎÆÏÒÍÁÃÉÑ × ÓÔÒÕËÔÕÒÅ 
ÉÎÉ-ÆÁÊÌÁ
char* fn_GetAdvansedParam(IB_BLOB b, char* str)
{
    char    *buf, *ptr, *pStart, *pEnd;
 short   length, actual_length;

    memset(str_Param, 0, 256);

 if (!b->blob_handle)
  return str_Param;

    // ×ÙÄÅÌÉÔØ ÐÁÍÑÔØ ÐÏÄ BLOB
 length = b->blob_total_length + 1L;
 buf = (char *) malloc (length);

    ptr = buf;
    while ((*b->blob_get_segment) (b->blob_handle, ptr, length, 
&actual_length))
    {
        ptr[actual_length] = 0;
        ptr += actual_length;
    }

//    ptr = strstr( strupr(buf), strupr(str) );
    ptr = strstr(buf, str);
    if (ptr)
    {
        pEnd = strchr(ptr, '\x0D');
        if (pEnd) *pEnd = 0;

        pStart = strchr(ptr, '=');
        if (pStart)
            strcpy(str_Param, pStart+1);

    }

    return str_Param;
}
//---------------------------------------------------------------------------



Ответить