|
I have solved the problem with using DirectShowLib ,newer version of the API.
Now everything works fine!
|
|
|
|
|
Hi guys,
working with some closed-code client/server application - the client reaches the server using a COM object thats defined by a InprocServer32 DLL - I would like to split client and server to different machines.
DCOM at first sight cannot do it - as the COM is a InprocServer32 DLL (for remoting a LocalServer32 COM - EXE seems to be necessary - Racmgr32 only lists these COM class entries).
My first thought was to code a InprocServer32 COM EXE that provides the same classes like the InprocServer32 DLL does. After I would generate the TLB of the DLL an generate a InprocServer32 DLL that has the same classes and interfaces, but just calls the LocalServer32 EXE - which after could be remotely used by help of DCOM. I guess this has do be done because if I just deleted the InprocServer32 class entry, the current creating method in my client-EXE would not be able to deal with the LocalServer32 COM class anymore.
My question now is - would You guys do it the same way? Does anyone know a way how to make a InprocServer32 DLL being usable remotely - for example by hooking up CreateDispatch? If I would do it the way I described - does anyone see problems or shortcomings? I am thankful for every articles and informations You drop!
Thank You very much for Your ideas, thoughts and replies!
Tiger
|
|
|
|
|
A good online reference for COM programming is: Inside COM+[^], it covers alot of the same information as does Don Box's "Essential COM".
After reading your post several times (I found it a little confusing), I'm wondering: what your logic is for wanting to have your COM objects remoted from another machine, to a Local out-of-process server, and then to an in-process DLL server? Is this some kind of security scheme, or is it just not understanding the basic architecture of COM?
Also, this wasn't clear from your post: are you writing all three COM components yourself? Or, is the InprocServer32 DLL already compiled, and is a dependency for your client project?
An In-Proc server ALWAYS must be a DLL. The COM Library uses the registry entries for the COM CoClass along with the parameters the client provides when instantiating, using either CoCreateInstanceEx, or DllGetClassObject, as the case may be, to determine exactly how to configure the COM Server. It's actually more complicated than that.
Here are some of the relavant chapters from the above cited book:
Chapter Two, The Client, CoCreateInstanceEx[^]
Chapter Four: Apartments[^]
Chapter Thirteen, Executable Components[^]
Chapter Fifteen, Standard Marshaling[^]
And, of course, the one aspect of COM that mystifies everyone, Chapter Eighteen, Security[^]
Chapter Ninteen, The Network Protocol[^], is also very informative.
In answer to your original question, though, I would start out configuring my COM server to be as simple as possible, unless you have overriding security concerns. If you read Chapter Thirteen, you will see that much of the reason for creating an Out-of-Process Server instead of an In-Proc Server, is to control the actual number of COM objects being accessed simultaneously by separate client applications.
|
|
|
|
|
Hi Baltoro,
thank You for all that useful information - I am sure these links will push my project forward.
As I re-read my article, I agree with You that it's not written that clear - so I'd like to explain it more straight:
A company that quit business a while ago sold us some server application together with a client and an API to also write Your own clients to that server. All programs are compiled and I have no source - the only thing I got is a very detailed API documentation, a InProc32 COM DLL and it's includes for C++ projects. All was provided for use with Visual C++ 6.0.
The current situation is, that the server app runs together with the provided client app on workstation machines, and at night a client appwritten by me (using their API) queries the data and stores it in a central server with raid structure.
The provided server app accepts as many connections as I want (through the API-DLL-COM-Inproc32). Our bottleneck is currently the sync of all databases at night, we would like this to happen realtime. Instead of doing syncs several times a day, I would like to split the provided client and server from running together on one workstation. After the client should run on the desktop PC till API inproc32. There I would like to put sth. in between to lead the API calls through DCOM or TCP to a RAID server running the provided server app that would respond.
With DCOM it could be done like this:
-------------- Workstation ---------------------------
Client app -> Inproc32-FakerDLL -> DCOM |
------------------------------------------------------
Machine-boundary
------------- Server -------------------------------------------
| DCOM -> ActiveX-Exe -> Inproc32-DLL -> Server app
----------------------------------------------------------------
As I got no sources, I would create a fake Inproc32 COM DLL from the original API's ILD file.
Then a ActiveX exe providing DCOM support encapsulation the Inproc32 DLL running on server machine.
Now the fake Inproc32 DLL would forward through DCOM to that ActiveX-Exe-DCOM provider which would do the real calls to Inproc32-real-API-DLL on our RAID-server.
Again in other words:
What I try to do is split on a known COM-Inproc32-API and put client app and server app on different machines. Problem is - I got a ready-to-use client app that I cannot modify (compiled) and a server app that is compiled, too.
The question remaining is - is there a more elegant way without the need to writing a ActiveX-Exe that provides the COM-class of the inproc32-API for DCOM on the server machine - and a kind of fake/proxy DLL that forwards to this DCOM-ActiveX-Exe from client machines (to leave all clients-apps loading their Inproc32 DLL)? All is just for splitting server app and client app to different machines...
Let me add that we already verified - there is no license problem by doing what I try to.
Thank You very much for all Your support - I am reading the articles already!
Have a good time!
modified on Monday, August 3, 2009 9:53 AM
|
|
|
|
|
sdk_tiger,
(I'm assuming you have a sense of humor.)
See, now that second post makes it all clear,...and, by the way, I would never have suspected all that from your original post, except that you were leaving out some important details. WOW!
This sounds like something right out of SWORDFISH (2001 movie)[^]. Had you actually posted that last post originally, my response would have been:
DYH 6GJY!! BGOOC265RTG, HEY DFWQAQ!! LL8U YHJ IIRFDB, OK POQQVC47. !W! KKL: FGTMVX KPSSV QQFYHC!! 4547.0058875
(Warning, this repsonse is encrytped. By Extra-Terrestrials. It just looks like gibberish!)
OK, all kidding aside,...why would you even run this software? You have NO IDEA what it really does. Always require that the source code be availiable. Otherwise, how do you verify it's operation? What are your security requirements? I'm assuming there aren't any.
I REALLY don't know what to suggest. To me, the entire concept is implausible. I would start over and write the entire component suite from the beginning, so that I had the complete source, so that I could (1) configure diagnostic routines, if necessary, and (2) verify that it operates correctly and securily, or, can be conveniently upgraded.
|
|
|
|
|
I'm writing an application where I automate word. When the user saves the document, I need to also export it to a different format, so I have to somehow be notified when the user is saving, preferably before any saving has started.
My code for creating the Word instance is
CoInitialize(NULL);
CApplication app;
app.CreateDispatch(_T("Word.Application"));
CDocuments docs;
docs.AttachDispatch(app.get_Documents());
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
When I read the codeguru article they said that the events listed there - Startup, Quit, DocumentChange, New, Open, Close are the only events that can be captured (at least for word97 for which the article was written), and Save is not among them.
The microsoft article also seems to be written for Word2000 and above, but I would like to support also Word97.
There might be an easier way, though - using VBA macros. I found out about that while googling to find more info about the problem. It works like this - if you create a macro named FileSave this macro gets executed *instead* of the normal File->Save operation. Likewise for FileSaveAs. I tested that and it really works, I already created a *.dot file which contains those macros, and that works in Word97, too.
But there's a catch - I don't know how to load the macros in the *.dot file through automation. Do you have any ideas about that?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi,
i'm listing database records in grid my application environment is asp.net with C# and oracle database.after open the record,i have to implement the page navigation inside the page.i'm searching from long time how to provide the navigation to previous/next pages which are available in grid.(i.e in gmail inside the email right upper corner of email one link will be there displays the selected email num - total email count and hyperlinks along with that to navigate.based on our click on tht link it would be show the page either previous/next with out going back to inbox).how to implement this feature with out hitting the database.can u provide any sample.
with regards,
krishna
|
|
|
|
|
Hey all,
I am using the WIA 2.0 library in VB.NET to scan documents through the document feeder. I have been researching for hours just trying to figure out how to make the scanner use the document feeder instead of the glass. Could anybody please help me here. I found out that I should change the property 3088 (which is WIA_DPS_DOCUMENT_HANDLING_SELECT) to 1 instead of 2.
1 being for feeder and 2 being for flatbed. However, when I do a transfer my Canon MX330 still attempts to use the flatbed. Can anybody give me some direction here? Thanks for your time and help in advance.
Justin | CodeBase25
"Instant programmer, just add coffee"
|
|
|
|
|
Hi all,
I got into the problem where I have to inherit a COM class/object with another COM class/object. Actually I am creating a component for for reading/writting CAD entities so I have many entities with common properties so, for all the general properties I have to write the property functions in each COM class which is just duplication of code so, I just wanted to create a template base class that will have the set of properties & using which I can make the code reusable.
Structure of my component is as follows
Document has Entites has Entity information
Please suggest me what to do in this situation.
Regards,
Pankaj Sachdeva
There is no future lies in any job but future lies in the person who holds the job
|
|
|
|
|
Hi,
Please let me know that you using COM class / simple class file & export the tlb file using RegAsm command...
Don't forget to click "Good Answer" on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|
Have you looked into aggregation?
|
|
|
|
|
I have gotten to the point in my code where I have a variant type 8204 (which may be a safearray of bstr's??) Having researched lots of stuff on safearrays and VT_ARRAY, I'm still stuck on how to access this.
_RecordsetPtr ptrRS;
ptrRS = wr->GetData();
_variant_t vtRows = ptrRS->GetRows(adGetRowsRest);
int vt = vtRows.vt;
str3.Format("vt %d", vt);
MessageBox(str3);
How do I index through vtRows and extract each of the bstr to a say CString?
Thanks for all help
Phil
|
|
|
|
|
8204 is equal to VT_ARRAY | VT_VARIANT. The variant contains an array of VARIANTs.
With best wishes,
Vita
|
|
|
|
|
Vita,
thanks for the response.
Thing is, I am still unsure how to actually access the contents of this array.
for example:
_variant_t vRow;
vRow = vtRows[0];
does not compile.
Thanks again
Phil
|
|
|
|
|
Try to use CComSafeArray<VARIANT> to make access to array. And statement to obtain constructor's parameter:
SAFEARRAY *pSA = V_ISBYREF(&vtRows) ? *(V_ARRAYREF(&vtRows)) : V_ARRAY(&vtRows);
With best wishes,
Vita
|
|
|
|
|
hi,
I'hv a BHO built in VC6(ATL/COM) which is needed to create a toolbar button and on buton click i need to use the api UrlDownloadtoFile which is need to download a file to a specific location and called webbrowser.navigate to make it navigate to a specific file
Com works fine in XP but it problem started when it is used in Vista
are these API not supported in Vista or there a updated set of SDK which is need to downloaded to make it work
i have read the inks regarding the Protected Mode Restriction and some other articles related to Intergrity level in Vista but still can't find the solution.
settings for phishing filter and enabled add-ons but still of no use.
BHO dosen't work in either Protected Mode "ON/OFF"
plz Reply if there is a solution(if possible for Protected Mode OFF firstly)
Help Would be greatly Appreciated
Abhishek
|
|
|
|
|
Hi,
If I install a VirtualPC on my Windows Vista OS, does this Virtual OS completely has it's on COM Server funcionality or does it use the COM technique from the original OS?
|
|
|
|
|
gehbitte wrote: does this Virtual OS completely has it's on COM Server funcionality or does it use the COM technique from the original OS?
virtual OS has it's own COM servers - it is completely separate!
Think - the virtual OS could be Linux, with no COM at all!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Hello everyone,
I have written a small test application. The application is splitted into two parts. The first part is written in unmanaged C++ using ATL. It creates a normal window in which a .NET control will be loaded using the class ATL::CAxWindow. Besides two interfaces (IExtensionInfo, ITreeItem) and TreeItem coclass are defined in the library.
The second part is a C# class library containing one UserControl. The C# part references the type library from the part written in C++.
Here is an small overview.
C# Part: class Extension : UserControl, IExtensionInfo
C++ Part:
class CMainWindow
class CTreeitem : ITreeItem
And here is the IDL code for the interfaces.
interface ITreeItem : IDispatch
{
HRESULT AddChild(void);
HRESULT GetChildCount([out,retval] LONG* pChildCount);
};
interface IExtensionInfo : IUnknown
{
HRESULT GetCaption([out, retval] BSTR* caption);
HRESULT SetCaption([in] BSTR caption);
HRESULT Init([in] ITreeItem* ipTreeItem);
HRESULT Unload(void);
};
Now we came to the core part: Creating the C# control and host it in a container; Creating a TreeItem object and passing the interface pointer to the C# part.
When the Init method is not called to pass the interface pointer to the C# control then everything is doing just fine. But when it is called then the application remains in memory after the window is closed.
LRESULT CMainWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
HRESULT hr;
_AtlModule.Lock();
this->m_pCtrlWindow = new CAxWindow();
RECT rect;
this->GetClientRect(&rect);
HWND hControlWindow = this->m_pCtrlWindow->Create(this->m_hWnd, rect, NULL, WS_CHILD | WS_VISIBLE);
IUnknown *pUnknownControl;
hr = this->m_pCtrlWindow->CreateControlEx(L"CsControlInNativeWindow.Extension", NULL, NULL, &pUnknownControl);
this->m_spExtensionInfo = pUnknownControl;
if (pUnknownControl)
{
pUnknownControl->Release();
}
this->m_spTreeItem.CoCreateInstance(CLSID_TreeItem);
this->m_spExtensionInfo->Init(this->m_spTreeItem);
return 0;
}
LRESULT CMainWindow::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (this->m_spTreeItem)
{
this->m_spTreeItem.Release();
}
if (this->m_spExtensionInfo)
{
this->m_spExtensionInfo->Unload();
this->m_spExtensionInfo.Release();
}
if (this->m_pCtrlWindow)
{
this->m_pCtrlWindow->DestroyWindow();
delete this->m_pCtrlWindow;
this->m_pCtrlWindow = NULL;
}
_AtlModule.Unlock();
return 0;
}
I hope someone can tell me how I can make that the application shuts down.
Best regards.
|
|
|
|
|
Hi all,
I am developing an online dictionary using asp.net 3.5, C# and SQL SERVER; I want to add speech capability to this application. now I found "Interop.HTTSLib.dll" suitable for this, but there is a problem: this application works fine locally but does not work in a remote host and I get this error: " Retrieving the COM class factory for component with CLSID {2398E32F-5C6E-11D1-8C65-0060081841DE} failed due to the following error: 80040154."
Does the kind of server(x86 or x64, 32bit or 64bit) make this problem or asp.net authorization is the main reason? I am using www.aspspider .com (free asp.net hosting) as my host.
Here is my C# code:
protected void Button1_Click(object sender, EventArgs e)
{
string temp = TextBox1.Text.Trim();
HTTSLib.TextToSpeechClass speech = new HTTSLib.TextToSpeechClass();
speech.Speak(temp);
}
Finally how I can fix this problem, I am really thankful for any help.
|
|
|
|
|
That error == REGDB_E_CLASSNOTREG - see what it says about it in CoCreateInstance[^].
Is your test-to-speech library installed into the remote host?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
When you perform speech.Speak on your local machine, does it just play the audio directly? Have you got a second PC you can test from (connect to the web server on your main PC using a browser on another PC) - try again - does the sound play from the PC running the server?
If you try and use this on a real server, you'll be trying to play the audio on the server side, which probably doesn't even have a sound card installed. You'll need a text to speech engine that outputs to an audio file which you can stream to the client instead.
|
|
|
|
|