|
What do you mean by messages? Window messages? So you want the HWND of the ActiveX control?
Steve
|
|
|
|
|
Hi, I mean to write a bho that can control activex. Thank you
|
|
|
|
|
I am facing a problem where i dont receive the MSMQ events on 64 bit machine. The same code works fine on a 32 bit server but not on 64. Below is how the Sink mapping is done.
BEGIN_SINK_MAP(CMailQueueServer)
SINK_ENTRY_EX(0, DIID__DMSMQEventEvents, 0, Arrived)
SINK_ENTRY_EX(0, DIID__DMSMQEventEvents, 1, ArrivedError)
END_SINK_MAP()
I can queue up messages but the event doesnt get fired, the items in the queue remains unprocessed. Does it have to be handled differently in 64 bit server?
Any help will be greatly appreciated!!!
Hariharan.T
|
|
|
|
|
Hi everyone,
I have a C# COM dll which I've add to my delphi application . I can access to its methods and properties successfully .but I cannot access to its events .
this is the sample C# code that I found and used:
[ComVisible(false)]
public delegate void CallArrived(object sender, string callData);
/// <summary>
/// Interface to expose SimpleAgent events to COM
/// </summary>
[ComVisible(true)]
[GuidAttribute("1FFBFF09-3AF0-4F06-998D-7F4B6CB978DD")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IAgentEvents
{
///<summary>
/// Handles incoming calls from the predictive manager.
///</summary>
///<param name="sender">The class that initiated this event</param>
///<param name="callData">The data associated with the incoming call.</param>
[DispId(1)]
void OnCallArrived(object sender, string callData);
}
/// <summary>
/// Represents the agent side of the system. This is usually related to UI interactions.
/// </summary>
[ComVisible(true)]
[GuidAttribute("EF00685F-1C14-4D05-9EFA-538B3137D86C")]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(IAgentEvents))]
public class SimpleAgent
{
/// <summary>
/// Occurs when a call arrives.
/// </summary>
public event CallArrived OnCallArrived;
public SimpleAgent() {}
public string AgentName { get; set; }
public string CurrentPhoneNumber { get; set; }
public void FireOffCall()
{
if (OnCallArrived != null)
{
OnCallArrived(this, "555-123-4567");
}
}
}
and this is the Delphi Sample code which I used :
procedure TForm1.Button1Click(Sender: TObject);
var
intrf : SimpleAgent;
begin
intrf.AgentName ('Name');
end;
I'll appreciate it if anyone could show me the way to access the Event .
Best Regards,
Shialn
|
|
|
|
|
I'll give you a word or two of advice - you've posted this in the Delphi forum and again here - you'll get better help/assistance if you dont cross-post - pick a forum, stick with it - people will get narky if you post in more than one forum - if you get the forum wrong, people will guide you to the correct one
'g'
|
|
|
|
|
To some extent I can understand in this case. Help may come from either forum but most people who visit one probably won't visit the other.
Steve
|
|
|
|
|
How can i get Visual Studio to regenerate wrapper classes for an activex control? The control has updated but removing it from my project and adding it back does not generate the wrapper classes.
|
|
|
|
|
Remove existing wrapper class from your project and add new one either by adding a member variable for your control or by 'Add MFC class from ActiveX control' wizard.
|
|
|
|
|
Since removing and adding does not work for you, you could add the activex control into a new project and then take the generated files from there and replace your original files with the new ones.
|
|
|
|
|
Sounds like a reasonable suggestion.
Steve
|
|
|
|
|
Thanks for the suggestion. Do you guys have any idea why removing does not work? Do you know where visual studio keeps this info?
Thanks,
Eugen
|
|
|
|
|
I've ran into the same problem in the past. One of my co-workers told my a magic incantation that got the wrappers regenerated, but I can't remember what it was.
Steve
|
|
|
|
|
Hi,
I have a com local server(an BitManipulater.exe server) and a client.I executed two instances of client programs in debug mode.If i open the task manager in windows xp, the processes tab is showing only one BitManipulater.exe process.How com deals with local server, if lot of client are using same local server.I thought there will be two instances of BitManipulater.exe.Any explanation on this please,
Thanks in advance
venkatanarayana
|
|
|
|
|
When calling CoRegisterClassObject[^] for your class object use the REGCLS_SINGLEUSE flag (see here[^]). This should result in a separate exe per instance.
Steve
|
|
|
|
|
Hi Steve,
Thanks for the info.I am using MFC for creating com server.How i can access CoRegisterClassObject,I think object factories registration is done in COleObjectFactory::RegisterAll
Thanks & Regards,
venkatanarayana
|
|
|
|
|
It's not hard to find out. I placed a breakpoint in CoRegisterClassObject and when it was hit had a look at the stack. The MFC function COleObjectFactory::Register seems to be where the action takes place. The code in question looks like this:
SCODE sc = ::CoRegisterClassObject(m_clsid, &m_xClassFactory,
CLSCTX_LOCAL_SERVER,
m_bMultiInstance ? REGCLS_SINGLEUSE : REGCLS_MULTIPLEUSE,
&m_dwRegister);
Note the that the m_bMultiInstance member seems to be exactly what you're looking for. When I searched MFC's source for it I found this:
void COleTemplateServer::ConnectTemplate(
REFCLSID clsid, CDocTemplate* pDocTemplate, BOOL bMultiInstance)
Which contains the following:
m_bMultiInstance = bMultiInstance;
This functions seems to be called from your application's InitInstance function:
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_MFCEXETYPE,
RUNTIME_CLASS(CMFCExeComServerDoc),
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CMFCExeComServerView));
AddDocTemplate(pDocTemplate);
m_server.ConnectTemplate(clsid, pDocTemplate, FALSE);
Change the underlined bit to TRUE are see how things go. Don't be scared to look at the source code for MFC (or whatever libraries you're using)!
Steve
|
|
|
|
|
I want to know general question for using com and dcom ...
Is there any article that talks about com and dcom for beginners using c#
i am search in google but not find any simple article , plz help me ?
|
|
|
|
|
Hi
I have successfully got Directshow outputing a video from C++ MFC using Sample Grabber, but I can not figure out how to play the audio with this.
I have attached code snippet of what I have done currently, can anyone tell me what I need to do to get audio stream to work. I have added the sound renderer filter, just dont know how to connect it with the rest of the graph.
Thanks
HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pGraph->QueryInterface(IID_IMediaEventEx, (void **)&pEvent);
hr = pGraph->QueryInterface(IID_IBasicAudio, reinterpret_cast<void**>(&m_pAudio));
hr = pGraph->QueryInterface(IID_IMediaSeeking, reinterpret_cast<void**>(&pSeeking));
hr = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&pGrabberF);
if (FAILED(hr))
{
// Return an error.
}
hr = pGraph->AddFilter(pGrabberF, L"Sample Grabber");
CoCreateInstance(CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&g_pSoundRenderer);
hr = pGraph->AddFilter(g_pSoundRenderer, NULL);
// hr = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&pGrabberF);
// hr = pGraph->AddFilter(
if (FAILED(hr) )
{
// Return an error.
}
pGrabberF->QueryInterface(IID_ISampleGrabber, (void**)&pGrabber);
//ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE));
mt.majortype = MEDIATYPE_Stream;
//mt.subtype = GUID_NULL;//MEDIASUBTYPE_RGB24;
hr = pGrabber->SetMediaType(&mt);
hr = pGraph->AddSourceFilter(fileName.AllocSysString(), L"Source", &pSrc);
if (FAILED(hr))
{
// Return an error code.
}
hr = ConnectFilters(pGraph, pSrc, pGrabberF);
// Create the NULL renderer and connect
hr = CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, reinterpret_cast<void**>(&m_pNullRenderer));
hr = pGraph->AddFilter(m_pNullRenderer, L"NullRenderer");
hr = ConnectFilters(pGraph, pGrabberF, m_pNullRenderer);
|
|
|
|
|
Can someone help me with this error? I am compiling an IDL file and am getting an MIDL2020 error. This error is defined as
"General access denied error". I am working on a Windows Vista machine and have searched for a solution but cannot find anything that solves this. Any suggestions would be greatly appreciated. Below is the complete compilation error:
midl\oleaut32.dll : error MIDL2020 : error generating type library : SaveAllChanges Failed : .\spellcheck.tlb (0x80070005)
Here is the program:
//Creating the interface
import "unknwn.idl";
[object,uuid(C73BA5B4-B466-4348-8CC2-E6B48998B3F7)]
//Defining the interface
interface ISpellChecker : IUnknown
{
HRESULT CheckSpelling([in,string] char *word,[out,retval] BOOL *isCorrect);
HRESULT UseCustomDictionary([in,string] char *filename);
}
//Define type library
[uuid(C81C9C52-008B-429d-8533-262E90A1D0D5)]
library SpellcheckerLib
{
[uuid(57B7A8A0-E4D7-11d0-818D-444553540000)]
coclass CSpellChecker
{
interface ISpellChecker;
}
};
modified on Sunday, May 30, 2010 10:46 AM
|
|
|
|
|
I obtained the answer for this on another board. Basically, the problem is that I did not sign-on as administrator on my Visual Studio program.
|
|
|
|
|
Something puzzling is happening and I don't understand why. I tested using both my C# and VB.NET test apps and both result in the same behavior. When I run the application I have the following line (C#):
m_COMApp = new SignalServer.Application();
No matter what I do, I always get a new instance of the COM server, even if the server is already up and running. This does not happen in XP and I don't recall it ever happening under Vista (I plan to re-test that this weekend as I have Vista at home). This only happens when I run the COM client directly from within Visual Studio. I even changed my reference to point to another version of the server, and it still wanted to load the server found in the original directory.
I decided to run the application by double-clicking in Explorer and then I get the expected behavior. That is, if a server is already running, it will simply attach to the currently running server. Anyone know why I get the other behavior? Some thoughts are:
1) I am on Visual Studio 2005. Maybe this won't happen in 2010.
2) All the applications are 32-bit apps and the OS is 64-bit. Maybe because of the x86 directory names, things get a little messed up?
Anyone else experience this? Thanks for any information.
|
|
|
|
|
Are you running Visual Studio with UAC elevation?
Best Wishes,
-David Delaune
|
|
|
|
|
Aha! Thanks. That was the problem. I turned off UAC and everything works just as I would expect (like on XP)! I always leave UAC turned on because it's great for finding issues our customers will run into. I didn't even think about turning it off this time around.
|
|
|
|
|
Hi,
I am working on Excel Automation.
Implemented the logic to retrieve all the running Excel instances, now I am getting IDispatch pointer. Assigning this IDispatch Pointer to Excel object.
Following is the code:
IDispatch* p=NULL;
HRESULT hr = AccessibleObjectFromWindow(hwnd, OBJID_WINDOW, __uuidof(IDispatch), (void**)&p);
if(hr == S_OK)
{
try
{
Excel::WindowsPtr pWindow = NULL;
HRESULT hr = p->QueryInterface(__uuidof(IDispatch),(void**)&pWindow);
Excel::_ApplicationPtr xl;
xl = pWindow->Application;
But getting com exception at above line. The com error: _Vfpointer: scalar deleting destructor(unsigned int) m_hresult:"Member not found".
I googled but there is no clarity in solution.
If any clue, please let me know.
Thanks in Advance.
Regards,
KTTransfer.
|
|
|
|
|
KTTransfer wrote: Excel::WindowsPtr pWindow = NULL;
HRESULT hr = p->QueryInterface(__uuidof(IDispatch),(void**)&pWindow);
What's the deal with this? You'd hope Excel::WindowsPtr wraps an IDispatch pointer (does it?).
Try this:
Excel::WindowsPtr pWindow = NULL;
HRESULT hr = p->QueryInterface(&pWindow);
Steve
|
|
|
|
|