Solved

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

Posted on 2006-06-12
3
349 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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

777 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