Solved

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

Posted on 2002-04-28
2
570 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 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