|
hi!
I want to capture the right mouse button event on MS Word document.
is it possible? if so then please help me.
Thanks
Ahmad Jalil Qarshi
|
|
|
|
|
hi!
I have Added a new CommandBarControl of type msoControlButton in the Menu "Inline Picture" (which is displayed when you right click on some picture or some OleObject in MS Word Document). I have also run some VBA macros on click event at this new inserted menu Item by specifying them into PutOnAction function. But now i want to call some functions of my ActiveX control's class when the user right click on my control and then select the newly inserted menu item. Is it possible if so then please help me.
Thanks
Ahmad Jalil Qarshi
|
|
|
|
|
// call member function printWithPrefix() for each element
// - "person: " is passed as an argument to the member function
for_each (coll.begin(), coll.end(),
bind2nd((mem_fun_ref(&Person::printWithPrefix)),
"person: "));
this code from a book, dont compile on vc++.
I am disapointed.
Please. What to do ?
Vincent
|
|
|
|
|
I'm guessing that you're using Visual C++ 6.0. This version doesn't support a lot of the Standard C++ Library.
I recommend that you either use a later version of Visual Studio or download the Visual C++ Toolkit 2003[^], which includes the compiler tools from VS.NET 2003.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I had the same and searched the error without success.
Recently I got VC7.1, I tried it again and it compiled perfectly!
So change your compiler or dont't use mem_fun_ref.
Christof
|
|
|
|
|
Hello...
I have been trying to add a font stock property to my ATL ActiveX control in VS.NET. I go by the examples and documentation at MSDN but its not quite possible. They suggest to right click on the interface of my class under the class view, and select ADD->Properties....
Then apparrently there will be a drop down menu where I will be able to choose the type of stock property, in this case FONT. But no..there is no such drop down menu...only a text fields.. I tried to manually type in Font, but nothing... I tried to manually copy and paste the code shown in the example in the corresponding sections of the project but it won't even compile. How on earth does one add a FOnt stock property to an ATL ActiveX control in VS.NET?
Thanks!
|
|
|
|
|
So it turnes out the only way to achive the above is to manualy create a new project where you state the stock properties from the vary begining, and then copy the code segments over to your existing project code.... tsk tsk tsk
And now the latest problem for the past 2 hours has been that I have added the font stock property and a member variable
CComPtr<ifontdisp> m_pFont; which gets set at OnFontChanged().
Now in my OnDraw() function I would like to select this font and use it,
however I cannot simply do pdc.SelectObject(m_pFont) as m_pFont is not a
CFont. In the MFC only version of ActiveX I could call SelectStockFont(pDC);
but this is no longer suitable in ATL ActiveX.
I cannot figure out how to convert a font refered to by IFontDisp to a CFont
so that I can select it for the drawing code. Could somebody point me in the
right direction please?
Thanks
|
|
|
|
|
greekgoddj wrote:
Could somebody point me in the
right direction please?
QueryInterface() for IFont , which has neat method called get_hFont() . If the object doesn't implement IFont , then you will have to create the font manually, using the properties exposed by IFontDisp (it sucks, I know!)
--
My name in Katakana is ヨルゲン.
My name in German is Jörgen.
My name in Mandarin/Kanji is 乔尔根 西格瓦德森.
My name in Korean is 요르겐.
I blog too now[^]
|
|
|
|
|
Got it! thanks
|
|
|
|
|
hi!
i have made a control for MS Word. Now when i insert the Control into the Word. InitNew methods is called, and when i save the document Save method of IPersistXXX is called but when i open my document the Load method of IPersistXXX is not called.
Furthermore, on reopening the document when i double click my control it displays the following message.
"This object was created in Properties.
This application is not availabe to open this object.
Make sure the application is properly installed and that it has not been deleted, moved, or renamed."
Please help me.
Thanks in advance.
Ahamd Jalil qarshi
|
|
|
|
|
Sir,
I have created an ATL composite control, and am putting it on multiple instances of a modeless dialog box. For each instance of the control I am calling its draw function with different parameters but the multiple instances all display with the same parameters. What is happening and how do I get around this problem.
Esteemed members please help.
Thanks
Deekonda Ramesh
|
|
|
|
|
I want to use ActiveX developed using vc++ in a windows service. Please help me.
|
|
|
|
|
|
hi!
I want to insert an object into MS Word using function AddOleObject. i did it using visual basic 6 using the following function.
InlineShape.AddOleObject(insRange,"{7A4960FC-645E-4971-B2C4-E4C3DB896D10}","",False,False);
where insRange is of Range type. it worked fine. but the problem is that i want to do it in Visual C++6. Now the function prototype in VC++6 is hereunder
MSWord::InlineShapes::AddOLEObject ( VARIANT * ClassType, VARIANT * FileName, VARIANT * LinkToFile, VARIANT * DisplayAsIcon, VARIANT * IconFileName, VARIANT * IconIndex, VARIANT * IconLabel, VARIANT * Range )
i am a bit confused about how to use this function in VC. I tried it using following code.
VARIANT varClassType; VariantInit(&varClassType);
VARIANT varLinkToFile; VariantInit(&varLinkToFile);
VARIANT varDisplayAsIcon; VariantInit(&varDisplayAsIcon);
VARIANT varEmpty; VariantInit(&varEmpty);
VARIANT range; VariantInit(&range);
varClassType.vt = VT_BSTR;
varLinkToFile.vt = VT_BOOL;
varDisplayAsIcon.vt = VT_BOOL;
range.vt = VT_I4;
_bstr_t clsID = "{7A4960FC-645E-4971-B2C4-E4C3DB896D10}";
varClassType.bstrVal = clsID.copy();
varLinkToFile.boolVal = FALSE;
varDisplayAsIcon.boolVal = FALSE;
varEmpty.vt = VT_EMPTY;
range.lVal = 0;
MSWord::InlineShapePtr SigObj = m_pWordApp->ActiveDocument->InlineShapes->AddOLEObject(&varClassType, &varEmpty, &varLinkToFile,&varDisplayAsIcon,&varEmpty, &varEmpty,&varEmpty,&range);
but unfortunately when last line of above code executes my program crashes. i think that the problem is with my first and last parameter in the AddOleObject function. I dont know how to resolve it.
Please help me.
Thanks
|
|
|
|
|
Try using CComVariant instead of VARIANT...
Ex
CComVariant varClassType(clsID);
|
|
|
|
|
Thanks dear you solved my problem. but i m really surprised that what's wrong with VARIANT. according to MSDN CComVariant is a wrapper over VARIANT. then?
But i have solved my problem with your help.
May God Bless You.
Thanks again.
Ahmad jalil Qarshi
|
|
|
|
|
Hi Friends,
Though this is not exactly a ATL/WTL/STL question it is a more general C++ templates question.
My objective is that I want to get a integer value based on a string constant i.e I want to write something similar to
int val = String2Int<"str1">();
int val1 = String2Int<"str2">();
so that depending on the string value as a tempalte arguement I get different integers values.
Is it possible to write some sort of template specialization here?
I do not want to use STL map for string to integer mapping nor do I want to perform some string comparison here.
Please let me know your thoughts.
Thanks in Advance.
|
|
|
|
|
|
You can specialize on non-type parameters:
template<int N>
struct is_66
{
enum{res=false};
};
template<>
struct is_66<66>
{
enum{res=true};
}; The reasons why he still cannot do what he wants are of a different nature.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Joaquín M López Muñoz wrote:
You can specialize on non-type parameters:
Cool, I try to stay away from template black-magic as much as I can.
I remember that the tricky part is using string literals as template parameters (the C++ FAQ lite has a couple sections on that subject).
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I'm afraid you cannot use strings as the template parameters of your class in a simple manner: this is nicely explained here[^], for instance, and it also proposes some less-than-perfect workarounds.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
One has to wonder why you'd do this. If I had to pass in a string, I'd use a map here. Why don't you want to do that ? I can't think of any alternative that is not ugly.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
One has to wonder why you'd do this.
Raw speed. The compiler would do the mapping for you, yielding a constant time complexity at runtime.
Of course, you'd only be able to make static mappings, such mappings that the compiler can resolve.
--
My name in Katakana is ヨルゲン.
My name in German is Jörgen.
My name in Mandarin/Kanji is 乔尔根 西格瓦德森.
My name in Korean is 요르겐.
I blog too now[^]
|
|
|
|
|
So, then, how is it better than declaring a const int or even a define ? All you're asking is for the compiler to substitute a name known at compile time with a number known at compile time, right ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
how is it better than declaring a const int or even a define
Flexibility and type safety. Think of macros on steroids.
--
My name in Katakana is ヨルゲン.
My name in German is Jörgen.
My name in Mandarin/Kanji is 乔尔根 西格瓦德森.
My name in Korean is 요르겐.
I blog too now[^]
|
|
|
|