|
GetActiveObject cannot be applicable by ROTMONK.EXE's manner because the moniker by which the object is registered in ROT is really the non-bindable moniker.
With best wishes,
Vita
|
|
|
|
|
Thanks for the comment Vita. I wasn't completely sure without trying it whether I would be able to use BindToObject() to attach to the process but I won't even try now.
Anyway, I have reflectioning further on this, and guess that what I am trying to do is not strictly necessary and can hopefully achieve what I need using a slightly different approach. If I use the
pIMyApp->CreateDispatch( "InterfaceName" ) function to get the interfaces that I need then that should suffice, as long as the required interfaces all connect to just one singleton instance of my exe automation server. As per normal apps, the important thing is the data, which must
be common so that the interfaces can access it.
I am, of course, greatful for any help that I might receive.
|
|
|
|
|
I have a question about COM, MFC and Thread Neutral Apartment that I hope
someone can answer or at least give some hint where I can find the answer myself.
The current situation is that I have a couple of old COM components written in
MFC, all STA apartment, IDispatch only and with chatty (property based)
interfaces. The MFC components are currently installed in COM+ and are
frequently accessed by (ASP).NET applications. To reduce the number of
context and thread switched we are thinking about to change the threading
modell of most of the components from STA to TNA. The components will still
be accessed in a "STA" way, i.e. they will have only one client at the time.
I have done some minor tests and it seems to work, but ...
So my questions is: Based on the information above is it at all possible to
change the (registry) settings and change the threading model, and if so
will there be any (performance/functionality) issues to consider ?
|
|
|
|
|
how do i get the right click menu for a custom toolbar i created .
ie when i right click on it how do i get a menu and add items to it Any one please help me .
Thanks in advance
Srikar Y
NITK Surathkal
|
|
|
|
|
Since this is a cutom toolbar, you can handle RButtonDown notification, and then create a CMenu object, and use LoadMenu and TrackPopupMenu methods to display it.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Hey i'm making a COM dll using the ATL appwizard and... the COM dll is set support MFC...
The COM dll is used by a VB application... NOw i want to make an installation or setup so that my application is run in other computers without Visual C++...
How do i do these? What DLL's would i have to include in my installation... how about MFC dll's?
I tried installing the applicationsin other computers but there's an error saying that some DLL failed to register... I'm thinking i did not include other dll's that is needed by the application itself or the DLL that was included already.. what is it? i didn't use other third party libraries so i'm sure maybe its just the MFC dlls.. what is it?
"its all right, the gun isn't loaded" - hey
|
|
|
|
|
What you can do is, link the MFC Dll statically to your COM dll. Then you only need to distribute your COM dll, and dont forget to register your dll before using it from VB.
Registration can be done using 'Regsvr32' command. OR if you are using some installation pgms, then there will be some APIs for doing the same.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
I added a toolbar button to IE, which is connected to a BHO object.
I implemented IOleCommandTarget and IObjectWithSite interfaces. the problem is once i click on the toolbar it is invokes IOleCommandTarget ::Exec, and disables the toolbar button. How do u stop this behaviour.. can any body help me
|
|
|
|
|
Is the following safe?
{<br />
map<<CComBSTR, CComBSTR>> mp;<br />
<br />
{<br />
CComBSTR& bstrNew = mp[L"1"];<br />
<br />
bstrNew = "Hello";<br />
}<br />
<br />
wprintf(mp[L"1"]);<br />
}
Will bstrNew get destroyed, thus invalidating the "Hello" string?
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|
I'm considering building an ActiveX control.
I would like to know which consideration I should take into account.
The application which is going to use the activeX control is a multi-threaded, it contains many features and might be big.
Does ActiveX slow down the system? are there problem with threaded?
What are the advantages and disadvantages of ActiveX? Should I write a java applet, or an MFC dll instead?
Thanks Dafna.
|
|
|
|
|
If you are not confident, that your control is thread-safe, always put it in an STA( Single Threaded Apartment ), so that only one thread can access it, and select the threading model as Apartment.
ActiveX unlike, VBX controls has got independent existence, irrespective of the language used. They are actually built on top of COM standards, and has got several adavntages as well, refer MSDN for more details. Disadvantages can be there unless otherwise not properly implemented.
Java Applet / MFC DLL ?? - Depends on the scenario.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
consider the following code:
<br />
STDMETHODIMP CmyComObject::get_Address(BSTR *pVal)<br />
{<br />
*pVal = m_sAddress.copy();<br />
<br />
return S_OK;<br />
}<br />
i'm using this Com object in a Visual Basic Program... Now when i keep on calling this function many times, does my program goes to a memory leak?, or does visual basic frees the copies automatically? or should i manually free the strings first before making another copy?
i also got this in a .net examples on bstr::copy()..
"its all right the gun isn't loaded" - hey
|
|
|
|
|
Visual Basic is not going to do that for you, Its your responsibility to free it.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Nope, guess again. VB is calling this code, and it will manage the returned BSTR, disposing of it as appropriate. If it was VC++, then the caller would manage the returned string. VB, as caller, is doing that, and the fragment is fine.
You need to return a copy of the string because the ORIGINAL still belongs to the interface implementation (or object).
Steve S
|
|
|
|
|
|
You mean that i need not to release and do nothing,
This situation will not go to a memory leak?
"You need to return a copy of the string because the ORIGINAL still belongs to the interface implementation (or object)."
What does this mean?
Hello everyone
|
|
|
|
|
hi i have buy.asp page i want to make new like it in asp.net with c#:
this is my buy.asp
<% Dim MyObj
Set MyObj = Server.CreateObject("e24PaymentPipe.e24PaymentPipe.1")
MyObj.WebAddress = "e24cert.beeebank.com/burgan"
MyObj.PortStr = "443"
MyObj.ID = "9999"
MyObj.Password = "9091"
MyObj.Action = "1"
MyObj.Cardtype = "DEBIT"
MyObj.Amt = Session("Amount")
MyObj.ResponseURL="https://localhost/response.asp"
MyObj.TrackId = "111111"
MyObj.Udf1 = "UDF1"
MyObj.Udf2 = "UDF2"
MyObj.Udf3 = "UDF3"
MyObj.Udf4 = "UDF4"
MyObj.Udf5 = "UDF5"
Dim PaymentURL,PaymentID
Dim varRawResponse,varErrorMsg
TransVal = MyObj.PerformTransaction 'returns 0 for succes -1 for failure
varRawResponse = MyObj.RawResponse
PaymentURL = MyObj.PaymentPage
'PaymentID = MyObj.PaymentId
Response.Write("" )
%>
this asp page use an activex dll
now in my asp.net i add referance to this dll after regesterd in windows (is it enugh to use in .net ?)
and i tried to convert moc.asp to asp.net one (in c#) as the following:
e24PaymentPipeLib.e24PaymentPipeCtlClass s = new e24PaymentPipeLib.e24PaymentPipeCtlClass();
s.WebAddress = "e24cert.beeebank.com/burgan";
s.PortStr = "443";
s.ID = "9999";
s.Password = "9091";
s.Action = "1";
s.Cardtype = "DEBIT";
s.Amt = "10.000"; // as try
s.ResponseUrl = "https://localhost/response.aspx";
s.TrackId = "111111";
s.Udf1 = "UDF1";
s.Udf2 = "UDF2";
s.Udf3 = "UDF3";
s.Udf4 = "UDF4";
s.Udf5 = "UDF5";
short x = s.PerformTransaction();
Label3.Text = x.ToString() ;
string PaymentURL,PaymentID,varRawResponse,varErrorMsg;
varRawResponse = s.RawResponse;
PaymentURL = s.PaymentPage;
PaymentID = "49876255444";
varErrorMsg = s.ErrorMsg;
Label8.Text = varErrorMsg;
Response.Write("" ) ;
but it still not working
note: if you looking to :
Response.Write("" ) ;
the PaymentURL give me my page not the Payment page
please help me thanks all
mark
|
|
|
|
|
I have 2 interfaces that reference each other (A & B) and the MIDL compiler is not happy...
in A's header file...
__interface IA : IDispatch<br />
{<br />
[id(1), helpstring("")] HRESULT func([in] IB* pB);<br />
};
in B's header file...
__interface IB : IDispatch<br />
{<br />
[id(1), helpstring("")] HRESULT func([in] IB* pB);<br />
};
if i don't forward declare the interfaces I get a C++ syntax error
if i forward declare the interfaces with the __interface keyword, I get:
error MIDL2025 : syntax error : expecting a type specification near "IImageHSV"
if i forward declare the interfaces with the interface keyword, I get:
error MIDL2003 : redefinition : IImageHSV
Any suggestions much appreciated
|
|
|
|
|
Try using a different ID.
Kuphryn
|
|
|
|
|
You mean a different GUID? Can a forward declaration have a GUID? Don't think so...
Why isn't everyone having this problem ?
|
|
|
|
|
I do that all the time
[uuid(...
]
library MyCoolLib
{
interface IB;
[ object, uuid(...),dual...]
interface IA : IDispatch
{
[id(1), helpstring("")] HRESULT func([in] IB* pB);
};
[ object, uuid(...),dual...]
interface IB : IDispatch
{
[id(1), helpstring("")] HRESULT func([in] IA* pB);
};
|
|
|
|
|
I'm using the ATL Wizard in VS.NET which puts the IDL and C++ in the same file, so I have to use the __interface keyword, which I think is the problem because the MIDL compiler doesn't recognize the forward declaration using __interface. Maybe. Arrghh.
|
|
|
|
|
I am facing the same problem and have not able to find out any solution yet. I tried inserting interface declaration statements in IDL file using "cpp_quote" attribute also but that does not work even (it inserts the line including "cpp_quote"
Rowan, have you been able to find out any solution yet. If you had already, do post it... it would be a great help !
Thanx & Regards,
Arun.
|
|
|
|
|
Alas I've given up trying - but I'll remember to put it here if I ever fix it
|
|
|
|
|
I am working on developing a test application in java. I use java for UI only. I use JNI to communicate with a VC MFC DLL. I launch an IE browser instance in one JNI method (init()), which works fine.
OleInitialize(NULL);
CLSID clsid;
CLSIDFromProgID(OLESTR("InternetExplorer.Application"), &clsid);
HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IWebBrowser2, (void**)&m_spBrowser);
I store the browser pointer (IWebBrowser2 *) as a C++ class instance variable. BTW, I start a
thread on the native side (_beginthread) which in turn calls the method that launches the browser.
Previously I was facing the problem of marshalling, the IWebBrowser2 pointer was getting correupted, when used in different methods (even the simple properties of IWebBrowser2 (like IWebBrowser2::fullname) were not accessible). So now I have added the code of marshalling after the browser is launched. In almost all the other methods, I first unmarshall the interface and then marshall it back at the end of it. This solved my earlier mentioned problem.
void CIECanvas::MarshallInterface()
{
HRESULT hr;
if(SUCCEEDED(hr = ::CreateStreamOnHGlobal(NULL, TRUE, &pstm)))
{
LARGE_INTEGER bZero = {0, 0};
pstm->Seek(bZero, STREAM_SEEK_SET, NULL);
if(SUCCEEDED(::CoMarshalInterface(pstm, IID_IWebBrowser2, m_spBrowser, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL)))
{
pstm->Seek(bZero, STREAM_SEEK_SET, NULL);
}
}
}
void CIECanvas::UnmarshallInterface()
{
LARGE_INTEGER bZero = {0, 0};
pstm->Seek(bZero, STREAM_SEEK_SET, NULL);
HRESULT hr = ::CoUnmarshalInterface(pstm, IID_IWebBrowser2, (void**)&m_spBrowser);
if(FAILED(hr))
{
showMessageBox("CIECanvas::UnmarshallInterface()", "%s %ld", "FAILED. ERROR CODE = ", GetLastError());
}
}
Then for recording I use AfxConnectionAdvise(), which is working fine.
The problem I am facing is in Replaying the events.
1)The VM crashes with a hotspot error, when on the first page some link click event is present, which loads a new page. One observation here is the VM crashes after onBeforeNavigate2 or TitleChange events are fired.
2)I also tried Yahoo's registration page (having a lot of dropdowns and checkboxes), it works fine for the first few events, but then the VM crashes.
My questions are
1)Does IE handle the events like page loading (tiltle change etc.) and click on some link in different threads? How are the events handled (any useful info on this)?
2)How should I fix the problem?
3)Is it related to marshalling of IE COM pointers?
Please replay ASAP,
Nikhil
|
|
|
|
|