|
Hmm, try the follwing:
Go to the class wizard, choose the "class info" tab, set the "Message filter" to "Window".
Now you should be able to add a message handler for WM_NCPAINT.
One of my very favourite authors, Mr. Paul DiLascia, has written a wonderful article about this, I very recommend reading it. It explains everything:
http://www.microsoft.com/msj/0697/c0697.aspx.
Hope that helps,
Jens
|
|
|
|
|
I have some doubt as to how to retrieve the Headerfooter from MS-WORD document using VC++ application. I was not able to get the appropriate functions. So, can you please tell me the solution.
I tried using the GetHeader & GetFooter member functions.But these functions are available only in the MS-WORD8 version.They are not found in the MS-WORD 9 and 2000 version.
Also I tried implementing Getheader and Getfooter functions in the word9 version,but, it is gave the following error "GetHeader Function is not the memberclass of MS-WORD9".
Is there any function to put the header and footer in an already exisiting word document using VC++.
Anna Quadros
|
|
|
|
|
I think you need Mike Dunn's FAQ.
http://207.219.70.31/cpp/cppforumfaq.asp#win_summaryinfo[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hmmm. Maybe you misread the question He was wanting the actual header/footer inside the MSWord document, not the document summary information
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
, that's what comes of not reading the question
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I used this with Word 2000. It should get you close:
CString strFileName,
strText;
_Application app;
Documents docs;
_Document doc;
Sections secs;
Section sec;
HeadersFooters headers,
footers;
HeaderFooter header,
footer;
Range rng;
COleVariant vtOptional((long) DISP_E_PARAMNOTFOUND, VT_ERROR),
vtFalse((short) FALSE),
vtTrue((short) TRUE),
vtDoc((short) 0),
vtText((short) 2),
vtRtf((short) 6),
vtHtml((short) 8);
if (app.CreateDispatch("Word.Application") == TRUE)
{
strFileName = "MyFile.doc";
docs = app.GetDocuments();
doc = docs.Open(COleVariant(strFileName), vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional);
secs = doc.GetSections();
if (secs.GetCount() > 0)
{
for (long lSection = 1; lSection <= secs.GetCount(); lSection++)
{
TRACE("Section %ld\n", lSection);
sec = secs.Item(lSection);
headers = sec.GetHeaders();
if (headers.GetCount() > 0)
{
for (long lHeader = 1; lHeader <= headers.GetCount(); lHeader++)
{
header = headers.Item(lHeader);
rng = header.GetRange();
strText = rng.GetText();
TRACE(" Header %ld Text = ]%s[\n", lHeader, strText);
}
}
footers = sec.GetFooters();
if (footers.GetCount() > 0)
{
for (long lFooter = 1; lFooter <= footers.GetCount(); lFooter++)
{
footer = footers.Item(lFooter);
rng = footer.GetRange();
strText = rng.GetText();
TRACE(" Footer %ld Text = ]%s[\n", lFooter, strText);
}
}
}
}
docs.Close(vtFalse, vtOptional, vtOptional);
app.Quit(vtOptional, vtOptional, vtOptional);
}
|
|
|
|
|
Thanks a Lot!!
I tried the code with word 2000 version .I am getting the following error.
"GetCount is not member class of headersfooters,
GetCount is not member class of Sections"
I included Msword.h , Msword8.h and MSword9.h header files . Do I need to include any other header files.
I cannot proceed further without fixing this error
Also is there any method to put the retrieved header/footer from one document into the header/footer of another document.
Thanks and Regards,
Anna Quadros.
Anna Quadros
|
|
|
|
|
Hi,
I need to create about three to four modal dialog boxes such that when a button is pressed in the first one it leads to the next and again when a button is pressed in this it leads to the next one and so on..I am a novice in this field and I need some help in this. I tried this:
void CNewoneDlg::OnOK()
{
CDialog aboutDlg(IDD_DIALOG1);
INT_PTR pRet=-1;
aboutDlg.DoModal();
//CDialog::OnOK(); (I tried taking this off...but didnt work either)
}
This works..it leads to the next dialog box on pressing ok..
but..
void CDialog1Dlg::OnOK()
{
CDialog aboutDlg(IDD_DIALOG2);
INT_PTR pRet=-1;
aboutDlg.DoModal();
//CDialog::OnOK();
}
This doesnt lead to the next dialog box on pressing ok..I am confused, since I have used the method in the earlier function..when that can work, why cant (isnt) this?
I desperately need a help..
THANKS
Deepak Samuel
|
|
|
|
|
Instead of calling do the dialog from within the modal dialog, check the return code of the dialog when it exits to where you called it from. If it is IDOK, call the next modal dialog from tge same routine where you called the first one from
tcss
|
|
|
|
|
The best solution is to separate the dialog boxes.
Call DoModal for the first one (the program will 'wait' at this instruction til the dialog is closed), then call DoModal for the second one, and so on.
CDialog Dialog1(IDD_DIALOG1);<br />
CDialog Dialog2(IDD_DIALOG2);<br />
CDialog Dialog3(IDD_DIALOG3);<br />
...<br />
<br />
Dialog1.DoModal();<br />
Dialog2.DoModal();<br />
Dialog3.DoModal);<br />
...
|
|
|
|
|
Hi,
Thanks for the help..but I still face some problems.The first dialog box leads to the next one on pressing ok , but the next dialog box still doesnt respond to the buttons, but when I close the dialog box by clicking [x] then it goes to the next dialog box..please help me in it..
Deepak Samuel
|
|
|
|
|
Are you sure that you do not want to use a 'Wizard' style PropertySheet ?
What you describe sounds exactly like you want it.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Hi,
Thanks for your suggestion, can you help me with some example source codes..
Deepak Samuel
|
|
|
|
|
Well, at CP there is this article[^] for a beginning.
A few other articles are in the same section of cp. And try to find something in MSDN.
Good luck!
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Hi
How do I know if the control key was presed in a clistview view. I need to be able to recognise keypresses like <Cntr and Enter>
Hylton
|
|
|
|
|
u've to handle the pretranslatemessage function in the view class..... if u need help how to find a key got to MSDN.....
nice time
Adi Narayana
|
|
|
|
|
Hi
I posted the message after trying pretranslate message. The parameters did not reflect the state of the control key. An enter (VK_RETURN) and a Cntrl + return appeared exactly the same in the message. I may be misunderstanding something there. Please correct me and post sample code if you get different results. I did solve the problem by being refrered to the function
(::GetAsyncKeyState(VK_CONTROL) & 0x8000).
Thanks
tcss
|
|
|
|
|
hello ,
Is there any documentation available for paige32.dll ??Is there any source code for this dll ???
Cause is my effort;
Effect is God's effort
|
|
|
|
|
Hi,
I have a listctrl on my PropertyPage and I fill the Control with data from my database. Now I want to display the entries with a line break.
Furthermore I want to have fix columns.
Can anybody help me?
Thank you
Julia
|
|
|
|
|
I have to use a control in doc/view mode, and I want to use the Create function to create a control's instanse, not in the dialog window mode, so I use the "add to projects\components and controls" menu add the control to the project, how can I use the Create function to create the control?
|
|
|
|
|
hello
im not sure if im clear on what your asking but have your tried use
if(!m_yourcontrol.Create())
{
}
under the doc or view mode depending on wich you need.
Jason Bird
|
|
|
|
|
I have to add a activex control into the project use doc/view, and the control must hide, so I want to use it as object or class, so I have to dymanic create it, the class wizard generate a class named like CSampleControl, and the interface of the control was generated as class' member function. I use the "new" operator create a control' instanse, when I use create function to create the control, the env throw exception and dump, so how can I do?
eg.
CSampleControl* control;
control = new CSampleControl();
control->Create( "", "", WS_CHILD, this, 1000 );
|
|
|
|
|
Hi
Parameters for Create function of you control depend on by
kind of you control.
But generally first parameters its
LPCTSTR lpszWindowName is name window of you control for instance for CommandButton its same Caption
DWORD dwStyle this style of you control for more see CreateControl() function in MSDN
const RECT& rect is rect in what you control appeared
CWnd* pParentWnd is parent window (window what will belong you created control)
UINT nID is handle of you control simple defined its as any
number in "resource.h" file of you object [this number must be vary from already used for resource handling]
Sorry for bad eanglish.
|
|
|
|
|
I have to add a activex control into the project use doc/view, and the control must hide, so I want to use it as object or class, so I have to dymanic create it, the class wizard generate a class named like CSampleControl, and the interface of the control was generated as class' member function. I use the "new" operator create a control' instanse, when I use create function to create the control, the env throw exception and dump, so how can I do?
eg.
CSampleControl* control;
control = new CSampleControl();
control->Create( "", "", WS_CHILD, this, 1000 );
|
|
|
|
|
Do you create this control on class method???
If yes where placed define you control and use new operator
If for instance you declared you control in some method of you class and after used new operator and create function then after exit from this method you recieve exactly you trouble.
I.e
bool YouClass::SomeMethod(){
CSampleControl* control;
control = new CSampleControl();
control->Create( "", "", WS_CHILD, this, 1000 );
return true;//exit from method and recived exception
}
Also you may not call AfxEnableControlContainer(); on InitInstaced method of you application
|
|
|
|