S
Srini
Hi All,
I am developing a component as a dll.In that i have to create a .rtf file.I
have created the .rtf file successfully
by using RTF Specifications.
void CTestRTFDlg::writeRTF(char *fname, int size)
{
CString str;
GetDlgItemText(IDC_RICHTEXTCTRL1,str);
FILE *f;
f=fopen(fname,"w+");
fprintf(f,"{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fswiss\\");
fprintf(f,"fprq2\\fcharset0 Arial;}");
fprintf(f,"{\\f1\\fnil\\fcharset0 Courier New;}}\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",52);
fprintf(f,"Multimedia Payphone Terminal\\fs052\\li520\\qc\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",40);
fprintf(f,"____________________________________\\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f,"Sender's Name : \\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f,"Recipient Name : \\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f,"Fax # :
\\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f,"Subject :
\\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f,"Date & Time : \\chdate
\\chtime\\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",40);
fprintf(f,"____________________________________\\fs052\\li520\\par\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f," "+str+"\\fs052\\li520\\par\n");
fprintf(f,"\\f1\\fs024\\par\n}");
fclose(f);
}
while creating the file it shows a dialog for a while and immediately
disappearing. if the above code
is written in a dialog based application(EXE), it works fine.
If I create .txt file, it works fine.
ofstream f1("FaxDocument.txt");
f1.write(FaxContent, lstrlen(FaxContent));
f1.close();
Can anyone plz suggest me why it is happening and how can I get rid of this
dialog in my component?
I am very badly in need of it.
Any help appreciated.
Thanks & Regards
Srinivas
I am developing a component as a dll.In that i have to create a .rtf file.I
have created the .rtf file successfully
by using RTF Specifications.
void CTestRTFDlg::writeRTF(char *fname, int size)
{
CString str;
GetDlgItemText(IDC_RICHTEXTCTRL1,str);
FILE *f;
f=fopen(fname,"w+");
fprintf(f,"{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fswiss\\");
fprintf(f,"fprq2\\fcharset0 Arial;}");
fprintf(f,"{\\f1\\fnil\\fcharset0 Courier New;}}\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",52);
fprintf(f,"Multimedia Payphone Terminal\\fs052\\li520\\qc\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",40);
fprintf(f,"____________________________________\\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f,"Sender's Name : \\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f,"Recipient Name : \\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f,"Fax # :
\\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f,"Subject :
\\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f,"Date & Time : \\chdate
\\chtime\\fs052\\li520\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",40);
fprintf(f,"____________________________________\\fs052\\li520\\par\\par\n");
fprintf(f,"\\viewkind4\\uc1\\pard\\lang2058\\f0\\fs%d\n",30);
fprintf(f," "+str+"\\fs052\\li520\\par\n");
fprintf(f,"\\f1\\fs024\\par\n}");
fclose(f);
}
while creating the file it shows a dialog for a while and immediately
disappearing. if the above code
is written in a dialog based application(EXE), it works fine.
If I create .txt file, it works fine.
ofstream f1("FaxDocument.txt");
f1.write(FaxContent, lstrlen(FaxContent));
f1.close();
Can anyone plz suggest me why it is happening and how can I get rid of this
dialog in my component?
I am very badly in need of it.
Any help appreciated.
Thanks & Regards
Srinivas