|
Thanks very much.
I will use boost.
system
|
|
|
|
|
When this event is called a second time, the MS Word Document closes. Don't know why. Am I missing something obvious here? Also, I can't get the SaveAs dialog to pop-up.
I'm developing on XP SP2 (professional) / visual studio 2005 / word 2003
void __stdcall CP3AddIn::DocumentBeforeSave(IDispatchPtr ptr, VARIANT_BOOL* pvtSaveAsUI, VARIANT_BOOL* pvtCancel )
{
CString msg;
CComQIPtr<word::_document xmlns:word="#unknown"> spDoc(ptr);
ATLASSERT(spDoc);
if( savesAllowed > 0 )
{
*pvtSaveAsUI = VARIANT_TRUE;
*pvtCancel = VARIANT_FALSE;
savesAllowed--;
msg.Format( _T("You may save %s %d more %s."),
spDoc->Name.GetBSTR(),
savesAllowed,
( savesAllowed == 1 ) ? _T("time"): _T("times") );
MessageBox( 0, (LPCWSTR)msg, _T("EVENT: DocumentBeforeSave"), 0 );
}
else
{
*pvtCancel = VARIANT_TRUE;
*pvtSaveAsUI = VARIANT_FALSE;
MessageBox( 0, _T("You have either exceeded your save limit\n")
_T("or you are not authorized to save a copy of this document."),
_T("EVENT: DocumentBeforeSave"), MB_OK );
}
}
|
|
|
|
|
It's probably because an exception's being thrown. Helps to attach a debugger to the add-in. The easiest way is probably to tell VS that the debug executable for the add-in is MS Word. Set a breakpoint on the DocumentBeforeSave entrypoint.
One other thing - how do you know that the add-in is instantiated once for each Word document? Strikes me that Word could instantiate the add-in globally and then you have a global save count?
|
|
|
|
|
Sorry, been away for a little bit.
I tend to agree with you about an exception being thrown. However, while I'm a whiz with try/catch statements in "every day" COM, I'm a fish out of water trying to trap an error in automation.
Word dispatches (or whatever the term is) the even DocumentBeforeSave, however, where would the try/catch go, or do I use that at all?
I currently have a try at the very start of DocumentBeforeSave and at the very end, but nothing's getting caught. I'm trying to capture _com_error; perhaps I'm mistaken. Your thoughts?
|
|
|
|
|
Hi
how can I Resize ActiveX Control ?
|
|
|
|
|
Hi,
In my application I have two button, one is for creating share button and other is for modifying the permission.
Creating the share folder there is no problem. When I select the shared folder and click the the permission button windows open its permission security dialog.This is works fine in all OS.
Now the problem is: In vista OS machine I have installed my application it working as usual but when I install MS office 2007 Japanese and run my application, Application is running and able to create share folder but when you select the shared folder and click the permission button the application hangs.This behavior is not occuring if I install MS office 2007 English.
Japanese 2007 IME is causing the problem. This problem is not occuring when you install the MS office 2007 Japanese without "Office feature and Tools" option.
When I analysis code
AtlGetSecurityDescriptor(pszObjectName,SE_LMSHARE,... )
SecDesc= assigining the security pointer variable
CSedurityDesc si(SecDesc)
EditSecurity(hWnd, &si)
Instead of SE_LMSHARE if you give any other SE_OBJECT_TYPE it opens permission dialog (rights are in japanese usually that will be in english). In the permission dialog if press OK it is showing popup stating it will change modify the permission...
As this an shared folder we normally set SE_OBJECT_TYPE as SE_LMSHARE.
Bool flag = EditSecurity(hWnd, &si) - This is the place where application hangs i.e because of si. Please let me know how to overcome this problem in vista OS machine having MS office 2007 Japanese.
Thanks & Regards,
Gnanaprakash
|
|
|
|
|
Please, help me to find tutorial or a samples how to do it
|
|
|
|
|
I am also trying to achieve same what you are trying to.
If you find any answer or any link please share.
|
|
|
|
|
NOTIFY_HANDLER (IDC_LISTVIEW, LVN_BEGINLABELEDIT, OnGridBeginEdit)
LRESULT OnGridBeginEdit(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
RECT rcpos;
// size rcpos to the subitem rect...
HWND hwnd_edit = m_lv.GetEditControl();
CComboBox combo;
combo.Create(m_lv,&rc_pos,_T("drop_list"),CControlWinTraits::GetWndStyle(0) | CBS_DROPDOWNLIST);
combo.AddString(_T("a"));
combo.AddString(_T("b"));
combo.AddString(_T("c"));
string sText="a";
combo.SelectString(-1,stext.c_str());
combo.ShowWindow(SW_SHOW);
run a local messageloop that exits on VK_CANCEL | VK_RETURN | WM_MOUSEDOWN on other windows
// read out the combo
combo.DestroyWindow();
return -1; // prevent the standard edit control
}
|
|
|
|
|
Hi. I'm working in a software wich has a system menu, an icon tool bar, and recently, i've added another tool bar just down the other.
I've been using AddSimpleReBarBand(...) to create them, but i would like to control this last tool bar to make it appear and disappear when i want.
I've tried to destroy it, and it does, but i can't make disappear the space made to place the menu.
Could anyone tell me the way to do it? It seems not to be very difficult, but a can't find the way.
Thank you in advance.
Ricard
|
|
|
|
|
Hi again! I still don't have the solution (maybe it's not as easy as i thought) and i've been thinking for another possibility.
Well, the main toolbar occupies half of the width, so it would be possible to place the second toolbar just next to the first one. Then, it would be ok to manipulate it without affecting any vetical spacing. But, of course, i've found another problem. When i place the second toolbar it is placed very far from the first one, and it falls out the menu. I've tried to fix the length with the AddSimpleReBarBand(...) parameters, but it doesn't seem to work.
I've been checking the 4th and 5th parameter. 4th seems to be a width (maybe the toolsbar's width?) and 5th is a boolean that seems to avoid minimizing the toolbar. Well, none of the them seems to change my toolbar separation. Any idea?
Let me know your experiences with atl toolbars. Any opinion will be very useful for me. Thank you all!
Ricard
|
|
|
|
|
I'm coding an ATL IE plugin as the article from msdn(below is the link)
http://msdn.microsoft.com/en-us/library/bb735853(VS.85).aspx
I did step by step as it describes in the dll part, but there is no responding of the Exec method which should run when I click my tool menu 'Image Download'. I can debug into the STDMETHODIMP CImageFetcher::SetSite(IUnknown* pUnkSite) method.
I have no idea where I made a mistake, any one can help?
Thanks previously!
|
|
|
|
|
|
Dude what is your damage? Why have you asked this question in this forum?
What do you do just pick a random forum?
That is an Operating Systems / SysAdmin[^] question.
Come on man at least make an effort. I mean you are asking people here to help you for free and you can't even make the effort to put your question in the correct forum, how lame is that?
led mike
|
|
|
|
|
Hi
I Create a ATL Dialog box and I host a Webpage on Dialog using CAxWindow and webpage having 1 close button, I want when user click that close button (Which call window.close()), My Dialog is Close without any Internet Explorer Alert Notification. What can I do in my Workspace to Remove this Notification.
Thanks in Advance.
|
|
|
|
|
I want to something like serialization using string , but don't know whether the string class in STL supports this any way.
Thanks.
system
|
|
|
|
|
Are you saying you want to save a string to a file? If so, then this code illustrates how to write a string to a file and the different mechanisms available when reading strings from a file.
None of them are totally satisfactory, as it's difficult to determine where the original string's end was after it's been written to a file. To be more reliable, I'd probably write the string length out first, as that will tell you how many characters to read in. Other approaches (e.g. quoting the string) would work, but would require you to process the string, escaping quote characters.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
int main(int, char**)
{
{
std::ofstream a("a.a");
std::string s = " Hello World";
a << s << std::endl;
}
{
std::ifstream a("a.a");
std::string s;
a >> s;
std::cout << s << std::endl;
}
{
std::ifstream a("a.a");
std::string s;
a >> s;
std::cout << s << std::endl;
}
{
std::ifstream a("a.a");
std::string s;
getline(a, s);
std::cout << s << std::endl;
}
}
|
|
|
|
|
Well, the 2nd and 3rd parts are the same.
Do you know to do std::string serialization?
system
|
|
|
|
|
Whoops - the line a >> s; in the third part should have been a >> std::noskipws >> s;
followait wrote: Do you know to do std::string serialization?
What do you mean by serialization? If you want a generic serialization framework, then look at Boost.Serialization[^]. Otherwise....well, you need to define what you mean by serialization.
|
|
|
|
|
Stuart Dootson wrote: What do you mean by serialization?
save/load the object
It seems that I should learn Boost first.
system
|
|
|
|
|
followait wrote: save/load the object
Yeah, there's no standard way of doing that, really. Either you use some framework such as the one in MFC, or the one in Boost, or you have to work out how you're going to it yourself.
If only it were as easy as in (say) .NET or Python, where serialization is a standard concept.
|
|
|
|
|
Hi everyone:
I have this Single Document Interface MFC project that has quite a lot of code in it (mostly View/Doc interaction and lots of CString usage). Now I came to a realization that I have to convert it into Multiple Document Interface project. By doing so I will need a tab control for the documents, docking bars for side controls, splitter windows, etc. My original thought was to develop all the GUI myself, but then I came across the WTL 8.0. I played around with some of their samples and it sounds very promising.
My question is, or maybe I should better say, what would you suggest - shall I try to switch this SDI MFC project into an MDI WTL 8.0 (I believe it now supports MDI as well), or shall I tough it out and stick with good-ol' MFC (and poor GUI)?
Thanks in advance!
|
|
|
|
|
I haven't tried with VC 8 or later, but in 6 you can certainly use MFC and WTL in the same app. You'll need to tweak the WTL headers a bit and change a couple references to "CDC" to "CDCT<1>" but I think that's the only error you'll hit. I haven't actually tried MFC and WTL together in a while, those problems might have been fixed in a newer VC or WTL.
|
|
|
|
|
Hi
I Create a ATL Modelless Dialog Box and Host Webpage on Dialog Box using CAxWindow , I want that tab and Accelerators work on Webpage , But delete Key , Tab Key , Enter Key ...
Keys are not working properly , I use code from CodeProject Site.
http://www.codeproject.com/KB/atl/cdialogmessagehook.aspx
But this code is not working for me , in InstallHook I gave my DialogBox Handle .
Thanks in Advance.
|
|
|
|
|
I'm using ATL and c++ to develop an Add-in for Microsoft Word. The problem
that I'm having is that the parameters for the events that I'm trying to
capture aren't being filled with data. They're essentially null. The
problem is only happening with events that pass back more than one parameter.
The events that I am trapping are DocumentOpen, NewDocument,
DocumentBeforePrint, and DocumentBeforeSave
DocumentOpen, and NewDocument event trapping work fine.
The dispinterface is ApplicationEvents2; I've also tried using
ApplicationEvents3, and ApplicationEvents4 with the same results.
/***********************************************
* IDL for DocumentOpen, NewDocument and DocumentBeforePrint
* and DocumentBeforeSave
************************************************/
[id(0x00000004), helpcontext(0x00061a84)]
void DocumentOpen([in] Document* Doc);
[id(0x00000009), helpcontext(0x00061a88)]
void NewDocument([in] Document* Doc);
[id(0x00000007), helpcontext(0x00061a86)]
void DocumentBeforePrint(
[in] Document* Doc,
[in] VARIANT_BOOL* Cancel);
[id(0x00000008), helpcontext(0x00061a87)]
void DocumentBeforeSave(
[in] Document* Doc,
[in] VARIANT_BOOL* SaveAsUI,
[in] VARIANT_BOOL* Cancel);
/**********************************************
* Here is the SINK_MAP
***********************************************/
BEGIN_SINK_MAP(MyAddin)
SINK_ENTRY_INFO(1,__uuidof
(Word::ApplicationEvents2),4,DocumentOpen,&DocumentOpenInfo)
SINK_ENTRY_INFO(1,__uuidof(Word::ApplicationEvents2),9,NewDocument,&NewDocumentInfo)
SINK_ENTRY_INFO(1,__uuidof(Word::ApplicationEvents2),7,DocumentBeforePrint,&DocumentBeforePrintInfo)
SINK_ENTRY_INFO(1,__uuidof(Word::ApplicationEvents2),8,DocumentBeforeSave,&DocumentBeforeSaveInfo)
END_SINK_MAP()
/******************************************************
* Here are the ATL_FUNC_INFO structures I've declared
*******************************************************/
_ATL_FUNC_INFO NewDocumentInfo = {CC_STDCALL,VT_EMPTY,1,
{VT_DISPATCH|VT_BYREF}};
_ATL_FUNC_INFO DocumentBeforePrintInfo = {CC_STDCALL,VT_EMPTY,2,
{VT_DISPATCH|VT_BYREF, VT_BOOL|VT_BYREF}};
_ATL_FUNC_INFO DocumentOpenInfo = {CC_STDCALL,VT_EMPTY,1,
VT_DISPATCH|VT_BYREF}};
_ATL_FUNC_INFO DocumentBeforeSaveInfo = {CC_STDCALL,VT_EMPTY,3,
{VT_DISPATCH|VT_BYREF, VT_BOOL|VT_BYREF, VT_BOOL|VT_BYREF}};
void __stdcall MyAddin::DocumentOpen(IDispatchPtr ptr)
{
//Process DocumentOpen Event
}
void __stdcall MyAddin::NewDocument(IDispatchPtr ptr)
{
//Process NewDocument Event
}
void __stdcall MyAddin::DocumentBeforePrint(IDispatchPtr ptr, VARIANT_BOOL*
pvtCancel )
{
//The __vfPtr in ptr comes back as 0x00000000. I don't know why
}
void __stdcall MyAddin::DocumentBeforeSave(IDispatchPtr ptr, VARIANT_BOOL*
pSaveAsUI, VARIANT_BOOL* pCancel )
{
//The __vfPtr in ptr comes back as 0x00000000. I don't know why
}
|
|
|
|
|