MSI: use a richedit control for license text

Mike McCormack mike at codeweavers.com
Tue Jun 7 04:03:29 CDT 2005


ChangeLog:
* use a richedit control for license text
-------------- next part --------------
--- dlls/msi.old/dialog.c	2005-06-07 18:01:05.000000000 +0900
+++ dlls/msi/dialog.c	2005-06-07 18:01:20.000000000 +0900
@@ -32,6 +32,7 @@
 #include "msidefs.h"
 #include "ocidl.h"
 #include "olectl.h"
+#include "richedit.h"
 
 #include "wine/debug.h"
 #include "wine/unicode.h"
@@ -128,6 +129,7 @@
 
 static DWORD uiThreadId;
 static HWND hMsiHiddenWindow;
+static HMODULE hRichedit;
 
 static INT msi_dialog_scale_unit( msi_dialog *dialog, INT val )
 {
@@ -478,14 +480,53 @@
     return ERROR_SUCCESS;
 }
 
+struct msi_streamin_info
+{
+    LPSTR string;
+    DWORD offset;
+    DWORD length;
+};
+
+static DWORD CALLBACK
+msi_richedit_stream_in( DWORD_PTR arg, LPBYTE buffer, LONG count, LONG *pcb )
+{
+    struct msi_streamin_info *info = (struct msi_streamin_info*) arg;
+
+    if( (count + info->offset) > info->length )
+        count = info->length - info->offset;
+    memcpy( buffer, &info->string[ info->offset ], count );
+    *pcb = count;
+    info->offset += count;
+
+    TRACE("%ld/%ld\n", info->offset, info->length);
+
+    return 0;
+}
+
 static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec )
 {
-    const static WCHAR szEdit[] = { 'E','D','I','T',0 };
+    const LPCWSTR szRichEdit = RICHEDIT_CLASS20W;
+    struct msi_streamin_info info;
+    msi_control *control;
+    LPCWSTR text;
+    EDITSTREAM es;
+    DWORD style;
 
-    FIXME("%p %p\n", dialog, rec);
+    style = WS_BORDER | ES_MULTILINE | WS_VSCROLL | ES_READONLY | ES_AUTOVSCROLL;
+    control = msi_dialog_add_control( dialog, rec, szRichEdit, style );
 
-    msi_dialog_add_control( dialog, rec, szEdit, WS_BORDER |
-                 ES_MULTILINE | WS_VSCROLL | ES_READONLY | ES_AUTOVSCROLL );
+    text = MSI_RecordGetString( rec, 10 );
+    info.string = strdupWtoA( text );
+    info.offset = 0;
+    info.length = lstrlenA( info.string ) + 1;
+
+    es.dwCookie = (DWORD_PTR) &info;
+    es.dwError = 0;
+    es.pfnCallback = msi_richedit_stream_in;
+
+    SendMessageW( control->hwnd, EM_STREAMIN, SF_RTF, (LPARAM) &es );
+
+    HeapFree( GetProcessHeap(), 0, info.string );
 
     return ERROR_SUCCESS;
 }
@@ -1367,6 +1408,8 @@
     if( !hMsiHiddenWindow )
         return FALSE;
 
+    hRichedit = LoadLibraryA("riched20");
+
     return TRUE;
 }
 
@@ -1375,4 +1418,5 @@
     DestroyWindow( hMsiHiddenWindow );
     UnregisterClassW( szMsiDialogClass, NULL );
     uiThreadId = 0;
+    FreeLibrary( hRichedit );
 }


More information about the wine-patches mailing list