Many thanks for your latest suggestion. I had already tried this, but
just tried it in tandem with your earlier suggestion, in case the
combination worked. However, I got the same error. So my code is now:

Dim thisTextSize(1)
Dim thisSize
Dim theText
Dim hdc

hdc = GetDC(aControl.hwnd)

theText = "hello"
thisTextSize(0) = 10000

Dim result2

MsgBox "here goes...!"
result2 = GetTextExtentPoint32(hdc, theText, Len(theText), thisTextSize)

If result Then
MsgBox "worked!"
Else
MsgBox "didn't work!"
End If

After the message "here goes...!", I still got the same error ("variable
is undefined: 'GetTextExtentPoint32'").



--- In nsbasic...@yahoogroups.com, "styskul" <epank...@...> wrote:
>
> Again I'm just shooting at the hip here since I can't try anything,
but maybe you need to assign the function call to a variable and then do
your If comparison:
>
> Dim result
>
> result = GetTextExtentPoint32(...)
> if result then
> end if
>
> --- In nsbasic...@yahoogroups.com, "andyx77" sng.alloy@ wrote:
> >
> > Thanks for the suggestion, Styskul.
> >
> > Unfortunately, that doesn't fix it; I still get the same error:
> >
> > "Variable is undefined: 'GetTextExtentPoint32'"
> >
> > Andrew
> >
> >
> > --- In nsbasic...@yahoogroups.com, "styskul" <epankoke@> wrote:
> > >
> > > I don't know if this will make any difference, and I can't test
right now because I don't have NSB/CE at work, but here are a couple of
suggestions:
> > >
> > > Put your text in a variable
> > > Initialize the array element
> > >
> > > So:
> > >
> > > Dim thisTextSize(1)
> > > Dim theText
> > > Dim thisSize
> > > Dim hdc
> > >
> > > hdc = GetDC(lblSomeText.hwnd)
> > >
> > > theText = "Hello"
> > > thisTextSize(0) = 10000 'More inclined to think this is the issue
> > >
> > > '--->Error occurs on following line:
> > > If GetTextExtentPoint32(hdc, theText, Len(theText), thisTextSize)
<> 0 Then
> > >
> > >    thisSize = thisTextSize(0)
> > > Else
> > >    thisSize = 0
> > > End If
> > >
> > >
> > >
> > > --- In nsbasic...@yahoogroups.com, "andyx77" <sng.alloy@> wrote:
> > > >
> > > > 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 nsbasic...@yahoogroups.com, "George Henne" <gh@> 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 nsb-ce@googlegroups.com
To unsubscribe from this group, send email to 
nsb-ce+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nsb-ce?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to