|
What is the simplest way to create a simple dialog in an ATL application? Should one use CAxDialog or WTL. Which one is used in what situations?
|
|
|
|
|
CDialogImpl and CAxDialogImpl are both ATL classes. CAxDialogImpl is used for dialogs that contain ActiveX controls.
|
|
|
|
|
Hi all,
Can anyone give me idea how i can implement a download progress bar. I want to create a new thread for downloading (which can work either blocking/nonblocking mode). It should be cancelable. More precisely i want to create a downloader notification class which i can use later also. i want to pass parameters (url, destination, blocking|nonblocking) and it will create a thread. Downloading a file is done, i just want to show the progress info.
I tried with CWindowImpl/CDialogImpl but failed.
any idea/suggesstion?
thanks in advance.
Arif
|
|
|
|
|
See URLDownloadToFile function does helpfuls?
|
|
|
|
|
Checking the function. thanks for your reply.
|
|
|
|
|
I think it will be solve your problem.;)
|
|
|
|
|
Hi,
We are trying to place FlexGrid in ATL window(CWnd Inheritance).
Create is successful, but we cannot get Interface properly.
We think that either one or both of the arguments for "QueryInterface" are
incorrect.
iCannot find REFIID in the help header file.j
Please let us know the solution for this.
Thanx & Regards
Ravi
|
|
|
|
|
Hi all -
I am little confused over the assignment mechanism in std::Vector.
I have a standard vector of some class object, lets say MyClass.
This vector has various number of objects at various occasions.
I also need to keep a backup of this vector, at times.
I am using following code:
1. std::vector<myclass> vect;
2. std::vector<myclass> *pVect = new std::vector<myclass>; //(one time initialization in the owner class's ctor)
// for assignment
3. *pVect = vect;
What happens to the objects contained in pVect when the assignment operator is called?
Is it better to use a resize here?
Or is it better if I use this code --
// for assignment
if (pVect)
delete pVect;
pVect = new std::Vector<myclass>(vect)
|
|
|
|
|
misha_grewal wrote:
What happens to the objects contained in pVect when the assignment operator is called?
There aren't any objects in pVect when the assignment operator is called.
The best code to use would probably be
pVect = new std::vector<myclass>(vect.begin(), vect.end());
This allocates the new vector and copies the contents of vect in one operation.
|
|
|
|
|
Thanks a lot Stuart,
I have one more doubt..
Stuart Dootson wrote: What happens to the objects contained in pVect when the assignment operator is called?
There aren't any objects in pVect when the assignment operator is called.
But what if pVect already has some objects
for e.g.
*pVect = vect; //(this time vect has 10 objects)
//Again at some point in code
*pVect = vect; //(this time vect has 5 objects)
Regards,
Misha
|
|
|
|
|
The objects will be destructed, so for
std::vector<myclass> a;
the myclass destructor will be called for each member of a if you assign something else to a
|
|
|
|
|
misha_grewal wrote: std::vector *pVect = new std::vector;
STL containers are generally designed with stack semantics in mind. Of course, it is allowed to create them on the heap, but it is rarely a good thing.
|
|
|
|
|
I am confused!
Q1) Why are you using new at all?
misha_grewal wrote: 3. *pVect = vect;
The objects in pVect are destroyed and then replaced by copies of those stored in vect ; the vector will resize its self if needed.
misha_grewal wrote: Or is it better if I use this code --
// for assignment
if (pVect)
delete pVect;
pVect = new std::Vector(vect)
In this scenario you are wasting time and code:
1) You do not need to use if(pVect) in C++, because delete does that for you. So you would just call delete .
2) See Q1 above.
Note: Using new is rarely required in a well written (standard) C++ program.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi,
I want know that what is the max size of a vector. How much a vector can store Data. Is there any limit or not?.
Thanks
Pankaj Jain
|
|
|
|
|
The only limit is the amount of memory that can be allocated, which will depend on a) the amount of memory you have installed in your PC (as the amount of physical RAM affects the size of the page-file), and b) the other processes you have running.
On 32-bit Windows 2000 and XP, the absolute maximum limit will be something under 2GB, I guess.
|
|
|
|
|
Hello,
I've been read through various articles about DEP(Data Execution Prevention)[^] and realized that many of them implied that old ATL/WTL application may trigger DEP then be terminated due to non-DEP compliant thunking code that old version of ATL/WTL uses.
However when I wanted and tried to verify it myself by creating WTL applications based on both ATL3 and ATL71, they didn't trigger DEP nor crashed and run without any problem.
The testing systems (one AMD64 and one Intel DuoCore in WinXP SP2) were set to enable hardware DEP through control panel, and it was confirmed by running NXTEST[^].
Why can't DEP detect data ( on the stack(ATL3) or on the heap(ATL71) ) being executed without the excutable flag set in ATL/WTL application?
|
|
|
|
|
Because they allocate the thunks from memory marked as executable... dig into the source
--
Raaaaaaaaaaaaaaaaaaaaa!
|
|
|
|
|
No, they are not allocated from memory marked as executable.
If you are talking about ATL8(from VC80), yes the thunk are allocated from memory with executable flag bit set (DEP compatible thunk).
But ATL71 and prior (as I specified in my original question) do not allocate the thunk from memory marked as executable. ATL3 uses thunk from the stack memory(as a member variable) and ATL71 uses it from ::HeapAlloc() thus no excutable bit set.
And my question is why ATL/WTL applications using thunk from ATL71 or prior do not trigger DEP mechanism when hardware DEP is enabled in WinXP SP2 or WinVista?
Am I missing something here?
Regards,
Jae.
|
|
|
|
|
Yes, you are right. I was refering to ATL8. I just checked my ATL71 code, but could not see the "special alloc" as one can in ATL8.
I too would like to know why DEP won't shoot it down.
|
|
|
|
|
I got some answer from the microsoft ATL newsgroup.
Click Here.[^]
Martyn Lovell in MS replied long time ago:
"You have nothing to worry about. We worked with the Windows team to ensure
that applications based on all versions of ATL will keep running even in the
presence of the NX-supporting processors.
The way we did this might have a small perf impact, so we'll also be
ensuring that future versions of ATL do store their thunks in appropriately
marked pages; we're also considering putting this change into service packs
of V7.x releases of VS. But with or without these changes your applications
ATL-based code will keep running just fine."
~~~
By the way, I found that my custom thunk code which is identical to that from ATL3 does not trigger DEP either therefore, IMHO, I guess DEP does some sort of machine code comparison in the data being executed to avoid shooting down a code based on the thunk of ATL71 or prior.
Jae
|
|
|
|
|
Not much details (or am I blind??). The penalty hit comment smells of trapping exceptions, do code analysis, and then either allow or disallow execution.
Thanks for the information!
|
|
|
|
|
Hi all!
I want to write an ATL exe that uses the mscomm32.ocx activex for serial communication.
How to do this? specially how to call the methods of this ocx as we can do it with
mfc exe by declaring a member variable of the class CMSComm.
Thanks in advance.
Viral Joshi.
|
|
|
|
|
Hi All,
I am having a ASPX page on whose submission I open a PopUp Window for
sending mails.In the main page I have four hidden variables for
setting the MailTo Mailcc,MailSubject and MailBody fields which I am
getting in my PopUp Window by using
if((document.getElementById("hdnForPOst").value)=="1")
{
document.getElementById("txtTo").value=window.opener.document.getElementById("hdnMailTo").value;
document.getElementById("txtCC").value=window.opener.document.getElementById("hdnMailCC").value;
document.getElementById("txtMailSubject").value=window.opener.document.getElementById("hdnMailSubject").value;
document.getElementById("txtMailBody").value=window.opener.document.getElementById("hdnMailBody").value;
}
hdnForPOst is the variable set for sending mail.
This script I have pasted in a after my controls code.
The problem is that sometimes this code does't execute and I get a
blank popup Window.
I have checked by putting alerts inside script block also.These alerts
also dont execute.It happens only at times and no specific scenario.
Anybody can help please?
Dipti Arora
|
|
|
|
|
I'm using attribute ATL, and i need to forward declare an interface but i'm not sure what the correct syntax is? this is what i currently have but i'm getting a compile error. VS2005
error MIDL2025 : syntax error : expecting a type specification near "IDLArchiveFile"
[export]
__interface IDLArchiveFile;
[
object,
uuid("3E661C7F-C4C4-4EF8-94A3-4AA9FC0F9419"),
dual, helpstring("IDLArchiveDirectory Interface"),
pointer_default(unique)
]
__interface IDLArchiveDirectory : IDispatch
{
[id(6), helpstring("method GetFileAt")] HRESULT GetFileAt([in] SHORT index,[out,retval] IDLArchiveFile** pFile);
};
[
object,
uuid("08B48958-99C0-4AE1-91C9-1DD68B419A07"),
dual, helpstring("IDLArchiveFile Interface"),
pointer_default(unique)
]
__interface IDLArchiveFile : IDispatch
{
[propget, id(3), helpstring("property Parent")] HRESULT Parent([out, retval] IDLArchiveDirectory** pVal);
};
Jared Allen.
|
|
|
|
|
This is going to sound snarky, but in all honesty you shouldn't use attributed ATL. It has never worked right. If at all possible, you should rewrite it in regular ATL.
|
|
|
|