Click here to Skip to main content
15,914,066 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How do I deploy riched20.dll? Pin
Tom Archer27-Apr-02 13:42
Tom Archer27-Apr-02 13:42 
AnswerRe: How do I deploy riched20.dll? Pin
Jack Handy27-Apr-02 21:58
Jack Handy27-Apr-02 21:58 
GeneralRe: How do I deploy riched20.dll? Pin
Tom Archer28-Apr-02 0:00
Tom Archer28-Apr-02 0:00 
GeneralRe: How do I deploy riched20.dll? Pin
Jack Handy28-Apr-02 1:01
Jack Handy28-Apr-02 1:01 
GeneralRe: How do I deploy riched20.dll? Pin
Tim Smith28-Apr-02 3:22
Tim Smith28-Apr-02 3:22 
GeneralRe: How do I deploy riched20.dll? Pin
Tom Archer28-Apr-02 4:00
Tom Archer28-Apr-02 4:00 
GeneralRe: How do I deploy riched20.dll? Pin
Tom Archer28-Apr-02 4:25
Tom Archer28-Apr-02 4:25 
GeneralRe: How do I deploy riched20.dll? Pin
Tom Archer28-Apr-02 3:58
Tom Archer28-Apr-02 3:58 
You're confusing a couple of different things here. There are three ways a library can be used.


  • A static (or object) library is an OBJ that is linked in with your application. This file contains the actual implementation of the code. When you select the link statically with MFC, you are including the MFC static link libaries into your build.
  • Like static libraries, import libraries are used by the linker to resolve function calls. However, unlike static libraries, import libraries contain no code. Instead, import libraries contain information that helps Windows load and resolve (non-static) function calls at runtime.

    As an example, let's say you make a call to CreateWindow in your code. In order for this to compile, you must have that function declared somewhere. This is take care of with the inclusion of the windows.h header. Now for the application to link, you must either include an object library (static library) that contains the actual CreateWindow function or you must provide an import library that contains the information that is needed to load the DLL containing the function at runtime. For this particular function, you would always use an import library as you would never want to statically link to the system libraries.
  • The last way to use a library is dynamically. To do this a DLL is loaded via the LoadLibrary function and functions are resolved via calls the GetProcAddress.


    Now the case of the richedit control (housed in the riched20.dll). When you use the CRichEditCtrl, you are simply using a class that wraps the RICHEDIT window class. In order for you to resolve to the CRichEditCtrl member functions you will either statically link to the MFC or dynamically link to the MFC. However, that's not all you have to do because at this point you're only making the compiler and linker happy with regards to calls to a C++ class. This has nothing to do with the underlying window.

    When you create a window, you do so by calling the CreateWindow function and passing a window class. In the case of the rich edit control, this value is "RICHEDIT". When you do that, Windows will look at an internal table and see if it any code has registered a window with the name of "RICHEDI". If so, your CreateWindow succeeds (assuming the other params are corred). If not, it fails.

    But how does Windows know if a Window is "registered" or not and what does that mean? If you have installed the riched20.dll, upon its loading by Windows, that DLL will call the RegisterWindow function. That function is specifically meant to associate a window class name with a winproc.

    Now, if you call the CreateWindow function on a system where the riched20.dll has been installed, Windows already has loaded the DLL and the winproc function needed in order to send messages to that window (such as WM_CREATE).

    Therefore, distributing the actual rich edit window code is a completely different issue than how you link with the MFC in order to use the CRichEdit class.


    Cheers,
    Tom Archer
    Author, Inside C#

    A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.

GeneralRe: How do I deploy riched20.dll? Pin
Jack Handy28-Apr-02 10:22
Jack Handy28-Apr-02 10:22 
GeneralRe: How do I deploy riched20.dll? Pin
Tom Archer28-Apr-02 10:25
Tom Archer28-Apr-02 10:25 
GeneralRestoring View Size in Split Views :: MFC Pin
valikac27-Apr-02 12:49
valikac27-Apr-02 12:49 
GeneralRe: Restoring View Size in Split Views :: MFC Pin
Swinefeaster30-Apr-02 1:20
Swinefeaster30-Apr-02 1:20 
GeneralRe: Restoring View Size in Split Views :: MFC Pin
valikac30-Apr-02 4:12
valikac30-Apr-02 4:12 
GeneralRe: Placing SetColumnInfo() Pin
valikac30-Apr-02 19:52
valikac30-Apr-02 19:52 
GeneralRe: Placing SetColumnInfo() Pin
Swinefeaster30-Apr-02 19:58
Swinefeaster30-Apr-02 19:58 
GeneralRe: Restoring View Size in Split Views :: MFC Pin
valikac2-May-02 4:48
valikac2-May-02 4:48 
GeneralAccess Violations Pin
Jack Handy27-Apr-02 12:02
Jack Handy27-Apr-02 12:02 
GeneralRe: Access Violations Pin
Tom Archer27-Apr-02 12:09
Tom Archer27-Apr-02 12:09 
GeneralRe: Access Violations Pin
Jack Handy27-Apr-02 12:21
Jack Handy27-Apr-02 12:21 
GeneralRe: Access Violations Pin
Tom Archer27-Apr-02 12:29
Tom Archer27-Apr-02 12:29 
GeneralRe: Access Violations Pin
Neville Franks27-Apr-02 12:35
Neville Franks27-Apr-02 12:35 
GeneralRe: Access Violations Pin
Jack Handy27-Apr-02 16:14
Jack Handy27-Apr-02 16:14 
GeneralRe: Access Violations Pin
Ravi Bhavnani27-Apr-02 12:41
professionalRavi Bhavnani27-Apr-02 12:41 
GeneralRe: Access Violations Pin
Jack Handy27-Apr-02 16:14
Jack Handy27-Apr-02 16:14 
GeneralRe: Access Violations Pin
Neville Franks27-Apr-02 16:20
Neville Franks27-Apr-02 16:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.