|
HELP PLEASE
I have created a simple COM Server (.exe) using the VC++ Wizard.
I have modified it to be a singleton by adding the following code to my COM class's .h file
DECLARE_CLASSFACTORY_SINGLETON(SiteStatus)
Where SiteStatus is the name of my class
This works fine on 2 machines, ie only 1 instance of the COM Server is created regardless of how many clients use it.
The problem is on one machine it does not act as a singleton, ie more than one instance of the server is created.
Anybody have any ideas why ?
I am puzzled
Thanks
Adrian
|
|
|
|
|
Hi,
I'm trying to use a VB activex dll in a vc app. Everything works out OK until I try to create and use the component from inside a thread of my MFC client.The app crashes. My idea is that since an vb dll is Aparament threaded(STA) the problem occurs as I'm trying to use MTA. Is this so? Would the problem go away if I used a vb activex exe, cause it runs in it's own thread. I'd appreciate some explainations from the gurus here.
TIA.
Hush..Hush.. thought I heard you calling my name now...
|
|
|
|
|
That must not be a problem. Check if u have intialised COM on ur creater thread.
|
|
|
|
|
I make some file downloading activex component with atl
and this component call dll because there need some modification at file
but asp page test
this component call 3times at one submit(request)
and dll method call three times at one page reguest..
why? --;
|
|
|
|
|
How do we draw ActiveX window (visible ActiveX) on to a window using "win32 SDK"(I mean not using Microsoft Foundation Classes !)?
Thanks and Best regards,
Deepu
|
|
|
|
|
Hi,
Probably you mean you want to host ActiveX control in your Win32 Application. Right?
Hosting a control without support of MFC is very hard to implement.
Try to search PATRON sample from MSDN. It's a sample used in book "Inside OLE" by Kraig.
It has no reliability to any librarys like MFC or ATL. Cause of the purpose of the sample,
it has little support as a container.
BTW, if you don't mind using ATL, try to use CAxWindow or something like that.
That control hosting support class template. It's very useful to host a control.
IMHO ATL which has very readable source compared to MFC, is something worth to work on
as a Windows programmer.
Essentially about ATL, I recommend to read the book "ATL Internals" by Chris Sells.
Hope this helps.
Regards,
Ryan
|
|
|
|
|
first call OleInitialize(NULL) (but off course you know that)
Then create the Object and get its LPDISPATCH, or it's interface pointer.
If necesary, Invoke any method of the interface for loading documents or initializing.
Query the OleInPlaceObject interface and set the object rectagular.
RECT Pos={0,0,500,400},Clip={0,0,500,400};
OleInPlaceObject->SetObjectRects(&Pos,&Clip);
When you want to paint it , query the IViewObject interface and call the 'draw' method.
RECTL rectl={0,0,250,200};
ViewObject->Draw(DVASPECT_CONTENT,-1,0,0,0,(HDC)hdcDraw,&rectl,0,0,0);
I use this in a CGI i am making where i just want to take a
quick snapshot of Adobe's SVG control.
I will generate SVG files using CF or ASP, then renter them
using SVG control, encode them to JPG using CGI+ and sent them
to the client!
In the same pattern you can use a control founded in Corel draw
that generates barcodes.
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
Hi, I'm working with a composite control in Visual C++...
Among other things I have a button on the dialog..
The problem is that I can't get it to react on me pressing the enterbutton.
I've tried overloading the pretranslatormethod but that doesnt work so good....
HELP
|
|
|
|
|
Does anyone have a sample that uses OleCreateFromData() function?
Or can anyone tell me the details of using it?
- - - - - - - - - - - - - - - - - -
Memory leaks is the price we pay \0
01234567890123456789012345678901234
|
|
|
|
|
hi, would like to know how to realize resizing a window MPlayer
Called in VBapp with the help COMinterface, generated with the help ATL (VC ++ VS 6.0)
Thanks
|
|
|
|
|
Good afternoon, I would like to know how to realize sending definite events
Through a given time slice for example in VBapps, if it is necessary COMinterface with ATL (VC ++ VS 6.0) to realize. The value of an interval of sending should be set with the help Property ,i.e it to transmit VBapps.
I give thanks for advices
|
|
|
|
|
Appears so;)
I would like to know as to realize the Com-interface for control Mediaplayerîì in environment VC ++ with ïîìîøüþ for example ATL (for VBapps). In MSDN there is an example of implementation where it is possible Play, Stop, Reset- "Funktionen" and path to Avi or MPG for the file to call. I would like to add a capability of reproduction from a definite position of film,, forward and back from THIS position, transition to first and last to staff(frames). And also definite staff forward and back, the temporary coordinates for this listing should be transmitted with events To today I only has created a function Play (double Ze) through parameter by which one transmits value of a position. But as âñ ¸ it in link.. I do not represent: ((it be necessary Property-Variable to insert that the flow bundle was between these functions..
Thanks by All for advices
|
|
|
|
|
Hi together
I despaired almost. I tried a ATLMOVIE-example from MSDN to represent. But it was not possible to me ((
Again and again as I by means of ATLWISARD uner VS6.0 vc ++ have created, then testkotainer has invoked, at last I direct a filename - property(VT_BSTR) something to and invoke kclickte, it drops with ((. But (however) in " the original - proggi " something to select. Probably I put aside money that falch at Ertsellen either AtlObjekt or AltProjekt.aber What???
I require it that the project with events to create, and I do not know as to consisting ATLOBJEKT Events add
Thanks by All for advices
|
|
|
|
|
I have a local COM server that must not die when there are no more reference
to it and I don't want it to be a service. To do this I made sure that the
reference counter never reaches 0. To accomplish this I tried several
things:
1. Use CoAddRefServerProcess() at startup.
2. USe CoLockObjectExternal at startup.
3. Modify CModuleExe::Unlock so the lock count only reaches 0 if allowed.
When I use any of these 3 methods (which probalby all do the same: make sure
the ref. counter does not reach 0) my component stays alive, but it will
free a lot of memory. I saw my component of 1.7 MB go to a mere 60 KB .
I figured I would see a slight decrease of memory use as it does not need the proxy/stubs anymore. But this seems a bit radicale.
Does anyone know what happened?
Is there a beter way of making sure a component stays alive when tere are no more
references to it?
Regards,
Brian.
|
|
|
|
|
How do we extract the custom errors which are embedded in the HRESULT variable?
|
|
|
|
|
|
Could you explain more!?.I did not find any help in how to use these macro in MSDN?Could you help me out?
thx deepu
|
|
|
|
|
That is how resizing a ATL control inside the ATL server DLL? The detail is: I
set a ATL control property with Width and Height and want resize the control
according to the two parameters. Please tell me how can I get it?
cz
|
|
|
|
|
Hi
have you tried SetWindowPos() ?
Hush..Hush.. thought I heard you calling my name now...
|
|
|
|
|
Yes, I have do it by SetWindowPos. Just after I call this function, the ATL extenter
has been resized(become smaller). But I click in the original rect of the ATL extenter,
the ATL become the original size as same as before calling SetWindowPos.
In fact I want to call SetWindowRgn to make a irregular ATL control, but I cannot
because the same reason as above. Click the ATL, it become back to previous shape.
cz
|
|
|
|
|
After FormatMessage( ) how do I convert lpMsgBuf to a BSTR? Thanks.
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Convert lpMsgBuf to BSTR
|
|
|
|
|
Use the ATL string conversion macro T2BSTR.
#include <atlconv.h>
{
USES_CONVERSION;
BSTR bstr = T2BSTR(lpMsgBuf);
...
} The memory allocated for the BSTR is freed whenever the block is exited.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
If you are using MFC you can use:
CString::AllocSysString() but remember that you are allocating a new OLE style string which may need to be cleaned up with ::SysFreeString().
Alternatively you could use ATLs CComBSTR object which will clean itself up like a CString.
Cheers.
John Curtis.
Software guy.
Fatlab Software.
|
|
|
|
|
you can use ::SysAllocStringByteLen()
char* pLcID;
:SysAllocStringByteLen(pLcID,sizeof(pLcID));
|
|
|
|
|
I am using dual interface to expose the functions of the COM interface.One of the function takes the handle of window as the parameter.
I need to use the Invoke()method to call the function and pass the parameter.Could you please help me with some kind of sample code ?
Thanks
Jafer
Jafer
|
|
|
|