|
i do mine as an NT service
then run the exe with "/service"
eg. fromthe command line
"mynewdcom.exe /service"
bryce
|
|
|
|
|
Hi
I wrote a component and wanted to access it on remote machine.how to accomplish this?How can I register that component?Do I need to register that exe on both machines?Then How to register and call that component?(using DCOM)
Please help me
Thank you
Sai
|
|
|
|
|
run the exe as with "/service" onthe machine which you want to use as the server
you can connect to it (assuming you have the permissions set etc)
by using CoCreateInstanceEx
see the dcom articles here on codeproject
bryce
|
|
|
|
|
Hello all,
I'm using BeforeNavigate2 event to get the Post data as per MSDN article:
HOWTO: Handle Data from a Post Form When Hosting WebBrowser Control (Q256195)
But I'm unable to get the the BSTRs from the Post Data SAFEARRAY.
Here's my BHO's Invoke implementation:
if (dispidMember ==DISPID_BEFORENAVIGATE2)
{
if(pDispParams->rgvarg[1].vt==(VT_BYREF|VT_VARIANT) && pDispParams->rgvarg[2].vt ==(VT_BYREF|VT_VARIANT) && pDispParams->rgvarg[2].pvarVal->vt!=VT_EMPTY)
{
ATLTRACE("\nGetting POST Info");
CComBSTR szTemp,szPostData;
long plLbound, plUbound;
CComVariant varHeaders(*pDispParams->rgvarg[1].pvarVal);
varHeaders.ChangeType(VT_BSTR);
CString strHeaders(OLE2T(varHeaders.bstrVal));
//got the header data
CComVariant var(*pDispParams->rgvarg[2].pvarVal);
SAFEARRAY *psa=NULL;
psa= var.parray;
SafeArrayAccessData(psa , (LPVOID*)&szTemp);
//next two lines yields an Unhandled
//Exception when there is valid Post data??
// SafeArrayGetLBound(psa , 1, &plLbound);
// SafeArrayGetUBound(psa , 1, &plUbound);
CComBSTR str;
szTemp.CopyTo(&szPostData);
SafeArrayUnaccessData(psa);
ATLTRACE(OLE2T(szPostData));
//output always ""
}
}
Dunno what is going wrong. DO I need to preallocate a SAFEARRAY?
My Postdata html pages are nothing out-of-the-ordinary.Just a simple textbox that passes a string thru HTTP POST.
Any help will be great.
TIA.
#define MOSTLY_LEAN_AND_MEAN
|
|
|
|
|
Can anyone point me towards the part of the Outlook object model, where I can find the number of new emails in a folder-
Regards
Ben
Vacancy for signature; Apply within.
|
|
|
|
|
Ben,
the microsoft knowledge base article Q171603 shows an example on how to get
the unread message count of an outlook folder. Hope this helps.
Alwin
|
|
|
|
|
I'm trying to return a COM object, example:
Object *po;
CreateInstance(&po);
void getObject(IUnknown *pVal)
{
pVal = po;
// OR I even tried this, but it does not work.
po->QueryInstance(pVal);
}
I get a NULL pointer at the calling method.
Thanks in advance.
Ken
|
|
|
|
|
I do not have enough information to answer your question. I don't really know what your question is.
Is Object *po; a global variable?
What is CreateInstance? Where is it called.
When you mention po->QueryInstance , do you mean QueryInterface?
If you can give me a little more information, I will try to help you.
Checkout my Guide to Win32 Paint for Intermediates
|
|
|
|
|
As kilowatt said your code is not clear,but I know one thing,You have to type cast the IUnknown interface to your proper interface.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
I have a function in my COM object, written on C++ Foo(int *retval1, int *retval2) . All I need now is to call this from VB. But something wrong goes here. VB says "ByRef type mismatch". What type of parameters should I have in my C++ function, to make it available for VB?
I need to return some values in those parameters. It is simple integers, but how to declare it?
Philip Patrick
Web-site: www.saintopatrick.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Just guess:
You don't need to change your C++ functions.In your VB code use CInt
this is from MSDN:
Dim MyDouble, MyInt
MyDouble = 2345.5678 ' MyDouble is a Double.
MyInt = CInt(MyDouble) ' MyInt contains 2346.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Yeah, found it too. The problem was *laughs* I dunno why, but VB treats Long and Integer as a different types, and int in C++ is actually Long in VB.... I'd say this is very strange, don't see any logic, lol
Philip Patrick
Web-site: www.saintopatrick.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Hi, Mazdak:
I am still some confused about how to access object from other objects.
For example, I want to biuld two objects, one is used to access database ( some private variables such as _connentionPtr _CommandPtr were used), another used to implement rules. But how to realize it. How to pass pointer such as _ConnectionPtr, _CommandPtr from data access object to rules realization object.
If you are convinient, can you send me some examples by email. I am a new learner and find it is very difficult to find such exmaples in website.
Thank you very much for your consideration.
Qiang
|
|
|
|
|
chq12 wrote:
another used to implement rules. But how to realize it.
Sorry,what do you mean by rules?
I have sample code that work with ADO objects in a COM object,and pass from client to server.Yuo can tell me your email to send it for you.
If you want to use first COM object in second one use CreateInstance() in the Method you to use it and create first object in second one and here you can access to Methods and properties of first object.Imagine second COM object as a simple client application and first one is a regular COM onject.
You can pass _ConnectionPtr,_CommandPtr as parameter I don't THINK there is limitation for it,whats your problem for that?
Again use CreateInstance() to initialize them and pass it to COM object.In my application I pass strings to COM object and use those strings for _ConnectionPtr or _CommandPtr ,I think this really safer and better than passig the _ConnectionPtr and _CommandPtr themselves. I think its waste time and codes to create two object and use one for only pass those objects,you can pass simple strings and use them in one object.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Thanks, Mazdak. I think I can use parameter to transfer _ConnectionPtr and _CommandPtr. I want to this because i want to create a database access object which including method to get conncetion with database and some common used method such as create a parameter,then other objects can access it to get connection with database. So it is much easier to extend program and mantain it.
My email address is: dav258@hotmail.com, I am a new learner and want to get some examples. if you are convinent, please send me your sample code to me.
Thanks again.
Qiang
|
|
|
|
|
dear someone,
I wrote a ActiveX Server Component using ATL in VC6. It was meant for and intranet mailing system and was supposed to read and write my own email files(.eml).
When I test the COMp using an MFC exe, everything works fine..., but when I test the same with ASP script, it works fine for the first 2 times. Then the web service is stopped and the Management Console gets frozen.
I tried using the CCriticalSection's lock and unlock.
I also tried by terminating the FILE I/O in the OnEndPage function.
The same component works fine if I am not letting it to read or write to any FILE.
As I am a novice in COM, I would like to know how and where exaclty the problem is....
Please help me sort out this problem at the earliest...n' i'LL BE VERY GRATEFUL TO YOU
hAmMeR tHe MaDdOg
tHe pArAnOiDaL pRogRaMmEr
|
|
|
|
|
I also tried the ATL, ASP Component for Search Engine in that i had experience that ATL Component is not freeing the memory after using it in ASP Script.
So as many times you use component it is unable to free memory although your OnStartPage and OnEndPage works happily.
For that check out the TaskManager in that dllhost or inetinfo.exe takes lot of memory.
ravi
|
|
|
|
|
Looking for a good book on COM. The ideal book would be on a slightly higher level than Inside COM (Rogerson) and would give a thorough description of the apartment models and marshalling. It would also be nice with something on COM with ATL (another book?).
Thought about Inside OLE 2 (Brookschmidt). Is that one still of immediate interest?
Any suggestions appreciated.
Thanks
/moliate
|
|
|
|
|
Definitely, Learning Dcom from OReilly is what you want, very good explainations of com apartment models, marshaling , pure com and MFC and ATL programming, after thisyou can try the atl books.
Check my aswer to Nish about the other books that I recommend:
http://www.codeproject.com/lounge.asp?forumid=1159&select=96575&tid=96534#xx96575xx">http://www.codeproject.com/lounge.asp?forumid=1159&select=96575&tid=96534#xx96575xx
Learning Dcom amazon link
Note1: Don't consider the bad reviews, are just no sense, the book is good , it's easier to understand than the bible on COM "Essential COM" by Don Box.
I own 8+/- books on COM and ATL and I assure you for what you are asking you are not going to be disappointed !
Cheers,
Cheers,
Joao Vaz
|
|
|
|
|
Thank you for your recommendation!
Got the book today and it looks good. Also a reasonable price - you really saved me some money today...
/moliate
|
|
|
|
|
How can I find out who is calling my VC++ DCOM object?
It is running as a service logged on as a local user.
Still a newbee!
|
|
|
|
|
I have a C++ dll that interfaces with a main VB program. This VB program always has an ADO connection open. The dll also needs to use a connection to the same database.
How can I pass the open ADO connection from VB to the c++ dll (through COM) so i can use the connection in c++?
Cheers,
Dave
|
|
|
|
|
Anonymous wrote:
I have a C++ dll that interfaces with a main VB program
What is that dll? Is that one of standard dll's like msado15.dll or you wrote it yourself?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
I wrote the dll myself, it has a specific (and time consuming) processing task, that the VB program utilises.
-dave
|
|
|
|
|
ADO connection is an string.you can pass it as simple string to your dll,But all of it depends on how you implement yout methods.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|