|
|
U have the source code ? If yes u can debug using dll host !
|
|
|
|
|
hi all
i have 2 .lib files related to one com server . the first is to make connection with the server and the latter is for sending and recieving data .
i have created an instance for the first by :
<br />
MULTI_QI qi[] = { & __uuidof(IserverSys) , 0, 0} ;<br />
<br />
COSERVERINFO serverinfo;<br />
COSERVERINFO *pServerInfo = 0;<br />
memset( &serverinfo, 0, sizeof( COSERVERINFO ) );<br />
<br />
serverinfo.pwszName = NULL;
pServerInfo = &serverinfo;<br />
serverinfo.pAuthInfo=NULL;<br />
{<br />
hr = ::CoCreateInstanceEx( <br />
__uuidof(serverSys) , <br />
0, <br />
CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER ,<br />
pServerInfo, <br />
1, <br />
qi<br />
);<br />
if( ( FAILED(qi[0].hr) ) || ( FAILED(hr) ) )<br />
{ <br />
AfxMessageBox(" Could not create instance of server");<br />
return ;<br />
}<br />
g_pIserverSys = (IserverSys *) qi[0].pItf;<br />
do i have to do the same for the latter ? if not what do i must do to create an object for the latter?
|
|
|
|
|
Is it possibly to obain currently active IE window using IShellWindows. I can get the list of open explorer windows using get_Count() function that's about it.
What I want is to keep track of multiple opened IE windows, so that if the window becomes active (a user navigates to a new site, etc) I can jusp directly to it, retreive and retreive the document witout cycling through all opened IE windows.
Thank you
|
|
|
|
|
Are you writing a BHO ? If so you could sink events from IWebBrowserEvents2 interface to get notified from new browser windows and page navigation, there's a lot of articles on codeproject describing how to do it.
I hope it helps,
GuimaSun
www.nexsun.com.br
NEXSUN TechZone
|
|
|
|
|
i have a com class in an mfc dialog based app that recieves data from an out of process com server . i want to send the reciveing data to a dialog to show it . what is the best way ? posting message or another ?
|
|
|
|
|
A general solution is to launch an event with data from the COM object, that event would be subscribed by the MFC client which get the data and may show it.
GuimaSun
www.nexsun.com.br
NEXSUN TechZone
|
|
|
|
|
Hello, I hope I am posting this in the right place.
I am writing a website using Asp.Net and I am trying to use a COM written in FoxPro. I have compiled the COM as a multi-threaded dll and added it as a reference. When I try to instantiate it (e.g. myserver.myclass comObject = new myclass() ), I get a InteropServices.COMException and the Message is simply "Exception Occurred". Does anyone know what I might be doing wrong, or any way I can get more information out of the exception? I tried printing the HRESULT and I get -2146352567.
Any help would be appreciated.
Thanks
BCKY
|
|
|
|
|
Hi all
I am writng an application in mfc which have to monitor the internet explorer
and to get the x and y coordinates of the caret position.
I already knows how to get IHTMLDocument2 from the HWND
but was not able to figure out how to get the position of the caret inside the document.
i understood that the IHTMLCaret cannot be retrieve because my application is in a different process.
So what is the solution for this
i will be very happey to hear any suggestion because i am stuck with this problem for almost two weeks
now.
|
|
|
|
|
Hi all ,
I have created an instance of a COM+ component in another component . All works extremely fine in Debug Version but when compiled in Release version , the Release (.Release()) of the component gives an access violation exception .
Can anyone please help me solve this problem .
Thanks and Best Regards,
Amey
|
|
|
|
|
|
Hi GaimaSun ,
Ya, tht's the first thing tht i've tried , problem is that there memory corruption somewhere which is getting overlooked in the debug version but as release version optimises memory allocations, its giving an access violation while releasing the inner component . Thinking of using purify for this problem, wht's ur suggesion .
thanks for ur response.
Best Regards,
Amey
|
|
|
|
|
To add RTP render filter CLSID_RTPRenderFilter what library can I add to project?
Mau
|
|
|
|
|
Hello,
I have a class that contains a Shell Folder and PIDL. The class instances live in the .Tag of TreeView and ListView items. When a Drag containing file/directory information (as in dragged from Windows Explorer) is over or drops on one of the TreeViewNodes, I want to respond using the IDropTarget Interface of the Folder represented by my class instance.
My problem is that I cannot get the IDropTarget Interface to work. I suspect that I have either mis-defined it or have omitted some vital step prior to using it.
Specifics:
<ComImportAttribute(), _
InterfaceType(ComInterfaceType.InterfaceIsIUnknown), _
Guid("00000122-0000-0000-C000-000000000046")> _
Public Interface IDropTarget
<PreserveSig()> _
Function DragEnter( _
ByVal pDataObj As System.Windows.Forms.IDataObject, _
ByVal grfKeyState As Integer, _
ByVal pt As POINT, _
ByRef pdwEffect As System.Windows.Forms.DragDropEffects) _
As Integer
<PreserveSig()> _
Function DragOver( _
ByVal grfKeyState As Integer, _
ByRef pt As POINT, _
ByRef pdwEffect As System.Windows.Forms.DragDropEffects) _
As Integer
<PreserveSig()> _
Function DragLeave()
<PreserveSig()> _
Function DragDrop( _
ByVal pDataObj As System.Windows.Forms.IDataObject, _
ByVal grfKeyState As Integer, _
ByRef pt As POINT, _
ByRef pdwEffect As System.Windows.Forms.DragDropEffects) _
As Integer
End Interface
Note: I am only calling DragEnter so far in my code.
Where POINT is declared:
<StructLayout(LayoutKind.Sequential)> _
Public Structure POINT
Dim x As Integer
Dim y As Integer
End Structure
The part that seems to work:
... code that sets up relPidl ...
Dim apidl(0) as IntPtr
apidl(0) = relPidl
Dim Eff As Integer
Dim theInterface As IDropTarget
Dim HR As Integer
HR = Me.Parent.m_Folder.GetUIObjectOf(IntPtr.Zero, 1, apidl, ShellDll.IID_IDropTarget, Eff, theInterface)
If HR <> 0 Then
Marshal.ThrowExceptionForHR(HR)
End If
Note: m_Folder is the shell Folder interface of the Folder that contains the Folder of interest. Folder & PIDL code has been working for months, though this is the first time I've used GetUIObjectOf. In any event the returned item is a System_ComObject, just like I expect.
The part that doesn't work:
... e is a System.Windows.Forms.DragEventArgs with valid data..
for example the DragEventArgs generated by dragging from Windows Explorer ...
...The target is a normal Windows directory reporting .IsDropTarget among its attributes ...
Dim IDrop As IDropTarget = target.GetDropTargetOf()
If Not IsNothing(IDrop) Then
Dim scrpt As New ShellDll.POINT()
scrpt.x = e.X
scrpt.y = e.Y
Dim eff As DragDropEffects = e.AllowedEffect
Try
Dim res As Integer = IDrop.DragEnter(CType(e.Data, IDataObject), e.KeyState, scrpt, eff)
Catch ex As Exception
Debug.WriteLine(ex.ToString)
End Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(IDrop)
End If
Always throws a NullReference exception after reporting:
A first chance exception of type 'System.NullReferenceException' occurred in exptreelib.dll
Additional information: Object reference not set to an instance of an object.
I strongly suspect some kind of Marshalling problem on the return from IDropTarget, but I will believe any explanation that works.
Thanks
Jim Parsells
|
|
|
|
|
I have a custom ActiveX control that serves as a container for a store-bought ActiveX control. My problem is that I need to access the properties and methods of the store-bought control (call it an instrument) from the parent application.
The sequence of events is that the parent application creates instances of my container (basically just a jazzy group box) and then sends a message telling my group box which instrument to create. This works fine, but now I need to "control" the instrument.
I have successfully gotten an IDispatch* for the instrument and returned it to the parent application, but I see no clean way to invoke methods or set properties on the instrument. The issue is that I want to make legible calls of the form
(Instrument*)p->InstrumentMethod(). I have found no way to avoid some horiffic canned mapping of the numeric DISPID's of the instrument. The main application is extremely large, and legibility and maintainability will go to zero if I have to use Invoke() instead of just calling the instrument method.
As an alternative, I have tried to pass a CWnd* property, but I have two worries about this. First, I see no obvious way (other than trickery) to pass a CWnd* as a COM Property. Second, I am highly doubtful that the CWnd* will be valid throughout the lifetime of my group box.
HHHEEEEEEEEEEEEEEEEEEEEELLLLLLLLLLLLLLLLLLLLLLLLLLLLPPPPPPPPPPPPPPPPPPPPPPPPPPP!
Regards,
David Hamilton
|
|
|
|
|
Urgent Bump.
Regards,
David Hamilton
|
|
|
|
|
Hey everyone, I'm a little stuck with this and this is my fist question on these boards, and any advice anyone could give would be greatly appreciated
So basically, I have these two COM components that share memory using a MapViewOfFile object... like so:
-----------------------------------------------------------------
In the "server" component:
HANDLE hBlockMap;
...
hBlockMap = CreateFileMapping((HANDLE)0xFFFFFFFF, NULL,
PAGE_READWRITE, 0,
sizeof(Block), "SharedBlockMemory");
In the "client" component:
HANDLE hBlockMap;
...
hBlockMap = ::OpenFileMapping(FILE_MAP_WRITE, FALSE, "SharedBlockMemory");
-----------------------------------------------------------------
I also have a simple "Block" object, just to test sharing data, which looks like this:
-----------------------------------------------------------------
class Block
{
public:
void Write(char* msg);
char* Read();
int getSize() { return n_size; }
Block();
~Block();
private:
BYTE* data;
int n_size;
};
and just the Write and Read methods:
void Block::Write(char* msg, int size)
{
data = new BYTE[strlen(msg) + 1];
memcpy(data, (BYTE* )msg, strlen(msg));
n_size = size;
}
char* Block::Read(int size)
{
char* result = new char[n_size + 1];
memcpy(result, (char* )data, n_size);
return result;
}
-----------------------------------------------------------------
So basically, my problem is this:
The Write and Read methods both actually "work", and by that I mean I'm not getting any wierd memory access violations... If I expand the write method to check and make sure its writing, like so,
void Block::Write(char* msg)
{
...
n_size = size;
char* check = new char[strlen(msg) + 1];
memcpy(check, (char* )data, strlen(msg));
check[strlen(msg)] = '\0';
cout << check << endl;
delete[] check;
}
It outputs the correct string. However, no matter what I seem to do, the Read method just outputs garbage... I'm completely mystified, because if I change, in the Block class, the definition of data to
BYTE data[250];
and then change my Write and Read method to deal with that accordingly, I get the correct output in the Read method. But if use BYTE* data, I just get garbage...
Am I just missing something small, maybe some syntactical error? I haven't programmed in C++ as much lately, and I wouldn't put that myself, but I'm fairly sure my code dealing with the pointers and copying memory is correct... Or is it something else, could I be using the MapViewOfFile incorrectly?
And also, here is an example of how I read from it, just to demonstrate that access to the shared memory is synchronized (using a seperate mutex)...
-----------------------------------------------------------------
class CMemoryMgr : public IMemoryServer,
public IMemoryClient
{
public:
...
private:
Block* c_Block;
...
};
void __stdcall CMemoryMgr::TPF_PrintMessage()
{
if(::WaitForSingleObject(hBlockMutex, 5000L) == WAIT_OBJECT_0)
{
cout << c_Block->Read(c_Block->getSize());
cout << endl;
::ReleaseMutex(hBlockMutex);
}
}
-----------------------------------------------------------------
Also, the reason I want to dynamically allocate the data array is because I will be developing a customized circular buffer, and I want to be able to allow data of any reasonable size to be enqueued, so thats why I'm trying to stay away from a fixed array size.
Anyway, thank you all for reading my problem!
Like I said, any advice would be greatly appreciated
|
|
|
|
|
I think your problem may be related to different heap spaces used on Read\Write context.
Just change the new\delete operators to a allocator that uses the main process heap like: CoTaskMemAlloc and CoTaskMemFree.
I hope it help.
GuimaSun
www.nexsun.com.br
NEXSUN TechZone
|
|
|
|
|
Look the following code:
hr = pVC->QueryInterface(IID_IPropertyBag, (void **)&pBag);
if(FAILED(hr))
{
MessageBox(NULL,TEXT("Creating IPropertyBag object failed!"),NULL,MB_OK);
return FALSE;
}
The return value shows that pVC doesn't support IPropertyBag interface.Now I just wanna know how can I find the right interface that support the IPropertyBag.Thanks a lot!
My email is siwlyfe@hotmail.com.Please send your idea to me and also we can discuss it by MSN.Thanks again!
pig head xiaoma
|
|
|
|
|
1. Please check the exact HRESULT value returned. Dont just think that if FAILED(hr) suceeded then IPropertyBag is not supported. There could be some other reason for failure as well.
2. If pVC->QueryInterface(IID_IPropertyBag, (void **)&pBag) fails then the component you are accessing pVC doesn't support IPropertyBag interface. Thus even from another interface of this component you will never reach IPropertyBag (Please see the rules for implementing Query Interface)
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Look the following code:
hr = pVC->QueryInterface(IID_IPropertyBag, (void **)&pBag);
if(FAILED(hr))
{
MessageBox(NULL,TEXT("Creating IPropertyBag object failed!"),NULL,MB_OK);
return FALSE;
}
The return value shows that pVC doesn't support IPropertyBag interface.Now I just wanna know how can I find the right interface that support the IPropertyBag.Thanks a lot!
My email is siwlyfe@hotmail.com.Please send your idea to me and also we can discuss it by MSN.Thanks again!
判断返回值结果:pPropertyBag不支持IPropertyBag接口,那么我现在想知道如何能查到哪个接口的对象
支持IPropertyBag接口,怎么来查?
打扰,多谢
pig head xiaoma
|
|
|
|
|
I have created a basic MFC ActiveX control using the VS wizard. I added one stock event, the MouseMove event. The problem is that for whatever reason the MouseMoveEvent is constantly fired wether the mouse is actually being moved or not. I have tested this with both VS.NET 2003 and beta 2 of VS.NET 2005. Both with the same weird behaviour.
I have also tried to manually call the FireMouseMove() in COleControl with the same result. As soon as I call FireMouseMove() once I keep getting MouseMoveEvent's. Does anybody have a clue what is going on?
Thanks,
Jan
We are the all singing, all dancing crap of the world. - Tyler Durden
|
|
|
|
|
Without creating a control ,can i provide activex scripting for my
mfc application.please refer the web sites so that i can learn from the
scratch...i need step by step learning with suitable examples
|
|
|
|
|
hi
is it possible to send a BSTR to a method expecting _bstr_t?
thank you?
|
|
|
|
|
Yes. _bstr_t is a c++ wrapper class for handling BSTR.
Please check the _bstr_t constructors documentation in MSDN.
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|