|
The detail is in the following:
Case 1:
1. Create a ATL Project in VS .Net
2. Add Class (ATL Simple Object) to the ATL Project.
3. Add a method [STDMETHODIMP CTestDll::Add(DOUBLE x, DOUBLE y, DOUBLE* result)]
4. Build it
The result is in the following:
http://slimbody.dyndns.org/Case1.JPG
Case 2The problem happens when i add web reference to the ATL project)
1. Create a ATL Project in VS .Net
2. Add Web Reference
3. Add Class (ATL Simple Object) to the ATL Project.
4. Add a method
[STDMETHODIMP CSessionService::NewSession(BSTR UserID, BSTR PassWd, BSTR IP, BSTR Hostp, BSTR* NewSessionResult, LONG* NewSessionResult_nSizeIs)] <-- Using WebService
5. Build it
The result is in the following:
http://slimbody.dyndns.org/Case2.JPG
The error message is
NtuhWebService error PRJ0019: A tool returned an error code from "Performing registration"
How can i solve this problem?
Thanks ...
|
|
|
|
|
I am new to COM so please be gentle.
I am trying to use COM as follows:
1) I have a client which I would like to load loosely coupled servers.
2) The servers need to be able to handle the following
a) I would like to have a function
HRESULT OnMessage( CSystem * pSys, CMessage * pMsg )
b) I need to be able to use CSystem and CMessage which only exist in the client.
What parts of COM should I use?
I am thinking that besides the basics I will need to use:
1) IDispatch
2) Marshalling ???
Can anyone shed any light or point me to some info?
|
|
|
|
|
smesser wrote:
HRESULT OnMessage( CSystem * pSys, CMessage * pMsg )
Nope. If you pass pointers, they will point to the address space of a different application, and in this case on a different machine. Also, the types which COM can pass are very limited.
You'd need instead to pass the data you need to recreate these classes, and the classes would have to exist in both projects, obviously.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for your response.
I have since decided to use abstract interfaces and abstract factories.
This combination seems to meet my needs without having to deal with COM.
|
|
|
|
|
Christian Graus wrote:
Also, the types which COM can pass are very limited.
That depends entirely on what clients you have. For VBScript clients, you'll have to dumb down your interfaces quite a lot. But with C++ clients, you can do virtually anything. All you have to do is play nice with the IDL language, which allows for powerful enough datastructures (structs and unions of arbitrary IDL compatible types). But yeah, you won't be doing any template magic through IDL anytime soon.
[edit]Straight VB handles pretty much everything that C++ does, too.[/edit]
Good music: In my rosary[^]
|
|
|
|
|
I'm trying to change the default tooltip Explorer shows for folders (when the mouse is hovering), using IQueryInfo interface. It works for files (.xxx) but couldn't make it work for folders.
Did anybody do it?
Also, is it possible to modify/subtract items from the Explorer context menu for folders?. I can add items using QueryContextMenu, (albeit not in the desired menu place), but can't delete/modify Explorer's items.
Suggestions will be appreciated.
TIA
alex
alex
|
|
|
|
|
I'm trying to develop an add-in for Outlook Express, the add-in is supposed to intercept sending mails and (optionally) add attachments to the mail being sent.
I have already done that on Microsoft Outlook using Visual Studio Tools for Office, but I couldn't find any way to do it on Outlook Express.
Help would be greatly appreciated, just point me on the way.
Thanks in advance,
Wessam Fathi
|
|
|
|
|
Wessam Fathi wrote:
I'm trying to develop an add-in for Outlook Express, the add-in is supposed to intercept sending mails and (optionally) add attachments to the mail being sent.
Check if this Help :-
http://www.codeproject.com/com/Outlook_Express_Messages.asp[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Is it possible to have two applications, running as seperate processes, in the same window?
Is so, how or can you point me at a good reference source?
Thanks.
|
|
|
|
|
you can use threading. try search you will find lot on it..
|
|
|
|
|
Hi!
I wrote a context menu handler for a program which runs from an usb disk. The program is running fine on my PC, but some of my friends are complaining that as soon as the software is installed in their usb disk and the program is run their context menu goes away...and it gets ok when the unplug the usb disk again....any idea why this would be happening ?
Thanks.
kane
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
Hello code project community, I have following question.
I would like to access a com component ( all the funcitons within the COM component -- that basically access the database on the machine where COM is registered ) registered on a remote machine through a web page. How should i communicate with remote COM component from a web server ?
Scenario : Computer A -- WEB SERVER, computer B -- a client on which a com component is registered and database resides.
I would like to access a COM component from machine A, get result from database through COM object funciton call, and write it to the file on the server ( computer a )??? Any idea??
Can I make a remote call to COM component?
I am thinking that you could do it through .net remoting, but then client needs to run a listner on his/her machine. Another way is that You could have activex object accessing client, but then i need to send result back to server from client. Is there any nice way to send entire object from client browser to server?
Any suggesitons would be very welcome and very much appreciated. Thanks a lot.
Manish
|
|
|
|
|
I am lerning COM and this is as simple as I can get.
Here is my interface.h file
/////////////////////////////////////////////////////
extern "C" const IID IID_IMath;
// {2BD8F185-7D1C-4058-9B98-C29E343E858F}noblk
extern "C" const IID IID_IMath =
{ 0x2bd8f185, 0x7d1c, 0x4058, { 0x9b, 0x98, 0xc2, 0x9e, 0x34, 0x3e, 0x85, 0x8f } };
interface IMath
{
public:
virtual long Add(long n1, long n2) = 0;
virtual long Sub(long n1, long n2) = 0;
};
////////////////////////////////////////////////////
but if I add the math.cpp to my project is gives me the following
error message:
fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.
////////////////////////////////////////////////////////
here's my math.cpp
/////////////////////////////
#include "interface.h"
#include <iostream.h>
class CMath : public IMath
{
public:
CMath();
~CMath();
virtual long Add(long n1, long n2);
virtual long Sub(long n1, long n2);
};
CMath::CMath()
{
cout << "\nCMath Constructor called." << endl;
}
CMath::~CMath()
{
cout << "\n CMath Destructor called" << endl;
}
long CMath::Add(long n1, long n2)
{
return n1 + n2;
}
long CMath::Sub(long n1, long n2)
{
return n1 - n2;
}
I HAVENT BEEN ABLE TO FIND THE SOURCE OF THIS ERROR, Please Help!
Thanks
|
|
|
|
|
correction:
2nd line of math.cpp should read "#include <iostream.h>
|
|
|
|
|
Hi,
I've to develop 3 ActiveX controls.
Server - this will read the data and updates the data continuosly
ClientA - Gets the part of updated data from the server
ClientB - Gets the part of updated data from Server
There can be many instances of ClientA and ClientB and only one insatnce of the server in a contianer.
Can any one suggest me the best design pattern to implement this in VC++ or VB and how to implement this?
Thanks in advance!
VK
|
|
|
|
|
|
Not sure if this answers your question exactly, but here is some generalk information.
ActiveX DLLs and OCXs (which are nothing more than DLLs with a special wrapper) are always loaded into each process that calls them, so you cannot enforce a single instance of a server using either. you need to use an ActiveX EXE instead.
An ActiveX EXE component runs as a single instance by design with no special development on your part. In other words, the first time any client calls an ActiveX EXE, one instance of the server will be created. All additional calls by any number of clients will be handled by the one instance of the ActiveX EXE server that is already running.
The above only applies to the server component itself.
Suppose for example, you have 10 ClientA instances that call Server.EXE and request some class MyServerClass. The first ClientA that calls the Server.EXE will cause a single running instance of Server.EXE to be instantiated. When the remaining 9 ClientA components request a MyServerClass object, ALL of those requests will be serviced by the single instance of Server.EXE already running. BUT you will still have 10 instances of MyServerClass - one for each ClientA request - all being provided by the SINGLE instance of Server.EXE.
Assuming that what you really want is 10 ClientA components that all have a reference to a SINGLE instance of MyServerClass, provided by a SINGLE Server.EXE, then you need to also implement MyServerClass as a Singleton. This is easy to do in C++, a little harder to do (but still possible) in VB.
Do a web search on Singleton and ActiveX EXE and you should find plenty of examples.
Hope this helps.
Robert
|
|
|
|
|
My registry set up as follow:
REGEDIT4
[HKEY_CLASSES_ROOT\CLSID\{A138EF7F-0930-4bc5-B1AC-33E1D0415BEE}]
@="Shell Extension"
[HKEY_CLASSES_ROOT\CLSID\{A138EF7F-0930-4bc5-B1AC-33E1D0415BEE}\InProcServer32]
@="scshellext.dll"
"ThreadingModel"="Apartment"
[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\{A138EF7F-0930-4bc5-B1AC-33E1D0415BEE}]
@="Shell Extension"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
"{A138EF7F-0930-4bc5-B1AC-33E1D0415BEE}"="Shell Extension"
For this setup, any file selection system will call my context menu entry. But select the directory, system will not call. Does any one know how to setup the registry that will cause the system to call the context menu when the directory has selected?
Thank you for the help in advance.
!@#$%^&*()_+
|
|
|
|
|
There is a key for the directory:
[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\{A138EF7F-0930-4bc5-B1AC-33E1D0415BEE}]
@="Shell Extension"
!@#$%^&*()_+
|
|
|
|
|
The usual stuff: register your class, point InprocServer32 to your dll, typeLib, etc.
Then, in HKCR\Folder\shellex\ContextMenuHandlers you register your class and that's it.
If you use ATL, it will do most of the work for you. (you'll have to manually edit the .rgs file though).
And of course, you have to add your item to the context menu in
YourClass::QueryContextMenu().
Good luck.
alex
|
|
|
|
|
I have a user who is trying to import calendar entries from Outlook 2002 using our software. The following code tries to establish an instance of the application object.
<br />
_ApplicationPtr pOutlook = NULL;<br />
<br />
try<br />
{<br />
HRESULT hr = pOutlook.CreateInstance(__uuidof(Application))<br />
if (FAILED(hr))<br />
MessageBox("Unable to create Outlook instance");<br />
else<br />
{<br />
.<br />
.<br />
.<br />
}<br />
}
When this particular user runs this code, they get the message stating that we were unable to create the Outlook instance. I don't have the ability to send the user a test DLL to get the HRESULT error code. I would like some suggestions on things to look for - reinstall Outlook, turn on some Outlook feature, security settings, etc.
Thanks...
Brigg Thorp
Senior Software Engineer
Timex Corporation
|
|
|
|
|
Im trying to add a referance to a dll wrriten in visual studio 6 to a c# application and Im getting an error saying:"This is not a valid assembly or com component. How can I use this dll?
|
|
|
|
|
|
I have to create a COM object which will be instantiated from a dll. This COM object will be an
interface to a database doing all kinds of data minipulations etc... The trick is that, the dll will
spawn individual threads, and the threads will in instantiate the com object. It is estimated that around
7000 threads will be instantiated. (Yes, it is 7000 !!). My concern is that when antantiated, a connection
must be opened to the DB, which takes "long time" and also the actual instantiation of the com object will
also take long. I need guidence on the mehtodology to be used to create this com object, is this the way
to do it or should I go for an alternative solution. I've read the articles on com pooling but sadly part 2
of the article on this matter does not exist. It seems like a good idea, but dont have enough info on this
matter.
Your help in this regard is appreciated
New problems are set in your path. You must overcome these to be stronger for the problems of the next day. The trick is, never worry about the next day, so give problems a ... hug and thank them ....
|
|
|
|
|
This is just not feasible, unless you are talking about creating 7000 threads across an array of at least 200 CPUs or so.
Connection times are the least of your worries.
On WINTEL systems, one CPU = ONE ACTIVE THREAD at any given time.
Multiple threads are queued across time slices - each thread is allowed to run for maybe 20 ms or so then the CPU switches to the next thread in the queue. You can only create so many threads (not many actually) before you overload the system.
Assuming you could create 7000 threads on a CPU (you can't - not even close) then just to go through the entire rotation to allow each one to run for a SINGLE 20 ms timeslice would take 140 seconds, not counting thread switching overhead.
Not that you could ever get there anyway. Every time you create a new thread, the system allocates stack space, among other things to the thread. You'll run out of memory and kernel resources a long time before you get even close to creating 7000 threads.
Think in terms of something that is actually doable - like maybe 15 threads on a single CPU.
|
|
|
|