diff dwt/internal/win32/OS.d @ 237:e2affbeb686d

Making tango.sys.win32.Types and dwt.internal.win32.WINTYPES to match common declaration. Make ansi charactars of type ubyte.
author Frank Benoit <benoit@tionex.de>
date Thu, 19 Jun 2008 03:25:36 +0200
parents 51a84342d244
children d8c3d4a4f2b0
line wrap: on
line diff
--- a/dwt/internal/win32/OS.d	Sun Jun 08 15:12:40 2008 +0200
+++ b/dwt/internal/win32/OS.d	Thu Jun 19 03:25:36 2008 +0200
@@ -223,7 +223,10 @@
         OSVERSIONINFO info;
         info.dwOSVersionInfoSize = OSVERSIONINFO.sizeof;
         if(!OS.GetVersionEx(&info)){
-            MessageBoxA(null, "DWT Unicode version applications can't run in a non-Unicode platform !", "Error", MB_OK|MB_ICONERROR);
+            MessageBoxA(null,
+                    _PCHAR!("DWT Unicode version applications can't run in a non-Unicode platform !"),
+                    _PCHAR!("Error"),
+                    MB_OK|MB_ICONERROR);
             tango.stdc.stdlib.exit(-1);
         }
         //OSVERSIONINFO info = new OSVERSIONINFOW ();
@@ -3521,8 +3524,8 @@
     *cast(HTREEITEM *)prc = hitem;
     return cast(bool) SendMessage( hwnd, TVM_GETITEMRECT, code, cast(int)prc );
 }
-static int strlen( char* ptr ){
-    return tango.stdc.string.strlen( ptr );
+static int strlen( CHAR* ptr ){
+    return tango.stdc.string.strlen( cast(char*)ptr );
 }
 
 static void POINTSTOPOINT( inout POINT pt, int pts) {
@@ -3539,13 +3542,13 @@
 
 // convert UTF-8 to MBCS
 alias StrToMBCS StrToMBCSs;
-public char[] StrToMBCS(char[] sc, uint codepage = 0) {
-    char[] ret = sc;
+public CHAR[] StrToMBCS(char[] sc, uint codepage = 0) {
+    CHAR[] ret = cast(CHAR[]) sc;
     try{
         foreach (char c; sc){
             if (c >= 0x80)
             {
-                char[] result;
+                CHAR[] result;
                 int i;
                 wchar[] ws = .toString16(sc);
                 result.length = OS.WideCharToMultiByte(codepage, 0, ws.ptr, ws.length, null, 0, null, null);
@@ -3556,7 +3559,7 @@
         }
     }catch(Exception e){
         // do nothing
-        ret = "";
+        ret = null;
     }
     return ret;
 }
@@ -3604,11 +3607,11 @@
     return StrToWCHARs(sc, true ).ptr;
 }
 
-public char[] MBCSsToStr(char[] string, uint codepage = 0){
+public char[] MBCSsToStr(CHAR[] string, uint codepage = 0){
     return MBCSzToStr( string.ptr, string.length, codepage);
 }
 
-public char[] MBCSzToStr(char* pString, int _length = -1, uint codepage = 0) {
+public char[] MBCSzToStr(PCHAR pString, int _length = -1, uint codepage = 0) {
     // null terminated string pointer
     if(_length == -1){
         _length = 0;
@@ -3679,7 +3682,7 @@
 } // end of OLE_COM
 
 
-public static wchar[] _mbcszToWs(char* pMBCS, int len, uint codepage = 0)
+public static wchar[] _mbcszToWs(PCHAR pMBCS, int len, uint codepage = 0)
 {
     wchar[] wbuf;
     // Convert MBCS to unicode