15,886,199 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by ExcellentOrg (Top 3 by date)
ExcellentOrg
28-Sep-13 6:52am
View
The COM Library
[
^
]
Second para at the above link reads ....
Implementation-locator services through which COM determines, from a unique class identifier (CLSID), which server implements that class and where that server is located. This service includes support for a
level of indirection
, usually a system registry, between the identity of an object class and the packaging of the implementation
so that clients are independent of the packaging
, which can change in the future.
Am I correct in interpretation that in this particular context of mine, I am trying to bypass this indirection and allow client to decide the server is going to be?
ExcellentOrg
28-Sep-13 5:01am
View
David,
Yes!, It is on same machine and it is safe to assume that it will always run on the same machine. I did take a look at the URL you gave. it does not have "SystemHandleInformation" but it does have SystemProcessInformation which returns array containing Process information. Following is the code snippet that works correctly as long as only one instance is running.
private Object AccessCOMServer(String nameOfExecutable, String COMProgID)
{
Process[] proc = Process.GetProcessesByName(nameOfExecutable);
if (proc.Length == 1)
{
Type dataAppProgID = Type.GetTypeFromProgID(COMProgID);
_dataApp = Activator.CreateInstance(dataAppProgID);
String currentPath = _dataApp.GetType().InvokeMember("DatabasePath", BindingFlags.GetProperty, null, _dataApp, null).ToString();
}
}
Debugger shows
proc[0] is shown in debugger as instance of System.Diagnostics.Process with all information including process id, name of executable, path of executable and even command line arguments that were used to invoke it.
dataAppProgID is shown as instance of System.RuntimeType with many properties and assembly that originates from is shown as mscorlib
_dataApp as System.__ComObject with only visible properties Identity and m_ObjectToDataMap (Hashtable) as null
but all invoke
Even I use the second suggestion of using CreateProcess, it will execute the new instance all right and connected to correct database but how do I get the COM server to bind to correct running process.
Entire problem revolves around my limited understanding of Activator.CreateInstance which as 13 overloads and some of them do accept things like assembly domain, but Process object does not expose assembly's appdomain.
ExcellentOrg
28-Sep-13 4:06am
View
Sergey
I did not decide what 3rd party C++ app uses. I know it is C++ because I happened to get a chance to talk to one of its developer. It is a very good application (probably best in its class). It is certainly good at what it does and it provides access to its data thru COM (which maybe obsolete), is efficient. Moreover from my POV and user's POV, cost of acquiring the s/w; learning its usage is already invested, so why chase a new horse and spend unnecessary moolah?