Solved

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

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maxBlock challenge 30 127
dog bark java program 15 94
sum67 challenge 35 97
isEverywhere  challenge 19 74
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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

815 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