|
Thanks, I'll give it a shot. For the time being I resorted to wrapping the functionality I required in a native COM C++ class and calling it using marshaling from my managed code. Thanks again!
|
|
|
|
|
hi
i have to include one namespace in my program but i don't know the dll file in which it is present how can i know the name of the dll in which that namespace present.
thanks in advance.
|
|
|
|
|
We have to implement a com server as an executable which will be communicating with a COM dll. COM server would need to call certain functions in COM dll and the com dll would also need to invoke certain functions in the com exe. That is, both would be acting as a server as well as a client. What are the design issues to be considered? Any code samples, tips and suggestion would be most welcome.
Thanks
C++beginer
|
|
|
|
|
When thinking in terms of "client" and "server" it's generally a good idea not to mix those two up.
Or to put it in other words: the server serves the client in the aspect of solving a problem which usually is well defined and the server is considered a black box and you don't know how it looks inside and neither want to know nor need to.
If you somehow get the impression that the client should serve the server, you should generally get suspicious.
If the server need information from the client it does not call the client; the server is provided the information by a call from the client presumably in a struct defined in the IDL-file for the server, or through method parameters.
A situation where the server actually calls the client would be during an asynchronous operation when the server informs the client that the operation has finished, e.g. connection points.
If you still think your client should behave like a server, please describe your problem further.
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Hi !!
I have to port an OLE Server from W2K to WXP. I didn't create the code (that was russian guys infact).
At the moment, We will consider, there is only One Server and One Client (an OCX). Both are in VC++ 6.
The first approach was to simply install the package (which was working under w2K) on the WXP computer.
Then, we saw that when the OCX connects to the Server, both the server and the OCX crashes.
The second approach, was to compile them under WXP, and then launch it. no changes, the server and the OCX crashes.
Third thing i did, I launched the Server and the Client step by step and saw where exactly it crashes. The server crashes on a DispatchMessage instruction in the _tWinMain function. But what makes the server to crash is a AfxConnectionAdvice instruction. I got no explanation. My understanding of technical aspects of COM is quite limitated. I Just started to retrieve some tuorials, aso...
I looked further to see what could make that to crash, and didn't foud a lot of informations a bout a similar problem.
I finally stepped over the AfxConnectionAdvice and the server didn't crash. but the OCX still had problems elsewhere. the list is quite long.
My questions are :
- what could make this happened ?
- What could be the good method to solve this issues ?
- What are the points to check ?
Thanks very much for your answers
Sebastien
|
|
|
|
|
Does anyone know how to convert pdf to tiff via Acrobat 5 writer automation?
I need sources.
Thanks,
Dudi
|
|
|
|
|
Hello i have a problem with event sink. I need to contol a NewWindow when it pops-up (to change if its visible toolbar)
i'm not sure about pDispParams->rgvarg[1].pdispVal; parametr. SOmehow i dont have handle to the new window.
Please help...
Code for NEWWINDOW2 event:
HRESULT __stdcall DWebBrowserEventsImpl::Invoke(DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS __RPC_FAR *pDispParams,
VARIANT __RPC_FAR *pVarResult,
EXCEPINFO __RPC_FAR *pExcepInfo,
UINT __RPC_FAR *puArgErr)
{
if (dispIdMember == DISPID_NEWWINDOW2)
{
//event sink is working because i can get a test message every time a new window pops
//but somehow i cant control a new wondow ?
MessageBox(NULL,"TEST","TEST",NULL);
//////////////////////////////////////////////////////////// this part wont work ?
CComQIPtr< IWebBrowser2> Nwin= pDispParams->rgvarg[1].pdispVal;
Nwin->put_Visible(TRUE);
Nwin->put_MenuBar(TRUE);
Nwin->put_ToolBar(FALSE);
}
return NOERROR;
}
|
|
|
|
|
MSDN says about DISPID_NEWWINDOW2:
The user clicks a link while pressing the SHIFT key.
The user right-clicks a link and selects Open In New Window.
The user selects New Window from the File menu.
There is a targeted navigation to a frame name that does not yet exist.
I hope it is not one of above case.
Can you show coclass declaration for this class?
|
|
|
|
|
I have a simple VB6 class in a DLL that has two functions , AllocateLargeArray and DeAllocateLargeArray. I am driving the DLL from an MFC App and in this App I have a button that creates an interface to the VB Class and calls the two functions then releases.
If I then look at the Apps Private bytes (VM Size in TM) of the process the value seems to initially increase lots say to 1900k then on subsequent presses of the button drop to 1600k again to 1300k again to 1000k and then shoot back up to 1900k !
Can anyone tell me why is behaviour ?
To aid here is a a snippet of the code in VB.
Thanks.
Option Explicit
Dim mCollection As Collection
Public Function AllocateLargeArray()
Dim loc As MyStruct
Dim ii As Integer
Set mCollection = Nothing
Set mCollection = New Collection
For ii = 1 To 10000
Set loc = New MyStruct
mCollection.Add loc
Next ii
End Function
Public Function DeAllocateLargeArray()
Dim ii As Integer
ii = 1
Do While ii <= mCollection.Count
mCollection.Remove ii
Loop
Set mCollection = Nothing
End Function
|
|
|
|
|
el_scrub wrote: Set loc = New MyStruct
mCollection.Add loc
I'm no expert in VB, but, while removing loc(MyStruct) from mCollection, shouldn't you set element to be removed to nothing.
i.e.
Do While ii <= mCollection.Count
mCollection.Remove ii
Loop
|
|
|
|
|
If it was not deleted surely next time I called the same function the memory would just keep increasing and increasing no ?
I followed what you said and set ever Item to Nothing before removing it from the Collection, but I still get strange memory readings like before though a little different !
|
|
|
|
|
Hmmm, I can see that much memory leak, mentioned earlier.
Dont know how you are using it.
|
|
|
|
|
hi
I am working killing a process using WMI iam using the following code .
HRESULT hres;
BSTR ClassName = SysAllocString(L"Win32_Process");
/* YOU NEED TO CHANGE THE NUMBER VALUE OF THE HANDLE
(PROCESS ID) TO THE CORRECT VALUE OF THE PROCESS YOU
ARE TRYING TO TERMINATE (this provides a path to
the class instance you are tying to terminate). */
BSTR ClassNameInstance = SysAllocString(
L"Win32_Process.Handle=\"\1418\"");
_bstr_t MethodName = (L"Terminate");
BSTR ParameterName = SysAllocString(L"Reason");
IWbemClassObject* pClass = NULL;
hres = m_pIWbemService->GetObject(ClassName, 0, NULL, &pClass, NULL);
IWbemClassObject* pInParamsDefinition = NULL;
IWbemClassObject* pOutMethod = NULL;
hres = pClass->GetMethod(MethodName, 0,
&pInParamsDefinition, &pOutMethod);
if (FAILED(hres))
{
cout << "Could not get the method. Error code = 0x"
<< hex << hres << endl;
}
IWbemClassObject* pClassInstance = NULL;
hres = pInParamsDefinition->SpawnInstance(0, &pClassInstance);
// Create the values for the in parameters
VARIANT pcVal;
VariantInit(&pcVal);
V_VT(&pcVal) = VT_I4;
// Store the value for the in parameters
hres = pClassInstance->Put(L"Reason", 0,
&pcVal, 0);
// Execute Method
hres = m_pIWbemService->ExecMethod(ClassNameInstance, MethodName, 0,
NULL, pClassInstance, NULL, NULL);
if (FAILED(hres))
{
cout << "Could not execute method. Error code = 0x"
<< hex << hres << endl;
VariantClear(&pcVal);
SysFreeString(ClassName);
SysFreeString(MethodName);
pClass->Release();
pInParamsDefinition->Release();
m_pIWbemService->Release();
//pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
it is working fine ,but here iam gicing the Process ID which has to be terminated like 1418.
Instead of ProcessID i want to use process Name like CAlc.exe or notepad.exe
but when IAm tring to change the code with the process name like
SysAllocString(
L"Win32_Process.Name=\"\notepad.exe\"");
notepad is not terminating . can you please help me to solve it.
Thanks in Advance
abhi
|
|
|
|
|
pItem1Ptr->put_innerHTML(L"");
The code above is to change something in the HTML.
It works well in IE6,I can get the gif picture successfully.
But when I run my code in IE7, this code can't work........and I found that, if I replace c:\\float.gif into http://somesite/somepic.gif It can work nice. So I think there maybe something changed in IE7, can anyone tell me how to show my c:\\float.gif picture in IE7????
|
|
|
|
|
Try using "file:///c:/float.gif" (as you should if file paths are used).
Steve
|
|
|
|
|
well,thanks for your reply.
but both your method or mine get the same result.
I use get_innnerHTML ,and print the result:
It seems just ok.
But whatever,I can't see the picture.
The propertis of picture I just can see:
Protocol: Not Available
Type: Not Available
Address: Not Available
Size: Not Available
|
|
|
|
|
Hi All,
Recently I got some doubts regarding Connection Points. Please replay the mail, if you know the answers.
1. What are the main drabacks (except implementation difficulties). Suppose client requested the server for some operation and doing its wone work. In the time of server doing work, if some problem occurred on the server. Then how server inform the client saying that operation failed.
My doubt is how server inform client sink, when server fails to do the operation.
2. Why Microsft intraduced delegates, while we are having Connection points. I know delegates are type safe, object oriented. But why elemenated Connection points.
3. VB internally uses Sink Map, IConnectionSimpleImple or not.
Thanks
nch srinivas
|
|
|
|
|
Have a debug failure when creating a window of my COM 3d imager. I think its an issue with passing my OLE control through my sub classes.
When I created my 3d imager window inside my application…
bRet = m_pSatMap->Create("Internal_DB_SAT_Map", 0, Rect, pMainFrm, ID_SAT_MEM_MAP, NULL, FALSE);
I got an assertion error from ENSURE(afxOccMgr != NULL)”. After researching this I found that this would occur when AfxEnableControlContainer() was not call. However it is in my main but not in my subclass where the Create is called. So I added it to that class, and now I have another assertion problem. Now “ASSERT(pWndCtrl->m_pCtrlSite == NULL)” is failing.
I think I’m looking for a site that speaks to how to pass afx control to classes inside an application.
Thanks for any help
Glenn
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Hi Community,
for my next project, I need a kind of data grid in my application. Is there a handy ActiveX-control which I can use on a FormView, or is there a way to use the Windows Forms DataGridView in my MFC-App?
Thanks,
Frank.
|
|
|
|
|
Hello
I've a problem with an activex component in some machines, in one in it
registry i see that the compability of the activex is 5.17 but the computer
is full of windows update, How can I upgrade the compability in orden to use
the activex component.
thanks for all
|
|
|
|
|
My DCOM server works very well in Intranet,but In Internet it can not work,I always get the error of 0x800706BA!
How can I do? thanks!
Johnson Wen in china
|
|
|
|
|
Hi everybody,
I've got a strange thing using my DCOM application(s).
I wrote both server and client, and one of the last issues I can't resolve is the following:
On the server machine (EXE Server with MFC) I have the following class method (with implementation):
STDMETHODIMP CAugVisionEngine::ReadText(BSTR CharSetName, int pTop, int pLeft, int pHeight, int pWidth, BSTR *OcrString)<br />
{<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState())<br />
... [code omitted here for brevity]
...
char* strTemp = (char*) malloc(sizeof(OcrReport_tmp->readString)+1);<br />
strcpy(strTemp, OcrReport_tmp->readString); <br />
*OcrString = W2BSTR(A2W(strTemp));<br />
<br />
return S_OK;<br />
}
where the last parameter, the BSTR, is the return value of the function (just [out], not [out, retval])
When I call the function from the client (for now MFC application, just to test, but the release will be a console application), in a way like this:
BSTR OCRBSTR;<br />
<br />
pIVE->ReadText ("C:\\Patterns\\3260\\05042800\\1235.abc",40, 249, 48, 83, &OCRBSTR);
I get that the server constructs the BSTR correctly (at least, it seems to do it, since a logfile is populated correctly), but my client retrieves nothing...
I'm stuck...
Any ideas?
Thanks in advance,
Morenz.
|
|
|
|
|
your code doesn't seem to have problem.
morenz wrote: *OcrString = W2BSTR(A2W(strTemp));
As you said, this value you are writing in log file, isn't it?
-- modified at 4:56 Tuesday 14th November, 2006
|
|
|
|
|
yes, I'm writing it in a file as a string. When I debug it, I see that the BSTR has the correct value, too...
For now I workarounded it, making the client open the file directly on the server and getting the string itself, but it's not elegant...
|
|
|
|
|
im using .net 2k3, office 2k3
well every thing was working fine, but after a week during which i've
not edited/used my code !!! and now everything is in mess...
please help me to solve this problem..
dim applicationObject As Object
WithEvents outApp As Outlook.Application
while assigning,
outApp = applicationObject
i'm getting error,
message => "Could not load type
Outlook.ApplicationEvents_11_NewMailEventHandler from assembly
Interop.Outlook, Version=9.1.0.0, Culture=neutral, PublicKeyToken=null."
Err.Number => 429
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|