|
hai to all...
Can any body plzz help me for this process?
i want to read the contents of a doc file(ms word file) and write the contents
into another doc file(ms word file)...
How shall i do this?
i tried the following method, but itz working only reading and writing text files..
#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
using namespace std;
void main () {
string line;
ifstream myfile ("C:/1.doc");
if (myfile.is_open())
{
while (! myfile.eof() )
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file";
ofstream myfile1;
myfile1.open ("C:/2.doc");
myfile1 << line;
myfile1.close();
getch();
}
Can anybocy plzz help me how to read and write for doc files...
senthil.
|
|
|
|
|
Maybe writing a MACRO for MSWord (or OpenOffice!) is easier than deciphering the proprietary DOC-Format?
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
senthil wrote: Can anybocy plzz help me how to read and write for doc files...
You can't read the content of the ms document as it is binary file.
You can read from one doc and write to another doc by using binary files(i.e. open files in binary mode).
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hai laxman,
thanks for ur reply...
now itz working perfectly in binary mode....
thanks for ur valuble suggestion...
now i'm trying to convert a html file into a pdf file or an image file using
VC++... R u having any idea about this...
thanks...
senthil.
|
|
|
|
|
senthil wrote: now i'm trying to convert a html file into a pdf file or an image file using VC++... R u having any idea about this...
No, I don't have any idea, but you may refer following article. it may help you.
http://www.codeproject.com/csharp/sertf2pdf.asp[ ^]
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
does anyone of you know what message will be posted when a system is logged in?
if so, can you please be so kind and respond me.
thanks in advance!
thanks to one and all who respond to the questions posted here!
Shalini nair
|
|
|
|
|
As far as I know, the system doesn't send any notification upon login. But, upon logoff, it sends.
Could u tell me, why this concept is needed?
Come online at:-
jubinc@skype
|
|
|
|
|
What exactly you want to do?
|
|
|
|
|
|
I want to check that the "1234.EXE" is running or not. (This program have no windows),if so I will go to some job...
What's function use for this issue?
|
|
|
|
|
Use CreateToolhelp32Snapshot . Refer example[^] from MSDN .
|
|
|
|
|
|
I'm having a problem sending a message from one window to another in my (Win32) application. A little background:
1) It's a dialog based app
2) It consists of a tab control and several child window dialogs
I want to send the text of an edit control from one tab/child window to another tab/child window's list box using:
SendMessage(hwnd, LB_ADDSTRING, 0, (LPARAM) szString);
However I can not get them to communicate.
I can't figure this out (never attempted it before). I have a single function handling all messages of each child window of the tab control. Everything works great as long as I'm updating the window/tab in view.
Can anyone point me in the right direction? Thanks in advance.
|
|
|
|
|
You cannot do that with a string. The string is in the memory of your process, all that you are sending is the address, which the second process will not be able to read. To send a string send the WM_COPYDATA message instead. But this will not allow you to add it to a listbox like you are trying.
|
|
|
|
|
He doesn't mention two windows from two processes here.
|
|
|
|
|
Make sure your message handler is prototyped as follows:
in the header file:
afx_msg LRESULT OnHandleMyMessage(WPARAM wParam, LPARAM lParam);
and in the cpp file:
BEGIN_MESSAGE_MAP(CMyClass, CDialog)
ON_MESSAGE(LB_ADDSTRING, OnHandleMyMessage)
END_MESSAGE_MAP()
LRESULT CMyClass::OnHandleMyMessage(WPARAM wParam, LPARAM lParam)
{
return 1L;
}
Also, you should call PostMessage unless you need to wait for the message handler to return.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks for the reply. I'm quite new at coding and can't quite decipher what you provided, but are you suggesting I subclass the control?
|
|
|
|
|
He means, make sure you have correctly configured the message handler. But this is only valid if you are using MFC.
|
|
|
|
|
I see. I'm using Win32. Is there a workaround for this?
|
|
|
|
|
Not familiar with Win32, If you can, add something like the following:
BOOL MyDialog::PreTranslateMessage(MSG* pMsg)
{
// catch any WM_USER messages
if (pMsg->message == WM_USER)
{
// see if it's your message
if (pMsg->wParam == LB_ADDSTRING)
{
... process the message ....
.....
|
|
|
|
|
georgiek50 wrote: SendMessage(hwnd, LB_ADDSTRING, 0, (LPARAM) szString);
What value does this function returns ?
I assume hwnd is handle to target list box.
|
|
|
|
|
CMyListCtrl derives from CListCtrl. In CMyListCtrl, I must decide how to subclass CHeaderCtrl:
<br />
void CMyListCtrl::PreSubclassWindow()<br />
{<br />
CListCtrl::PreSubclassWindow();<br />
CHeaderCtrl* pHeaderCtrl = CListCtrl::GetHeaderCtrl();<br />
if (pHeaderCtrl && pHeaderCtrl->GetSafeHwnd())<br />
m_HeaderCtrl.SubclassWindow(pHeaderCtrl->GetSafeHwnd());<br />
}<br />
Everything seems good, but when CMyListCtrl is dynamic created, or created without visible syle, the pHeaderCtrl returned from CListCtrl::GetHeaderCtrl() is null,so subclass CHeaderCtrl failed!
now, I solved the problem, but I don't satisfied.
<br />
void CMyListCtrl::OnShowWindow(BOOL bShow, UINT nStatus) <br />
{<br />
CListCtrl::OnShowWindow(bShow, nStatus);<br />
<br />
if (bShow && !m_HeaderCtrl.GetSafeHwnd())<br />
{<br />
CHeaderCtrl* pHeaderCtrl = CListCtrl::GetHeaderCtrl();<br />
if (pHeaderCtrl && pHeaderCtrl->GetSafeHwnd())<br />
m_HeaderCtrl.SubclassWindow(pHeaderCtrl->GetSafeHwnd());<br />
}<br />
}<br />
Is there any other better resolvents?
thanks
best regards
|
|
|
|
|
How about in the OnCreate for the CListCtrl.
That way, you get to subclass even if the list control window is never shown, if that matters or not.
From MSDN:
The CWnd object receives this call after the window is created but before it becomes visible. OnCreate is called before the Create or CreateEx member function returns.
Override this member function to perform any needed initialization of a derived class.
The CREATESTRUCT structure contains copies of the parameters used to create the window.
|
|
|
|
|
thanks for your idears.
but when CMyListCtrl is based on a dialog with template, OnCreate function is not called at all!
|
|
|
|
|
In that case use:
OnInitDialog is called just before the dialog box is displayed. You must call the default OnInitDialog handler from your override — usually as the first action in the handler. By default, OnInitDialog returns TRUE to indicate that the focus should be set to the first control in the dialog box.
instead.
|
|
|
|