#include <System.hpp>
#include <Classes.hpp>
#include <fstream.h>
#include <Vcl.h>
class info_Printer
{
private:
ofstream save_File;
TStrings* date_Printer;
UnicodeString file_Name;
DEVMODE struct_Info;
wchar_t *printer_Name;
wchar_t *form_Name;
unsigned short p_Size;
short paper_Width;
short paper_Length;
unsigned short driver_Version;
public:
info_Printer(UnicodeString name)
{
int temp;
file_Name=name;
date_Printer=new TStringList();
struct_Info=*((DEVMODE*)temp);
wcscpy(printer_Name,struct_Info.dmDeviceName);
date_Printer->Add(printer_Name);
wcscpy(form_Name,struct_Info.dmFormName);
date_Printer->Add(form_Name);
p_Size=struct_Info.dmSize;
date_Printer->Add(IntToStr(p_Size));
paper_Width=struct_Info.dmPaperWidth;
date_Printer->Add(IntToStr(paper_Width));
paper_Length=struct_Info.dmPaperLength;
date_Printer->Add(IntToStr(paper_Length));
driver_Version=struct_Info.dmDriverVersion;
date_Printer->Add(IntToStr(driver_Version));
}
void Save()
{
int i,temp_Size;
temp_Size=date_Printer->Count;
save_File.open(file_Name.w_str());
for(i=0;i<temp_Size;i++)
save_File<<(*date_Printer)[i].w_str()<<"\n";
save_File.close();
}
};
void __fastcall TForm1::Button1Click(TObject *Sender)
{
UnicodeString test_File;
test_File=Edit1->Text;
info_Printer my_Device(test_File);
my_Device.Save();
}