Solved

Finding the path to the page that is calling my ATL ActiveX Control

Posted on 2006-06-12
3
328 Views
Last Modified: 2010-04-01
How do I find the URL to the file that is calling my ActiveX control.  I want to have <param>'s similar to flash which specify a file to download but I don't want the user to have to specify a full URL.

<object>
   <param name="swf" value="myflash.swf">
</object>

and then in my ActiveX control I initiate a download at:
http://www.example.com/sub/dir/myflash.swf
0
Comment
Question by:GENTP
3 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 16887498
If you're hosting at the same domain, you can use a path relative to the root, e.g.

<object>
   <param name="swf" value="/sub/dir/myflash.swf">
</object>
0
 
LVL 5

Author Comment

by:GENTP
ID: 16887562
I am, but I'm looking to find the path, server, and port info inside of the control.
0
 
LVL 2

Accepted Solution

by:
MechanTOurS earned 500 total points
ID: 16888114
LPSTR getBase()
{
   USES_CONVERSION; // for OLE2A

   LPMONIKER clientMoniker = NULL;
   
   if ( S_OK == m_spClientSite->GetMoniker(OLEGETMONIKER_ONLYIFTHERE,OLEWHICHMK_CONTAINER,&pClientMoniker) )
   {
      LPOLESTR oleClientBaseUrl = NULL;
      IBindCtx *pBindContext = NULL;
     
      if (CreateBindCtx( 0, &pBindContext ) == S_OK )
      {
         // resolve the path
         pClientMoniker->GetDisplayName( pBindContext, NULL, &oleClientBaseUrl );
         
         // convert it to LPSTR
         LPSTR clientBaseUrl = OLE2A(oleClientBaseUrl );
         
         // do whatever u want with it.
         // ......
         
         return clientBaseUrl;
      }
   }
}
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

758 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

17 Experts available now in Live!

Get 1:1 Help Now