|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
How do I take away the size limit on a limited sized string?
Hi Guys,
In my program I am using API to find out the name of the workstation... Code:
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Dim Workstation As String Workstation = String(50, " ") GetComputerName Workstation, 50 'gets the comp. name However, because I am using the String() function on 'Workstation ', it limits the string to 50 characters.... and when I use the 'Workstation' string in the same context as other strings, it seems to limit them too. EG when I use run the following command: Code:
msgbox Workstation & "Hello, this is an example string that wont even appear!!!! :-("
The program simply produces a message box that says the computer name, but not the 'Hello' string that I put on the end. How do I get around this, and remove the 'limit'. Thanks! (come on Doug, I know you can solve this for me!)
__________________
LozWare Website Directory Whooo! Free submissions, no recip needed. I'm a nice guy
Last edited by LozWare : August 20th, 2006 at 05:04 PM. |
|
#2
|
||||
|
||||
|
Don't worry, i've sorted it out now. Just incase anyone else ever has a similar problem, then here's how I solved it:
Code:
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Dim Workstation As String Workstation = String(50, " ") GetComputerName Workstation, 50 'gets the comp. name Workstation = Trim(Replace(Workstation, Chr(0), "")) |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > How do I take away the size limit on a limited sized string? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|