|
I have written an ActiveX control, which can display static and dynamic image. So I can use it in an IM app like MSN to show some interesting expression. To test the control, I have written a subclass of richedit control, I can insert my control into the richedit now, and I have implemented some methods of IRichEditOleCallback so that can copy and paste the controls inserted in the richedit, it can save/load the controls and text in the richedit into/from a RTF file, too. But the test result made me sad, I can copy and paste a standard OLE object like a POWERPOINT file in the richedit, if I copy the control written by me, it failed, it seems my control had been copied and pasted successfully, because the richedit control remained a blank rectangle for my control in the position where it should be pasted to, but only a blank rect, no image was display.
From the test result, my conclusion is, my richedit is a good one, what should I modify is my ActiveX control, but I don't know what to do exactly to achieve my goal. I hope someone can help me, anyone who has the experience can contact me with MSN, my MSN ID is:gxulg@hotmail.com Thanks.
learn to be still.
|
|
|
|
|
How can i write a program can get text on screen at position of mouse cursor.
le van giang
|
|
|
|
|
I am writing a program which does not let the user copy a specific folder in windows explorer. The way to do this is to implement ICopyHook interface.
The dll has been registered at:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shellex\CopyHookHandlers\MyHook
I have tried code like this:
class ATL_NO_VTABLE CMyHook :
public ICopyHook
{
BEGIN_COM_MAP(CMyHook)
COM_INTERFACE_ENTRY_IID(IID_IShellCopyHook , CMyHook)
END_COM_MAP()
STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCSTR pszSrcFile, DWORD dwSrcAttribs, LPCSTR pszDestFile, DWORD dwDestAttribs);
};
This function never gets called. Instead when I try to copy a folder, I get the following message:
Cannot copy (foldername): Invalid MS-DOS function.
What to do?
Please F1 !
|
|
|
|
|
I understood my own code finally.
Create a ATLCom Appwizard.
Insert a simple atl object.
Then add one line: public ICopyHook to the parent list.
Comment the other as shown.
To the COM_MAP, add one line, comment the others:
COM_INTERFACE_ENTRY_IID(IID_IShellCopyHook, CMyHook)
class ATL_NO_VTABLE CMyHook :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CMyHook, &CLSID_MyHook>,
public ICopyHook
// public IDispatchImpl<IMyHook, &IID_IMyHook, &LIBID_MYHOOKLib>
{
public:
CMyHook()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_MYHOOK)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CMyHook)
// COM_INTERFACE_ENTRY(IMyHook)
// COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY_IID(IID_IShellCopyHook, CMyHook)
END_COM_MAP()
STDMETHOD_(UINT,CopyCallback) (THIS_ HWND hwnd, UINT wFunc, UINT wFlags, LPCSTR pszSrcFile, DWORD dwSrcAttribs,
LPCSTR pszDestFile, DWORD dwDestAttribs);
// IMyHook
public:
};
The above code works and in the function CopyCallback, you can handle the folder copy event. Of course the registry key also has to be set.
Thanks for reading. Hope it works for all.
|
|
|
|
|
khan++ wrote:
I understood my own code finally.
That's probably a good thing
--
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[^]
|
|
|
|
|
I do not know English well, therefore use machine translation...
I created ActiveX component by means of MFC ActiveX wizard.
By means of ClassWizard I created event. Like this:
FireNetConnectOne() - NetConnectOne() event
BOOL CEasyCtrl::GoOnline() // this is just property...
{
FireNetConnectOne(); // All ok.
return GoOnlineB();
}
BOOL a()
{
FireNetConnectOne(); // error!!!
return TRUE;
}
I know FireNetConnectOne() is a member of CEasyCtrl and i can not call it from my code...but..i must...
Question: how to call FireNetConnectOne() event from simple function?
note: FireNetConnectOne() is a protect member of the CEasyCtrl.
|
|
|
|
|
I have been trying to use the Microsoft ServerXMLHTTP object to connect to a remote server. I have also tried using WinHTTP. When I connect to a remote server over HTTPS, I would like to be able to parse the remote server's certificate and validate it against my own list of Certificate Authorities (CA's), make sure the URL in the certificate is correct, and also make sure it hasn't expired. With WinHTTP and XMLHTTP, it doesn't seem that I can do that. Is there another COM object I can use (hopefully it's free or low-cost) or is there a way to write my own COM object that will do that?
Thanks.
|
|
|
|
|
I have written a COM add-in for Word, Excel and PowerPoint. It adds a new menu with three items to each of these applications. The menu items simply add a certain phrase to the header of the active document.
In Excel and PowerPoint it works perfectly. In Word it also works perfectly, but only on the first instance of Word. I.e. if I open Word for the first time it works, but if I then click the “New” button (which pretty much starts another instance of Word) my menu items do nothing. If I Alt-Tab back to the first document, it works again.
If I go to Tools-Options and uncheck the “Windows in Taskbar” option on the “View” tab, the problem is gone and my add-in works perfectly regardless of which document is active. In Excel and PowerPoint it is not necessary to change this option.
This confuses me terribly, because it is the exact same code that executes for all the applications. I even changed my click event to simply show a message box (no reference to the application objects) and it still doesn’t work!
I don’t want to force my client to disable the “Windows in Taskbar” option in order to use this add-in. What must I do differently in Word to make it behave like the other two applications?
Any advise or suggestion will be GREATLY appreciated!
Johannes Ackermann
|
|
|
|
|
OK, so let's do our duty and inform everyone that I've found a solution to the problem. After posting the question on countless forums, sending e-mails to everybody I could find and even contacting Microsoft's support desk, I waited a week and a half with not so much as a "sorry, dude... you're on your own"!
Well, for the benifit of other poor souls who might run into the same problem and who can obviously not rely on the "gurus" on the forums: I have found the solution. It is a silly little quirk in Word which, according to Microsoft, is there by design. The fact that it is NOT there by design in all the other Office applications is beyond me, but there you have it.
For each CommandBarControl you HAVE to specify a unique value in its Tag property. Simple, heh?
Read all about it here: http://support.microsoft.com/kb/826931/EN-US/
Thanks for nothing, guys.
Johannes Ackermann
|
|
|
|
|
hi,
I want to simulate a new com server object on installation with the same binary. this means I have a com server as service e.g. MyServer.exe with interface IMyInterface. so I can access it with ProgID "MyServer.IMyInterface".
but I have to start up more instances and for this I want to rename the MyServer.exe to SecondServer.exe, register as service and now access it through ProgID "SecondServer.IMyInterface".
e.g.
MyServer.exe in c:\MyServer\MyServer.exe
SecondServer.exe in c:\SecondServer\SecondServer.exe
and calling
*CreateObject("MyServer.IMyInterface") should start up instance of MyServer
*CreateObject("SecondServer.IMyInterface") should start up instance of SecondServer
Now I need the registry entries com uses to create the object and I will give the SecondServer new uuid.
So in other words: which registry entries I have to change to redirect com to my new com server "SecondServer"?
greets&thx
|
|
|
|
|
Hello this question was raised by Bilal and i am also interested in getting its answer but no answer was posted before so putting it again.
"I am new to COM,OLE,AUTOMATION,ActiveX in Vc
so please provide me the difference among each as well as their purpose
Thanks "
or you can also provide me a link or document where i can find the diference
regards
Muhammad Azam
|
|
|
|
|
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,
Yes you can, there r numerious ways to do this -
1. Write a plgin for word - for more info. search how to write plugin for
word
2. OLE Automation - If you r doing OLE embedding then get IDispatch, and
utilize the methods exposed by word. For more info. abt methods
expose by word, take the help from "OLE Object Viewer" to peep inside word
object
Cheers,
Vishal
|
|
|
|
|
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
|
|
|
|
|
Hello.
I am doing a research on DCOM, COM+ and .Net Remoting.
We are about to develop a license server which should communicate with all of our products (written in various languages)
I'd like to know what would be the best way to do this.
Should I use .Net Remoting? But i dont want the user to install .Net Framework if the product is written in C++.
Or would DCOM be a better solution? I heard that DCOM is a good choice in a situaltion like that?
And whats about COM+?
Maybe someone can give me some pres and cons just to get the right direction.
Thanx in advance
|
|
|
|
|
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
|
|
|
|
|
When the document is opened, is an object of your type created at all? If not, I would inspect GetClassID() to see if the correct CLSID is returned.
--
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[^]
|
|
|
|
|
Hi,
I have a MFC COM dll. when I tried to register this dll using regsvr32, I got error "DllRegisterServer entry point not found".
Can anyone help me out to know reason and solution...
thanks.
|
|
|
|
|
Check if you have properly exported "DllRegisterServer" function from your DLL.
You can check it using Depends.exe that accompanies Visual Studio.
This entry point (DllRegisterServer) is essential according to COM, for self registration of the COM Server implemented as a DLL.
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hi,
I would like to call a dll functions from MATLAB, but unfortunately the dll doesn't export its functions as a
generic dll, so using the loadlibrary function from MATLAB doesn't work. the dll actually defines a class with all its >100 public functions available.
I thought an alternative way would be to wrap the library and provide a COM interface conveniently usable from MATLAB but I couldn't find a good example. So basically I would like to upgrade a dll with a COM interface by wrapping it.
Thank you in advance for your help, examples or thoughts
Shady
|
|
|
|
|
If it defines a class with functions available it sounds like it is already created as a COM dll.
|
|
|
|
|
Thank you for your reply,
Actually the dll class doesn't define a COM interface at all, but I am now thinking of making a simple COM object which would also have inheritance from the dll class it would then have both the COM and the dll methods
available not sure if this is OK though.
Shady
|
|
|
|
|
To make it completly clear the dll .h file looks like this:
typedef int (__stdcall *PConnect) ();
typedef int (__stdcall *PConnectSimple) (int lAnInterfaceType, char *pcAComName, int lABaudRate, BOOL bAShowProt);
typedef int (__stdcall *PConnectEx) (TLS_ControlInitPar *pAControlInitPar);
typedef int (__stdcall *PDisconnect) ();
typedef int (__stdcall *PLoadConfig) (char *pcFileName);
typedef int (__stdcall *PSaveConfig) (char *pcFileName);
......
class CLStep4
{
int m_DLLResultat;
HINSTANCE m_LStep4;
PConnect m_pConnect;
PConnectSimple m_pConnectSimple;
PConnectEx m_pConnectEx;
PDisconnect m_pDisconnect;
PLoadConfig m_pLoadConfig;
PSaveConfig m_pSaveConfig;
....
public:
CLStep4();
~CLStep4();
int GetDLLLoadResult() {return m_DLLResultat;};
int Connect ();
int ConnectSimple (int lAnInterfaceType, char *pcAComName, int lABaudRate, BOOL bAShowProt);
int ConnectEx (TLS_ControlInitPar *pAControlInitPar);
int Disconnect ();
int LoadConfig (char *pcFileName);
int SaveConfig (char *pcFileName);
......
};
|
|
|
|
|
hi
i want to read a binary file and store it into one of my activeX Control's
property. i used unsigned char * as the type of the property that will hold
the data read from file. but when it calls the
IPersistStreamInitImpl::Save(....) method. the data stored in the property
of type unsigned char * is not read, displaying in output window that
ATL: Invoked failed on DISPID 3
where DISPID 3 is id of that property. plz let me know which data type to
use? or where the actual problem lies.
Thanks in advance.
Ahmad Jalil Qarshi
|
|
|
|
|
hi,
I have a wee problem, Im using TypeLibInfo in VB .NET to expose
members of COM+/COM objects. So far so good as I have been able to do many things with it, The problem comes when trying to determine the member type
i.e if it is a function or property etc. as the TLI.MemberInfo.InvokeKind
is always comming back as unknown.
thoughts?
regards
charlie
|
|
|
|