It is currently Wed Jun 19, 2013 1:08 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: The Upper limit of GetWindowText_()
PostPosted: Wed Jun 04, 2003 11:20 am 
Offline
Enthusiast
Enthusiast

Joined: Wed Jun 04, 2003 8:44 am
Posts: 168
Location: Switzerland
Hi all

How big can the third parameter be in the GetWindowText_(,,) function? I search the forum and see someonme uses 10000, but what is the upper limit?

What happen if the window text is more than the upper limit, how can i retrieve all the text then?

Thanks

Cecil


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2003 12:32 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5184
Location: Germany
There should be no upper limit to that function.
The only limit you will run into is PB's limit of the String size (max 64K)

However, if you use a memorybuffer instead of a PB string, it should be unlimited.

Timo

_________________
Perl – The only language that looks the same before and after RSA encryption.
-- Keith Bostic


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2003 12:54 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Jun 04, 2003 8:44 am
Posts: 168
Location: Switzerland
Hi there

Can you give me an example of how to use a memorybuffer in the GetWindowText_().

I am new to this Pure Basic and am just searching for PB codes to learn the stuff

hanks in advance

Cecil


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2003 12:56 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jun 02, 2003 1:06 pm
Posts: 714
Location: Norway
The question is: why would you want a windowtext with more than 65536 characters..)) hehe ;)

_________________

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2003 12:59 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Jun 04, 2003 8:44 am
Posts: 168
Location: Switzerland
Good question.

The reason is i am not getting the window title text, but say the text in the text field itself.

For example
So instead of getting the "Untitled - Notepad", i am getting the text in the note pad.

Cecil


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2003 1:05 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jun 02, 2003 1:06 pm
Posts: 714
Location: Norway
aaahh.. ok... my bad... :roll:

_________________

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2003 1:06 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Apr 25, 2003 7:09 pm
Posts: 217
Location: (Madrid) Spain
You can do it with pointers:

Code:
If OpenWindow(0, 100,100,300,300,#PB_Window_SystemMenu,"Hello")
  If CreateGadgetList(WindowID())
    StringGadget(0,10,10,200,20,"this is a demo")
  EndIf

  *buffer=AllocateMemory(0,100000)
  GetWindowText_(GadgetID(0),*buffer,100000)
 
  MessageRequester("result",PeekS(*buffer),0)
 
  FreeMemory(0)
EndIf

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
End


Try it with a long text... :wink:

_________________
[:: PB Registered ::]

WinXP KUbuntu Intel Quad 2.4GHz 4GB RAM GeForce 8500GT
WinXP KUbuntu AthlonXP 2400+ 1024 DDR400 GeForceFX 6800LE Fortissimo II DE


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2003 1:13 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Jun 04, 2003 8:44 am
Posts: 168
Location: Switzerland
Thanks a lot. Really appreciate your quick response.

Cecil


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2003 1:37 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 16, 2003 3:47 pm
Posts: 1285
Location: England
You can also use the GetWindowTextLength_() function to find out the size of the buffer needed:

Code:
If OpenWindow(0, 100,100,300,300,#PB_Window_SystemMenu,"Hello")
  If CreateGadgetList(WindowID())
    StringGadget(0,10,10,200,20,"This is text")
  EndIf
    bufferSize=GetWindowTextLength_(GadgetID(0))+1
  If bufferSize > 0
      *buffer=AllocateMemory(0,bufferSize)
    GetWindowText_(GadgetID(0),*buffer,bufferSize)
   
    MessageRequester("result",PeekS(*buffer, bufferSize),0)
   
    FreeMemory(0)
    Else
        MessageRequester("result","",0)
    EndIf
EndIf

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
End


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2003 2:13 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Jun 04, 2003 8:44 am
Posts: 168
Location: Switzerland
Thanks a lot. This is a good idea to do, so my programme will not take up too much resources.

thanks

Cecil


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye