Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ShowHTMLDialog

Posted on 1998-10-22
5
Medium Priority
?
227 Views
Last Modified: 2013-12-03
I found the ShowHTMLDialog in MSDN that is very interesting . The problem is that since I work with plain API , I am not sure how I supply the dialog resource to the function and the other parameter's meaning . I would appreciate a piece of code that calls ShowHTMLDialog .
0
Comment
Question by:WxW
[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
  • 2
5 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 90 total points
ID: 1415530
There's an example in the Internet Platform SDK (available at 'http://www.microsoft.com/msdn/sdk/platform.htm') named 'htmldlg'. Excerpt:
int PASCAL WinMain(  HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR lpCmdLine,
                     int nCmdShow)
{
HINSTANCE   hinstMSHTML = LoadLibrary(TEXT("MSHTML.DLL"));

if(hinstMSHTML)
   {
   SHOWHTMLDIALOGFN  *pfnShowHTMLDialog;
     
   pfnShowHTMLDialog = (SHOWHTMLDIALOGFN*)GetProcAddress(hinstMSHTML, TEXT("ShowHTMLDialog"));

   if(pfnShowHTMLDialog)
      {
      IMoniker *pmk;
      TCHAR    szTemp[MAX_PATH*2];
      OLECHAR  bstr[MAX_PATH*2];

      lstrcpy(szTemp, TEXT("res://"));
      GetModuleFileName(hInstance, szTemp + lstrlen(szTemp), ARRAYSIZE(szTemp) - lstrlen(szTemp));
      lstrcat(szTemp, TEXT("/HTML_RESOURCE"));

      LocalToBSTR(bstr, szTemp, ARRAYSIZE(bstr));

      CreateURLMoniker(NULL, bstr, &pmk);

      if(pmk)
         {
         HRESULT  hr;
         VARIANT  varArgs, varReturn;
         
         VariantInit(&varReturn);

         varArgs.vt = VT_BSTR;
         varArgs.bstrVal = SysAllocString(L"Argument 1;Argument 2;Argument 3;Argument 4");

         hr = (*pfnShowHTMLDialog)(NULL, pmk, &varArgs, NULL, &varReturn);

         VariantClear(&varArgs);
         
         pmk->Release();

         if(SUCCEEDED(hr))
            {
            switch(varReturn.vt)
               {
               case VT_BSTR:
                  {
                  TCHAR szData[MAX_PATH];

                  BSTRToLocal(szData, varReturn.bstrVal, ARRAYSIZE(szData));

                  wsprintf(szTemp, TEXT("The selected item was \"%s\"."), szData);

                  VariantClear(&varReturn);
                  }
                  break;

               default:
                  lstrcpy(szTemp, TEXT("Cancel was selected."));
                  break;
               }
            MessageBox(NULL, szTemp, TEXT("HTML Dialog Sample"), MB_OK | MB_ICONINFORMATION);
            }
         else
            MessageBox(NULL, TEXT("ShowHTMLDialog Failed."), TEXT("HTML Dialog Sample"), MB_OK | MB_ICONERROR);
           
         }
      }
   FreeLibrary(hinstMSHTML);
   }

return 0;
}

0
 
LVL 6

Author Comment

by:WxW
ID: 1415531
I appreciate your answer jkr , but I already knew this . I want to display HTML in my app without the usage of MFC . Is there any API that enables you to show html without messing with IMoniker and Variants ?
0
 
LVL 6

Author Comment

by:WxW
ID: 1415532
Ok I found how , thanks for the info :)
0
 
LVL 86

Expert Comment

by:jkr
ID: 1415533
Hmmm - the example above doesn't use MFC at all ;-)
0
 
LVL 6

Author Comment

by:WxW
ID: 1415534
Right but the doc I found includes mshtml.h that does some tricks .... anyway I went through it
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

722 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