Skocz do zawartości

Obrazki w RichEdit


Nemo

Recommended Posts

Przeglądając MSDN znalazłem:
HTML Viewer Control
Jako, że jestem leniwy :] (ctrl+c > ctrl+v z MSDN):

The Hypertext Markup Language (HTML) viewer control provides a viewer for displaying HTML text and embedded images. The HTML viewer provides the functionality required to implement Microsoft® Pocket Internet Explorer and the Help engine.

You can also create other viewers based on the HTML viewer control. An HTML source can include references to other sources, which may provide different types of data. If the application determines that some of the data it retrieves is of a type other than HTML, it can invoke another type of viewer to display that data.

To use the HTML viewer control, you must include the Htmlctrl.h header file and either link your application with the Htmlview.dll dynamic link, or load the HTML viewer DLL by calling the LoadLibrary function. When you call LoadLibrary, pass "Htmlview.dll" as the lpLibFileName parameter.

Before you can create or use the HTML viewer control, you have to register it by calling the InitHTMLControl function.You create an HTML viewer control by specifying DISPLAYNAME in the lpClassName parameter to the CreateWindow function.

To create the HTML viewer control
Load the HTML viewer DLL by calling the LoadLibrary function, specifying "Htmlview.dll" in the lpLibFileName parameter.
Register the HTML viewer control class by calling the InitHTMLControl function.
Create a window for the HTML viewer control by calling the CreateWindow function, specifying DISPLAYNAME in the lpClassName parameter.
To display an HTML document
Clear the current contents of the HTML viewer control by sending it a WM_SETTEXT message.
Load an HTML document and copy the document's text to the control by sending the control a series of DTM_ADDTEXT messages for ASCII or DTM_ADDTEXTW messages for Unicode.
When the document processing is complete, send the control a DTM_ENDOFSOURCE message.
Process any NM_HOTSPOT notifications sent by the control when the user taps a link or submits a form.
For each NM_INLINE_IMAGE notification received from the control, load the image so that the HTML viewer control will display the image loading icon.
After the image has loaded successfully, send the control a DTM_SETIMAGE message containing the bitmap handle (HBITMAP) of the image to display.
If the image does not load successfully, send a DTM_IMAGEFAIL message, which indicates to the control that it should display the broken image icon.

For each NM_INLINE_SOUND notification received from the control, load the sound, and then play it the number of times indicated in the dwLoopCount parameter.

Link do komentarza
Udostępnij na innych stronach

jeśli to pomoże zamieszczam przykład z MSDN i resztę opisu:

#define DISPLAYCLASS  TEXT("DISPLAYCLASS")

BOOL g_bMakeFit = TRUE;          // DTM_ENABLESHRINK Shrink-enable flag
TCHAR const c_szHTMLControlLibrary[] = TEXT("htmlview.dll");

HINSTANCE g_hInstHTMLCtrl;       // HTML Control Viewer instance
HINSTANCE hInstance;             // Application instance
HWND m_hwndHtml;                 // Handle to HTML DISPLAYCLASS window

g_hInstHTMLCtrl = LoadLibrary(c_szHTMLControlLibrary);

InitHTMLControl(hInstance);

LRESULT WndProc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) 
{
   switch (message) 
   {
      case WM_CREATE: 
      {
         m_hwndHtml = CreateWindow(DISPLAYCLASS, NULL,
            WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_CLIPSIBLINGS,
            rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
                hWnd, (HMENU)IDC_HTMLVIEW, g_hInst, NULL);
         SetFocus(m_hwndHtml);
         PostMessage(m_hwndHtml, DTM_ENABLESHRINK, 0, g_bMakeFit);
         break;
      }
      .
      .
      .
   }
}

Note When calling the LoadLibrary and CreateWindow functions, the library or class name has to be a Unicode string. Use the TEXT macro to cast a string as Unicode, for example, TEXT("Htmlview.dll").

Pocket Internet Explorer is an example of an application that uses the HTML viewer control. The application (Webview.exe) links with the dynamic-link library that provides the HTML viewer control (Htmlview.dll). The application provides the user interface, retrieves the data from the Uniform Resource Locators (URL), and interprets the data.

The following illustration describes how the application interacts with the HTML viewer control.

Interaction between the application and HTML viewer control

Note The HTML viewer control interface is not an ActiveX control, and does not expose any COM interfaces.

Link do komentarza
Udostępnij na innych stronach

  • 3 weeks later...

Ta biblioteka DLL nie jest chyba standardowym wyposarzeniem Windows, bo u siebie jej nie znalazłem :/
Podobnie było z plikiem .h pod moim kompilatorem :(

Nie ma jakiegoś innego, prostego sposobu na stworzenie kontrolki HTML?
Obczaiłem SoftIcem, że okno tej kontrolki jest klasy
"Internet Explorer_Server", więc pewnie to jest jakieś okno IE.
Niestety nie udało mi się stworzyć okna takiej klasy w CreateWindowEx(). Pewnie trzeba jakąś inicjalizację zrobić, tak jak z Common Controls.
Może ktoś coś wie o tym?

Link do komentarza
Udostępnij na innych stronach

gamecreator napisał:
Ta biblioteka DLL nie jest chyba standardowym wyposarzeniem Windows, bo u siebie jej nie znalazłem :/
Podobnie było z plikiem .h pod moim kompilatorem :(

Tak teraz zaczolem probowac cos zrobic z tym HTML no i rzeczywisice nie ma dll ani .h :D
Wiec dolanczam sie do pytania

Link do komentarza
Udostępnij na innych stronach

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gość
Odpowiedz...

×   Wkleiłeś zawartość bez formatowania.   Usuń formatowanie

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Utwórz nowe...