Good find. Interesting even if not obviously useful.
VB's intrinsic controls' .Text, .Caption, etc. seem to go through OLE plumbing that looks at control.Font.Charset, so I'm not sure we can jigger things to make those work.
Code:Option Explicit Private Enum WINDOW_MESSAGES WM_SETTEXT = &HC& End Enum #If False Then Dim WM_SETTEXT #End If Private Declare Function SendMessageA Lib "user32" ( _ ByVal hWnd As Long, _ ByVal wMsg As WINDOW_MESSAGES, _ Optional ByVal wParam As Long, _ Optional ByVal lParam As Long) As Long Private Sub Form_Load() Dim F As Integer Dim SampleBytes() As Byte F = FreeFile(0) Open App.Path & "\sample.txt" For Binary Access Read As #F ReDim SampleBytes(LOF(F) - 1) Get #F, , SampleBytes ReDim Preserve SampleBytes(LOF(F)) Close #F SendMessageA Text1.hWnd, WM_SETTEXT, , VarPtr(SampleBytes(0)) End SubCode:<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyIdentity type="win32" name="Joeblow.Project1" version="1.0.0.0"/> <dependency> <dependentAssembly> <assemblyIdentity language="*" name="Microsoft.Windows.Common-Controls" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" type="win32" version="6.0.0.0" /> </dependentAssembly> </dependency> <application> <windowsSettings> <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage> </windowsSettings> </application> </assembly>




Reply With Quote