|
hi guys
i have create three Interfaces in a class which is create by ATL Object Wizard
this Interfases defines as under:
IA,IB,IC
IA derived from IDispatch
IB derived from IA
IC derived from IA
could you tell me how to write the 'BEGIN_COM_MAP' etc for my case?
thinks a lot
I love programming, but my english is too bad (
|
|
|
|
|
Currently, I have a COM event which I've created a sink for and all of that jazz. It receives events at the Invoke method of course. Then i use dispIdMember to figure out which event was called. The only problem is that the event is fired from a different thread as the rest of my program, which poses a huge problem. Is there a way that I can call a function on threadA from threadB?
|
|
|
|
|
one way to do this is to create a hidden window on threadA and then post a message on threadB to the threadA hidden window.
If you need to wait for the process to finish before threadB continues then use sendmessage not postmessage.
Best of luck
Forever Developing
|
|
|
|
|
hi!
i want to persist binary data read from a file into my ActiveX object. i have tried to do that using VARIANT containing SAFEARRAY of BYTES but couldn't do that. furthermore i tried to do same by using directly SAFEARRAYs of bytes, but unfortunately i couldn't. It seems that its not possible to store VARIANT containing SAFEARRAY of bytes as well as direct SAFEARRAYS of bytes. Am i right?
if its possible then please tell me how to do that. Is there any other way to do that?
Thanks in advance.
Ahmad Jalil Qarshi
|
|
|
|
|
There is already an Automation-compatible type for holding a block of bytes - BSTR . Use SysAllocStringByteLen() to allocate the BSTR . (Normally BSTR s are used to hold C-style strings, but that's not mandatory.)
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Thanks Mike!
You solved my problem. you are really great. I was working on it since last 2 weeks. nobody guided me towards using BSTR. but now when i see so simple solution with the help of you great person i am so happy.
Thanks a lot.
Ahmad Jalil Qarshi
|
|
|
|
|
How to fix (custom ActiveX)control size in design time.
I am using MFC ActiveX ControlWizard.
Please help me.
Thanks
David Park
|
|
|
|
|
How to lock child window from resizing in MDI ?
I am using WTL + MDI/Dialog framework.
- CMDIFrameWindowImpl<MAINFRAME>
--- CMDIChildWindowImpl<MY_FRAME>
----- CDialogImpl<MY_FRAME_VIEW>
i tried to set-up window styles (below) on creating... but child window then freezing :/ and i can do nothing with it (move/minimize)
Style to setup for not-resizing window:
~WS_THICKFRAME;
~WS_MAXIMIZEBOX;
i have example, but it built on Document/View technology...
http://www.thecodeproject.com/dialog/resizeformtofit.asp
----------------------------
never stop coding.
|
|
|
|
|
use the WM_NCCALCSIZE msg to set the dimensions of the dialog to the same min/max size, use it in the frame
regards
|
|
|
|
|
hi
i'm want to use new GNU comipler
the problem is with hash_map interator
after reading some articles i added some extra macros but the didn't solve the problem
compiler seems to do not recognize type
template <typename Data>
or
template <class Data>
and in line
hash_map<int, Data>::interator ptr;
throws an error: expected `;' before "ptr"
here is whole code
<code>
#include <string>
#include <ext/hash_map>
#include <iostream>
#include <iterator>
#if defined(__GNUC__) && (__GNUC__==2) && (__GNUC_MINOR__>=95)
/*STL extensions were put in the std namespace ...*/
namespace gnuext = std ;
#elif defined(__GNUC__) && (__GNUC__>=3)
/* STL extensions have their own namespace */
namespace gnuext = __gnu_cxx ;
#else
#error "This code relies on non-standard STL extensions as defined by GNU libraries."
#endif
#if defined(__GNUC__) && (__GNUC__==2) && (__GNUC_MINOR__>=95)
/*STL extensions were put in the std namespace ...*/
#define __GNUEXT std
#elif defined(__GNUC__) && (__GNUC__>=3)
/* STL extensions have their own namespace */
#define __GNUEXT __gnu_cxx
#else
#error "This code relies on non-standard STL extensions as defined by GNU libraries."
#endif
template <typename Data>
class MyHash {
MyHash() {}
~MyHash() {}
__GNUEXT::hash_map<int,Data> myhash;
void add(Data d)
{
__GNUEXT::hash_map<int, Data>::iterator ptr;
}
};
<code/>
Pain is a weakness living the body
|
|
|
|
|
ravjak wrote:
__GNUEXT::hash_map::iterator ptr;
try:
typename __GNUEXT::hash_map<int, data="">::iterator ptr;
|
|
|
|
|
bingo
thans
Pain is a weakness living the body
|
|
|
|
|
|
Goodmorning!
As the subject line suggests I am having a hard time with the persistance of
my ATL ActiveX control's Font Stock Property and the selection being
remembered once its made. I thought I was doing it all wrong but then to
make sure I had the code right, I made a brand new project with a brande new
control that had the Font stock property as a feature from the very
beginning. I also told the wizard to add the background colour property for
testing sake.
So i compile it and then try to use it in another project....I insert it
into the dialog and then right click to get the properties. I can select the
background colour, and the setting remains. I click on the font property, the
font window comes up with the collection of fonts..i make the selection...hit
OK/apply but the font field in the properties shows up as empty...it does not
actually remember the font I chose.
Like I said, I thought i might be doing something wrong and therefore tried
it out on a brand new control where the font property was added by Visual
Studio's wizard. Is this a little "bug"? and if so...how does one
exterminate/wack it.
Thanks!
Aristotel
|
|
|
|
|
Click me.[^]
We learned how to make Stock Font Propeties work here.
From get_hFont to Load and Save m_pFont.
|
|
|
|
|
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
|
|
|
|