|
Hi,
I currently have a working BHO that receives several events fired from its browser through a SINK_MAP, but Im missing an event, an event fired from a change of focus. IE events ID contained in IWebBrowser2 dont seem to have an event for that. The closest thing I managed to extract form the Browser pointer was the window object which has window.blur and window.focus methods, and which events are usually handled in JavaScript. My question: can I handle these envents in C++ and if so whats the interface DIID and event that I want to look for.
|
|
|
|
|
How can ATL be used for non COM applications. What particular aspect of it is being contributed to the non COM application eg. a win32 app.
|
|
|
|
|
The windowing classes in ATL don't require COM. There is also WTL if you need a GUI library with more features.
|
|
|
|
|
What does the following code do?
PROCESS_INFORMATION procinfo;<br />
STARTUPINFO stinfo;<br />
<br />
if ( CreateProcess(NULL, chCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &stinfo, &procinfo) != 0)<br />
{<br />
ULONG i;<br />
while ( i=0, GetExitCodeThread(procinfo.hProcess, &i) && i == STILL_ACTIVE)<br />
{<br />
_sleep(1000);<br />
}<br />
}
|
|
|
|
|
[Edit]As Mike Dunn correctly says, STARTUPINFO isn't correctly initialised - edited the example code to initialise correctly [/Edit]
Starts a new process, then waits until it terminates - checking once per second.
It's not a great example of that sort of code - this is rather more idiomatic in Windows:
<font>PROCESS_INFORMATION procinfo;
STARTUPINFO stinfo = { sizeof(STARTUPINFO), 0 };
if ( CreateProcess(NULL, chCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &stinfo, &procinfo) != 0)
{
if (WaitForSingleObject(procinfo.hProcess, INFINITE) == WAIT_OBJECT_0)
{
ULONG i;
GetExitCodeThread(procinfo.hProcess, &i);
}
}</font>
Rather than polling, it uses a kernel wait.
Last modified: 11hrs 47mins after originally posted --
|
|
|
|
|
It passes garbage in the STARTUPINFO struct, so the CreateProcess() call may fail.
|
|
|
|
|
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.
|
|
|
|