Solved

How to set the first parameter of URLDownlofToFIle() in ATL ActiveX?

Posted on 2002-04-28
2
563 Views
Last Modified: 2013-11-20
Hi experts,

I want to use URLDownloadToFile function in an ATL project. From MSDN, the first parameter should be "Address of the controlling IUnknown interface of the calling ActiveX component"
So, my question is how to get this IUnknown ?

codes:
STDMETHODIMP CTestATL::OnTest(IDispatch *pdisp)
{
    .....
    ::URLDownloadToFile(???,"http://www.msn.com/index.htm","C:\\1.htm",callback_function);
    .....
    return S_OK;
}
0
Comment
Question by:iProgram
2 Comments
 
LVL 12

Accepted Solution

by:
migel earned 100 total points
Comment Utility
Hi!
You can safely pass NULL as the first parameter.
You can also get your ActiveX IUnknown pointer:
that is:

STDMETHODIMP CTestATL::OnTest(IDispatch *pdisp)
{
     CComPtr<IUnknown> punk1;
     QueryInterface(IID_IUnknown, (void**)&punk1);        ::URLDownloadToFile(punk1,"http://www.msn.com/index.htm","C:\\1.htm",callback_function);
   .....
   return S_OK;
}
0
 
LVL 1

Author Comment

by:iProgram
Comment Utility
Yes, it works
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now