'====================================================================
' Multi-lingual example, simple modal dialog as main.
'====================================================================
' ported from MASM32 example to OxygenBasic

$ filename "Multi_lingual.exe"

'use rtl32
use rtl64

'% review

use corewin

uses dialogs

% DS_CENTER=0x0800
% WM_SETICON=128

==============================================

'MAIN CODE
=============================================
 
'dim nCmdline as asciiz ptr, hInstance as sys
'&nCmdline = GetCommandLine
sys hInstance = GetModuleHandle(NULL)

Init_common_controls()

function DialogProc( sys hDlg, uint uMsg, sys wParam, lParam ) as int callback

  wstring pbuf = space 260
  
  select case uMsg
  
    case WM_INITDIALOG
       sys hStat0 = GetDlgItem(hDlg,1250)
       sys hStat1 = GetDlgItem(hDlg,1251)
       sys hStat2 = GetDlgItem(hDlg,1252)
       sys hStat3 = GetDlgItem(hDlg,1253)
       sys hStat4 = GetDlgItem(hDlg,1254)
       sys hStat5 = GetDlgItem(hDlg,1255)
       sys hStat6 = GetDlgItem(hDlg,1256)
       sys hStat7 = GetDlgItem(hDlg,1257)
       sys hStat8 = GetDlgItem(hDlg,1258)
       sys hStat9 = GetDlgItem(hDlg,1259)
       sys hStat10 =GetDlgItem(hDlg,1260)       

       SendMessage (hDlg, WM_SETICON,1, LoadIcon(hInstance,500))
       
       LoadStringW (hInstance,250,pbuf,260)
       SetWindowTextW (hStat0,pbuf)

       LoadStringW (hInstance,251,pbuf,260)
       SetWindowTextW (hStat1,pbuf)

       LoadStringW (hInstance,252,pbuf,260)
       SetWindowTextW (hStat2,pbuf)

       LoadStringW (hInstance,253,pbuf,260)
       SetWindowTextW (hStat3,pbuf)

       LoadStringW (hInstance,254,pbuf,260)
       SetWindowTextW (hStat4,pbuf)

       LoadStringW (hInstance,255,pbuf,260)
       SetWindowTextW (hStat5,pbuf)

       LoadStringW (hInstance,256,pbuf,260)
       SetWindowTextW (hStat6,pbuf)

       LoadStringW (hInstance,257,pbuf,260)
       SetWindowTextW (hStat7,pbuf)

       LoadStringW (hInstance,258,pbuf,260)
       SetWindowTextW (hStat8,pbuf)

       LoadStringW (hInstance,259,pbuf,260)
       SetWindowTextW (hStat9,pbuf)

       LoadStringW (hInstance,260,pbuf,260)
       SetWindowTextW (hStat10,pbuf)
       

    case WM_COMMAND
      select case loword(wParam)
        case IDCANCEL, IDOK
           EndDialog( hDlg, null )
      end select
      
    case WM_CLOSE
      EndDialog( hDlg, null )
                
  end select

  return 0
end function

sub winmain()

  Dialog( 10,10,360,183, "Multi-Lingual Support",
          WS_VISIBLE|WS_CAPTION|WS_SYSMENU|DS_CENTER or DS_SETFONT,
          8,"MS Sans Serif" )
  CONTROL "Chinese : ",1000,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,18,14,56,10
  CONTROL "Japanese : ",1001,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,18,26,56,10
  CONTROL "Russian : ",1002,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,18,38,56,10
  CONTROL "Greek : ",1003,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,18,50,56,10
  CONTROL "Hindi : ",1004,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,18,62,56,10
  CONTROL "Vietnamese : ",1005,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,18,74,56,10
  CONTROL "Georgian : ",1006,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,18,86,56,10
  CONTROL "Serbian : ",1007,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,18,98,56,10
  CONTROL "Armenian : ",1008,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,18,110,56,10
  CONTROL "Korean : ",1009,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,21,123,56,10
  CONTROL "English:",1010,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_RIGHT,18,136,56,10
  CONTROL "Chinese",1250,"Static",WS_CHILDWINDOW|WS_VISIBLE,76,14,268,10
  CONTROL "Japanese",1251,"Static",WS_CHILDWINDOW|WS_VISIBLE,76,26,268,10
  CONTROL "Russian",1252,"Static",WS_CHILDWINDOW|WS_VISIBLE,76,38,268,10
  CONTROL "Greek",1253,"Static",WS_CHILDWINDOW|WS_VISIBLE,76,50,268,10
  CONTROL "Hindi",1254,"Static",WS_CHILDWINDOW|WS_VISIBLE,76,62,268,10
  CONTROL "Vietnamese",1255,"Static",WS_CHILDWINDOW|WS_VISIBLE,76,74,268,10
  CONTROL "Georgian",1256,"Static",WS_CHILDWINDOW|WS_VISIBLE,76,86,268,10
  CONTROL "Serbian",1257,"Static",WS_CHILDWINDOW|WS_VISIBLE,76,98,268,10
  CONTROL "Armenian",1258,"Static",WS_CHILDWINDOW|WS_VISIBLE,76,110,268,10
  CONTROL "Korean",1259,"Static",WS_CHILDWINDOW|WS_VISIBLE,78,123,268,10
  CONTROL "English",1260,"Static",WS_CHILDWINDOW|WS_VISIBLE,78,136,268,10
  CONTROL "OK",IDOK,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP,288,156,56,14

  CreateModalDialog( null, @DialogProc, 0 )
end sub

winmain()

