|
Use CoCreateInstanceEx and pass it the machine name selected.
|
|
|
|
|
Thats great!
Thanks Mark.
|
|
|
|
|
Hi all,
I have a few (possibly nieve) questions regarding the efficiency of calls to in proc COM methods vs. standard C++ function calls.
I've inherited a project which had a master computer delegating some functionality to a few clients, using DCOM. We are now implementing all functionality in one monolithic app. The way I see it I have two options; either use the original COM dll's and invoke them as INPROC_SERVERs, or rip out the non-COM parts of the dll code and put it into C++ classes in my main app.
It would be easier to just use the dll's as they are - they work just fine, but I'm concerned about the efficency aspect. My app will be invoking methods in the order of 100 calls per second.
I would like to know some opinions as to what kind of performance hit I can expect in using COM vs. standard C++ function calls.
As I said, I have very little knowledge of COM, so this could be a rather dumb question
Any advice would be really appreciated.
TIA,
Pete
|
|
|
|
|
If you already have the interface in question, then COM is just like calling any virtual function.
Well, that is unless you are talking about invoking methods via IDispatch.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
>If you already have the interface in question, then COM is just like calling any virtual function
True only if calls are made within the same com apartment, otherwise they will be marshalled
|
|
|
|
|
i am doing a visual c++ poject.the project involves 3 menus.i have the main dialog box with 2 buttons which represent selections one can make by clicking.if one option is clicked i want to know how to call another dialog box which has the operations i want to carry out.please help me i am in need of it.or you can tell me the website to go to which has the information
jinguri
|
|
|
|
|
Your question is in your COM forum,Do you use MFC or ATL?
shingai wrote:
if one option is clicked i want to know how to call another dialog box which has the operations i want to carry out
You can create two different dialog box,and in each event handler of buttons create on of them.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
So if you use MFC,with dialog editor create two different dialog and in each button handler create one like this:
CYourDialg1 adlg;
adlg.DoModal();
IN another one:
CYourDialog2 adlg;
adlg.DoModal();
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
My equipment:
Workstation:
Win2k Prof. OS
Visual C++ 6.0
Platform SDK November 2001
Server:
Win2k Server OS
Name: iras
Domain: htlpinkafeld.at
TestUser: testuser@htlpinkafeld.at
Password: none
My Problem:
Let's imagine a user at the workstation wants to set up a connection with the server. The user double clicks the server icon and he will be asked for an username and password. He enters testuser@htlpinkafeld.at and no password. He will get connected and everything is fine. Ok.
I do this whole stuff in my program with the following function:
WNetAddConnection2(...); Well it works!
The disadvantage is that only one user can be connected to the server at the
same time. I found out that every process which trys to work with the server after the connection is established has to use this connection and not a other connection else because there can only one connection at a time. But i have heard that this could be handled with COM Interfaces. I am not a beginner with programming COM Interfaces but i can't find out how this can be done!!
What i want is to get access to the server with more than user at the same time!!!! It is possible but how ?????
Please help me!
|
|
|
|
|
Can I use the OLECMDID_SAVEAS without prompting the user?
How can i submit the path to store the webpage on the disk to this function?
|
|
|
|
|
I'm just learning ATL COM and I'm trying to wrap my head around the world of strings. I'd appreciate any form of help anybody can spare.
For example, I have a class and I want to give it a private data member that will hold string data. Like a "FirstName" or "LastName". When using COM, what data type should be used for this purpose? Should I use a BSTR or some other string type?
class CMyType {
//lots of other ATL stuff
private:
BSTR firstName;
};
Is this ok to do or should I be keeping string data in some other format? Do I need to do anything to make sure the BSTR data gets cleaned up correctly?
To extend this question a bit, is there such a thing as "Best Practices for Win32 strings"? As in, when should one use (or better yet, NOT use) one string type in favor of another? Since my C++ experience is nearly all in "vanilla" C++, I've always used STL strings, but I'm seeing that STL strings just don't cut it in Win32...
Thanks for the help!
|
|
|
|
|
BSTR strings are a special type of string. Even though they look like UNICODE strings, they have to be managed using the ::SysFreeString, ::SysAllocString, etc routines.
So, in your destructor, don't forget to call ::SysFreeString.
You can also use CComBSTR (spelling??) to manage the BSTR.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I tried using CComBSTRs in my class but I had some strange things happening when I did that made me switch back to straight BSTRs. When I accessed the property the CComBSTRs were storing the first time from a skeleton VB project, they worked great. Any subsequent attempts to get the property only returned an empty string (""). Not sure what was going on there. Any thoughts?
Also, is there a way to test if a BSTR has been allocated before calling ::SysFreeString() on a BSTR? Or, can you safely call ::SysFreeString() on a BSTR that hasn't been ::SysAllocString()'d yet?
|
|
|
|
|
First, when you were returning your CComBSTR to the VB app, were you making a copy of the string? If not, then the VB very well could have been deallocating the string.
You should set your pointer to NULL when it isn't pointing to an allocated string. Thus in your destructor you can check for NULL to see if you need to free it. Otherwise, you might try to free someone else's memory or invalid memory and crash the program.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Also You can use bstr_t ,it is very easier to use
it.It doesn't need to use SysAllocString() and SysFreeeString() for it.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hello gurus,
I want to connect to the events of a custom browser that basically hosts IE webbrowser control, from my application. After the user launches the custom browser,I want to be able to detect events like OnNavigate,DocumentComplete etc. How can this be done? Would appreciate any help, ideas and code.
TIA.
#define MOSTLY_LEAN_AND_MEAN
|
|
|
|
|
Connect to the WebBrowser control events. Here is a sample : http://msdn.microsoft.com/library/en-us/dnwebgen/html/bho.asp?frame=true#bho_getevents
|
|
|
|
|
Will third party browsers load a BHO too?
#define MOSTLY_LEAN_AND_MEAN
|
|
|
|
|
Help me. !I have an exercise:
Build an Active X that allow communicate with COM Ports:
-Allow user choosing port (COM1, COM2, COM3, COM4)
-Allow setting parameters: speed, parity, data bit, stop bit…
-Have methods: Open, Close, Flush ports
-Have method: Send & Receive data (char or string) through ports
-Allow setting time for end of transfer data (time-out transfer)
-Allow setting time for testing port (loop-back tested time)
-Auto enabled when there's an event from ports.
Can you help me ! (I use VC++)
Hung Son
Hung Son
|
|
|
|
|
Hi ,
Can someone tell me how to use MFC classes, like
CPropertySheet in ATL EXE.
Thanks,
Sansky
God is Good, all the Time.
All the Time, God is Good.
|
|
|
|
|
There's such a function in VBScript as TypeName which returns the coclass name of the passed object.
How to do the same using:
- JScript
- Compiler COM Support Classes (C++)
- API (C++)
?
tx
(H) Serge
|
|
|
|
|
TypeName return the type of the variant which was passed as argument. To do the same in C++ check the vt member of the VARIANT data ( it can be VT_BSTR, VT_I4, VT_BOOL, etc)
|
|
|
|
|
Hi,
When i try to access IADsWInNTSystemInfo interface, i am getting "undeclared
identifer" error. I have included the Iads.h file, but the file doesn't contain
the interface. Where will i get the latest header file. Anbody help??
Thanx,
Sangeetha.
|
|
|
|
|
I would look in the different versions of Platform SDK.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
The version which i downloaded from Microsoft site is ADSI SDK version 2.5. I am not able to find any updates or fixes. Please do keep me posted on this.
Thanx,
Sangeetha.
|
|
|
|