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" <epank...@...> 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