Solved

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

Posted on 2002-04-28
2
569 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error on moodle after upgrade 3 155
countEvens challenge 2 117
noX challenge 17 144
Problem to Office 1 68
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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