Re: VB6 - RichEdit and MsftEdit lightweight Unicode Textbox (only code, no OCX requir
Quote:
Originally Posted by
fafalone
This class uses the system control so not sure what you mean... there are two or three system richedit controls though. The old riched20, msftedit, and on Win11 the new riched20.
how can used new riched20?
Re: VB6 - RichEdit and MsftEdit lightweight Unicode Textbox (only code, no OCX requir
Quote:
Originally Posted by
VanGoghGaming
I asked the AI but didn't find the correct solution. I am using an HP printer.
1 Attachment(s)
Re: VB6 - RichEdit and MsftEdit lightweight Unicode Textbox (only code, no OCX requir
Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0; Richtx32.ocx
This calls the system's built-in RTB control, allowing the image to show the problem more intuitively.
Attachment 195680
Re: VB6 - RichEdit and MsftEdit lightweight Unicode Textbox (only code, no OCX requir
Quote:
Originally Posted by
VanGoghGaming
I used that set.rtf document, and printing results in a black background. If I use the RTB control wrapped with Krool, RTB.selprint printer.hdc there’s no problem.
Re: VB6 - RichEdit and MsftEdit lightweight Unicode Textbox (only code, no OCX requir
Spell checking doesn't work for OFFICERICHEDIT60W... any ideas besides full manual implementation?
Re: VB6 - RichEdit and MsftEdit lightweight Unicode Textbox (only code, no OCX requir
I don't have Office installed but if the control doesn't support the Windows specific IMF_SPELLCHECKING flag (Input Method Framework) for EM_SETLANGOPTIONS then it probably has some other undocumented messages or interfaces that it uses internally because it definitely has spell checking support but Microsoft hasn't published a way to access it outside Word documents (where you could simply use ActiveDocument.SpellingChecked).
Re: VB6 - RichEdit and MsftEdit lightweight Unicode Textbox (only code, no OCX requir
Hello, expert. Is it possible to implement the selprint functionality wrapped by Krool in the RichTextBox class module? Or could you explain the differences in principle between yours and his printing module? His selprint module prints without the black background.
Thank you for your reply
Re: VB6 - RichEdit and MsftEdit lightweight Unicode Textbox (only code, no OCX requir
Quote:
Originally Posted by
VanGoghGaming
I don't have Office installed but if the control doesn't support the Windows specific IMF_SPELLCHECKING flag (Input Method Framework) for EM_SETLANGOPTIONS then it probably has some other undocumented messages or interfaces that it uses internally because it definitely has spell checking support but Microsoft hasn't published a way to access it outside Word documents (where you could simply use ActiveDocument.SpellingChecked).
Sir, why can I use the selprint function wrapped with krool normally, but your print function has problems? I asked AI, but none could solve this issue. Could you please tell me?
Re: VB6 - RichEdit and MsftEdit lightweight Unicode Textbox (only code, no OCX requir
Quote:
Originally Posted by
xxdoc123
i used i win10 work ok.but Why did the printed text turn into white letters on a black background?
I converted the table in Word to RTF format and then filled it out.
I opened the RTF file and printed it directly, the background is not black.
Attachment 195664
Attachment 195663
NOW FIXED
Code:
Friend Function PrintRichEdit(Optional sFileName As String, _
Optional lPDFHorizontalMargin As Long = 50, _
Optional lPDFVerticalMargin As Long = 50) As Boolean
Dim di As DOCINFO, pd As TPRINTDLG, fr As FORMATRANGE
Dim hDC As Long, cxPhysOffset As Long, cyPhysOffset As Long
Dim cxPhysWidth As Long, cxPhysHeight As Long
Dim cpMin As Long, bSuccess As Boolean
Dim nLogPixelsX As Long, nLogPixelsY As Long
' ???1???????
Dim savedSel As CHARRANGE
SendMessageVal m_hWndRichEdit, EM_EXGETSEL, 0&, VarPtr(savedSel)
pd.lStructSize = Len(pd): pd.Flags = PD_RETURNDC Or PD_RETURNDEFAULT
If PrintDlg(pd) Then hDC = pd.hDC Else Exit Function
di.cbSize = LenB(di)
If Len(sFileName) Then di.lpszOutput = StrPtr(sFileName)
nLogPixelsX = GetDeviceCaps(hDC, LOGPIXELSX)
nLogPixelsY = GetDeviceCaps(hDC, LOGPIXELSY)
cxPhysOffset = CLng(GetDeviceCaps(hDC, PHYSICALOFFSETX) * 1440 / nLogPixelsX)
cyPhysOffset = CLng(GetDeviceCaps(hDC, PHYSICALOFFSETY) * 1440 / nLogPixelsY)
cxPhysWidth = CLng(GetDeviceCaps(hDC, PHYSICALWIDTH) * 1440 / nLogPixelsX)
cxPhysHeight = CLng(GetDeviceCaps(hDC, PHYSICALHEIGHT) * 1440 / nLogPixelsY)
If cxPhysOffset = 0 Then cxPhysOffset = m_ParentForm.ScaleX(lPDFHorizontalMargin, vbPixels, vbTwips)
If cyPhysOffset = 0 Then cyPhysOffset = m_ParentForm.ScaleY(lPDFVerticalMargin, vbPixels, vbTwips)
With fr
.hDC = hDC: .hdcTarget = hDC
.rcPage.Top = 0: .rcPage.Left = 0
.rcPage.Right = cxPhysWidth
.rcPage.Bottom = cxPhysHeight
.rc.Left = cxPhysOffset
.rc.Right = cxPhysWidth - cxPhysOffset
.rc.Top = cyPhysOffset
.rc.Bottom = cxPhysHeight - cyPhysOffset
' ???2?????????
SendMessageVal m_hWndRichEdit, EM_SETSEL, 0&, -1&
SendMessageVal m_hWndRichEdit, EM_EXGETSEL, 0&, VarPtr(.chrg)
' ???3????????????????
SendMessageVal m_hWndRichEdit, EM_SETSEL, -1&, -1&
If StartDoc(hDC, di) Then
bSuccess = True
Do While (.chrg.cpMin < .chrg.cpMax) And bSuccess
bSuccess = StartPage(hDC) > 0
If Not bSuccess Then Exit Do
cpMin = SendMessageVal(m_hWndRichEdit, EM_FORMATRANGE, 1&, VarPtr(fr))
If cpMin <= .chrg.cpMin Then
bSuccess = False: Exit Do
End If
.chrg.cpMin = cpMin
bSuccess = EndPage(hDC) > 0
Loop
End If
End With
SendMessageVal m_hWndRichEdit, EM_FORMATRANGE, 0&, 0&
' ???4???????
SendMessageVal m_hWndRichEdit, EM_EXSETSEL, 0&, VarPtr(savedSel)
If bSuccess Then EndDoc hDC Else AbortDoc hDC
PrintRichEdit = bSuccess
End Function