Results 1 to 2 of 2

Thread: Subclassing ThinBasic's Ansi window and change it to a unicode window !!

  1. #1
    Member
    Join Date
    Aug 2015
    Location
    Keralam, India
    Posts
    120
    Rep Power
    18

    Subclassing ThinBasic's Ansi window and change it to a unicode window !!

    Hi all,
    I don't know if anyone tried this already. This is a nice trick which you can change a normal thinbasic ansi window to a unicode window. For an experiment, I started with a normal gui window script which thinAir offers freely.
    At the %WM_INITDIALOG case in CbDialog function, you need to call the SetWindowLong function. Remember !! Use ANSI version of SetWindowLong. Because, you are dealing with thinBasic's ansi window.
    OriginalWndProc = SetWindowLong(CBHNDL, -4, CodePtr(MyWndProc))
    
    Now, you have the original window proc address. We can use it with CallWndProc function. See this.
    This is my WndProc function. Now, this function will decide how thinBasic dialog behaves and acts.
    Function WndProc(hwnd As DWord, message As DWord, wParam As DWord, lParam As Long) As DWord
      'PrintL message
      Select Case message
        Case %WM_SHOWWINDOW
          dim hFnt = Font_Create("Manjari", 12) '// A Malayalam (My native language) font
          SendMessage(hDlg, %WM_SETFONT, hFnt, 1)
          Dim wtt As String = UTF8ToWideChar$("തിൻ ബേസിക് വിൻഡോ")        
          SetWindowText(hDlg, VarPtr(wtt))  '// Although, I am using the wide version, this is not worked. 
     
          dim btnHwnd As Number = Win_GetDlgItem(hDlg, %bClose)       
          SendMessage(btnHwnd, %WM_SETFONT, hFnt, 1)  
          SetWindowText(btnHwnd, UTF8ToWideChar$("തിൻ ബട്ടൺ")) '// But this surely worked.
    
        Case %WM_LBUTTONDOWN
          PrintL("L button click")
      End Select
      return CallWindowProc(OriginalWndProc, hwnd, message, wParam, lParam) '// here we passing control to original wndproc
    End Function
    
    Here is the image of my dialog. You can clearly see that the button displays correct Malayalam text and dialog title is not. You need to use the ansi version of CallWindowProc. Because, you are dealing with the ansi window. But inside the WndProc, you should call the Wide version of api functions.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Captured_000809.jpg 
Views:	17 
Size:	10.5 KB 
ID:	10260  

  2. #2
    Member
    Join Date
    Aug 2015
    Location
    Keralam, India
    Posts
    120
    Rep Power
    18
    After posting the above text, I just tried the SetWindowText & SendMessage functions inside the CbDialog function. Amazingly, it worked very well. The same result. So I am assuming that ThinBasic's dialog is ANSI, but controls are UNICODE.

Similar Threads

  1. window sdk possible like petzold ?
    By Lionheart008 in forum UI (User Interface)
    Replies: 13
    Last Post: 18-01-2010, 21:12
  2. ThinBasic - active window or application?
    By CARLO in forum Shout Box Area
    Replies: 4
    Last Post: 15-12-2009, 19:01
  3. Is this ASCII, ANSI, UNICODE or something else?
    By martin in forum thinAir General
    Replies: 12
    Last Post: 29-04-2009, 09:56
  4. window always on top?
    By sandyrepope in forum UI (User Interface)
    Replies: 1
    Last Post: 24-08-2007, 07:41
  5. tip of the day window?
    By sandyrepope in forum UI (User Interface)
    Replies: 2
    Last Post: 20-08-2007, 00:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •