Solved

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

Posted on 2002-04-28
2
566 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
ID: 6974817
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
ID: 6974849
Yes, it works
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Include multiple hostnames in this command? 3 53
Expand data scrubbing tool 13 32
Tab names are off by one 5 53
FizzBuzz challenge 9 76
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

932 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