?
Solved

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

Posted on 2006-06-12
3
Medium Priority
?
374 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
[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
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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.
Suggested Courses

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