|
Hello All,
I have a window that runs in a seperate thread, so I have been making a modal dialog box. It only has one item in it, a static control with a picture. I need to make it so you can size down the dialog box and have scroll bars appear. I have done some work where I use scroll bars with a regular CWindowImpl<>, but I don't know how to make that go modal. The easiest way seems to have scroll bars in my dialog box, and it seems that would be an easy thing to do without manually handling all the scrolling logic and moving things around, but heck if I can figure out how to do any of it.
Also, how can I limit the resizing, like not letting the client area go larger than my picture? It would be REALLY cool to have the maximize button size the client area to the picture.
All Help is Greatly Appreciated
-- Rick
|
|
|
|
|
Hello.
I've just written a relatively simple COM application : an ATL COM Server (EXE) providing one COM object. I choosed EXE because I want an existing application (a Win32 server) to have a COM entry point.
First test :
I make a .VBS file that simply instantiate the component and call a method. It works very well. I can even add debug points on the running EXE server to trace the request.
Second test :
In fact, the client is more complicated, it's a DLL (it's an ISAPI extension, built with ATL Server Web Service wizard).
When the client make the SOAP request, the DLL correctly process it, forward it to the EXE COM Server. It looks like it's working correctly but I can't add debug points in my EXE server. After some investigation, it showed that the DLL was not forwarding the request to the running EXE server, it was instantiating another server process ! (as if it was an in process server).
I've got the idea it could be because the ISAPI DLL was running on an account (the IIS one) and the server on another (the current user, me). But after configuring the Web application so it uses my account I still have the same problem : in task manager I can see 2 server process with the same user name.
I'm not a COM Guru, so going short on ideas, anyone know what is happening?
|
|
|
|
|
What happens if you launch two copies of your script simultaneously?
If you still get two copies of your EXE, you probably registered your class objects as REGCLS_SINGLEUSE . This causes the class object's registration to be removed after the first class object was created. Unless you called CoRegisterClassObject again, the next time a call to CoGetClassFactory (which is called internally by CoCreateInstance ) occurs, the COM Service Control Manager starts up a new instance of your server.
If you want all clients to use the same server process, you should register your class objects as REGCLS_MULTIPLEUSE .
In an ATL server, you typically register your class objects by calling _Module.RegisterClassObjects in WinMain .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
When I run multiple clients (script, C++ client, remote client using CoCreateInstanceEx) it works very well, always using the current server instance (yes, using the REGCLS_MULTIPLEUSE, I've trace the ATL code).
But within my ISAPI extension (running in IIS, but with the same account as my COM server) it create another instance of the server (running on the same account) and then all the request use the newly created instance (I never have more than 2 instances).
|
|
|
|
|
Iam currently trying to use URLDownload to file and the prototype for this method is as follows
HRESULT URLDownloadToFile(LPUNKNOWN pCaller,
LPCTSTR szURL,
LPCTSTR szFileName,
DWORD dwReserved,
LPBINDSTATUSCALLBACK lpfnCB
);
The first parameter "LPUNKOWN pCaller" is supposed to be a pointer to the Iunknown interface of my activeX control. But i have very little idea how to obtain this pointer. Would it be possible to either use "Iunknown::addRef" or use "CWnd::GetControlUnknown" to do this? My control is ATL based which as I understand implements the Iunknown interface for me. I am an activeX newbie so..........Any one have any ideas?
[] /\ () X
|
|
|
|
|
It is only required if you want ot have notifications about the progress of download process, if you just want to download a file without any progress bars use this
HRESULT hr = URLDownloadToFile(NULL,"http://...",szFilename,255,NULL);
if(FAILED(hr))
{
MessageBox(NULL,szFilename,"FAILED",MB_OK);
}
Hope it Helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
URLDownloadToFile(NULL,"http://...",szFilename, BINDF_GETNEWESTVERSION, NULL);
greatest thing is to do wot others think you cant suhredayan@omniquad.com>
messenger :suhredayan@hotmail.com
|
|
|
|
|
Hey thanx for the help guys got it working now , till next time.............
[] /\ () X
|
|
|
|
|
Hello everyone:
Is there some WTL structure like POSITION of MFC?
Thank you.
-Freehawk
|
|
|
|
|
No.
I suspect you want the collection classes, use STL instead.
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
Thank you for the reply.
Please tell me How to use STL instead to it?
-Freehawk
|
|
|
|
|
To do what?
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
ATL also has their own array classes that produce smaller object code that STL but aren't as near as powerful.
Pick up a good book on STL. It is really some nice stuff. I personally use the collection classes. Some of the other stuff can be problematic.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
It's a steep learning curve if u don't even have MFC Background.
To start with ATL suggested by Tim, u got to know where to get the documentation from.
Look into \vc98\ATL\ATLwin.h for example. U get all the ATL helper classes.
STL is purely for C++ gurus only, ATL is a build up from STL. U need to know ur STL before u know what's happening in ATL. ATL is sort of superceded by WTL now. So look up WTL for better wrapper classes which are equivalents of those classes in MFC.
|
|
|
|
|
Try this link, should be helpful for u to know what new template classes are out there for u to use.
http://www.viksoe.dk/wtldoc/
|
|
|
|
|
Anonymous wrote:
It's a steep learning curve if u don't even have MFC Background.
We can assume that freehawk already has an MFC background since he refers to POSITION.
Anonymous wrote:
STL is purely for C++ gurus only
No, it's not. I'm nowhere near being a C++ guru and use STL comfortably. In any case, it is now part of Standard C++ and anyone wanting to be a professional programmer needs to know how to use it. You do not need to understand everything about it to benefit from it. Just start slowly...
Kevin
|
|
|
|
|
There are plenty of articles here at CodeProject.
You might also try looking at the numerous examples in the VC online help. That's how I got going initially with basic use of strings, vectors, lists and so on.
There's also quite a good online tutorial here. http://www.sgi.com/tech/stl/[^]
Kevin
|
|
|
|
|
|
Hi all
I little messy in ATL conversion macros such as A2BSTR T2BSTR and so on.
I can't realize should i free returned buffer.
For instance:
//This is unicode project
USES_CONVERSION;
WCHAR wchr[] = L"XXXX";
BSTR str = W2BSTR(wchr);
/*
Ok returned buffer i should free by SysFreeString(str)
Because of
inline BSTR W2BSTR(LPCWSTR lp) {return ::SysAllocStrin (lp);}
*/
Now other shred of code:
//Unicode project
USES_CONVERSION;
WCHAR wchr[] = L"XXXX";
TCHAR* str = W2T(wchr);
//I can't free str by delete [] str; cause is same
//pointer as wchr
Do this meant whats all BSTR returned ATL macros
should be free directly , but allother returned pointers not.
THANKS
|
|
|
|
|
BSTR are an example of managed string that require you to use the Sys**** routines to manage the memory. However, other strings such as simple char or WCHAR strings are just arrays of characters. ATL uses this fact to store the temporary strings created by A2W or W2A (etc) on the stack (ATL3). Thus when the routine returns, the stack is automatically freed and the memory goes away properly.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
|
Hello everyone:
I need a WTL control in which tree and list is mixed. Please tell me where it is and some sample about it.
Thank you.
-Freehawk
|
|
|
|
|
|
Iam currently in the processing of producing a 3d vector graphics control that is based in an activeX control. Currently all of my data to define the 3d objects used in this control in hardcoded into the control. Obviously Iam very keen to remove this hardcoded data and the control retrieve the data from an external source IE a file.
Ive done some research into this and it seems like I may be wanting to use URLdownloadToFile to retrieve the information from a file. Is it correct that I will need to use this? And also how will I bind this data to a property of the activeX control? Obviously it would be desirable to have this information assigned to a property of the control after its instantiation in the HTML page or have it declared as a parameter upon control creation? Ideas n e 1???
(PS if it helps my control is very similar to such controls as macromedia shockwaves and cult3d which are all data driven exactly like I want mine to be)
[] /\ () X
|
|
|
|
|
Hi gurus,
I'm working on a ATL plug-in for MS Outlook, but I would like to make it work on Outlook Express as well. I understand that it's not possilble via COM technology (as OE does not expose any COM interfaces ), but something with hooks? Any documentation on the subject?
Any help / hint would be much appreciated.
Thanks in advance,
Doru K.
|
|
|
|