hennep
Programmer
- Dec 10, 2000
- 429
How can I make this VB code work in CBuilder:
Dim BoundingRect As RECT
Dim TempDC As Long
Dim strText As String
GetClientRect Text1.hwnd, BoundingRect
TempDC = CreateCompatibleDC(Form1.hdc)
strText = "C:\This\Is\A\Long\String\To\A\File.Name"
DrawText TempDC, strText, Len(strText), BoundingRect, DT_PATH_ELLIPSIS_MODIFY
Text1.Text = strText
DeleteDC TempDC
I already tried to convert it myself but I get to many errors that I don't understand.
I want to fit a long file name into the caption of a label.
This name: "C:\This\Is\A\Long\String\To\A\File.Name"
should to convert to something similar to this:
"C:\This\Is\...\A\File.Name"
But only when the label is too small to hold the complete file name.
Dim BoundingRect As RECT
Dim TempDC As Long
Dim strText As String
GetClientRect Text1.hwnd, BoundingRect
TempDC = CreateCompatibleDC(Form1.hdc)
strText = "C:\This\Is\A\Long\String\To\A\File.Name"
DrawText TempDC, strText, Len(strText), BoundingRect, DT_PATH_ELLIPSIS_MODIFY
Text1.Text = strText
DeleteDC TempDC
I already tried to convert it myself but I get to many errors that I don't understand.
I want to fit a long file name into the caption of a label.
This name: "C:\This\Is\A\Long\String\To\A\File.Name"
should to convert to something similar to this:
"C:\This\Is\...\A\File.Name"
But only when the label is too small to hold the complete file name.