I'm struggling to get started with this. I keep getting the error "Variable is 
undefined" with my test code, no matter what variations I try. Am I making a 
glaringly obvious error?

I'm declaring the function as follows:

Declare "Function GetTextExtentPoint32 Lib ""gdi32"" (ByVal hDC As Long, ByVal 
lpsz As String, ByVal cbString As Long, byVal lpSize() As Long) As Long"

The error occurs on the following line:

If GetTextExtentPoint32(hdc, "Hello", Len("Hello"), thisTextSize) <> 0 Then

The context is:

Dim thisTextSize(1)
Dim thisSize
Dim hdc

hdc = GetDC(lblSomeText.hwnd)
                
'--->Error occurs on following line:                            
If GetTextExtentPoint32(hdc, "Hello", Len("Hello"), thisTextSize) <> 0 Then

  thisSize = thisTextSize(0)
Else
  thisSize = 0
End If
                



--- In [email protected], "George Henne" <g...@...> wrote:
>
> You might be able to do this with a DECLARE function. The underlying API
> call you have to make is this:
> 
> <http://msdn.microsoft.com/en-us/library/ms901137.aspx>
> 
> 
> 
> >Hi
> >
> >Does anyone know if it's possible to determine the width of a text
> >string at a given font size (similar to VB's TextWidth function)?
> >
> >Andrew
> >
> >
> >
> >------------------------------------
> >
> >Yahoo! Groups Links
> >
> >
> >
>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nsb-ce" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nsb-ce?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to