![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
I am a new user of Basic4PPC. I tried the following code to get ownerinfo based on a code sample. Upon compiling I get nothing. Obviously, I am doing something wrong here. Here is the code: Sub Globals Dim buff(0) As Byte End Sub Sub App_Start Reg.New1 'Registry object is named 'reg' Form1.Show End Sub Sub Button1_Click If CPPC = false Then Return 'this is not for the desktop Dim m Reg.RootKey(Reg.rtCurrentUser) buff() =Reg.GetValue("ControlPanel\Owner\","Owner") For i = 0 To ArrayLen(buff()) -1 Step 2 If buff(i)=0 Then Exit 'Chr(0) separates the name from other owner entries m = m & Chr(buff(i)) Next Return m Msgbox ("Owner name ",m) TextBox1.Text= m End Sub Sub Button2_Click AppClose End Sub I would appreciate the corrections of the code. Amit Kshetarpal |
|
|||
|
hi, I might be wrong....
1)But can u just Dim m like that? dont u have to do it in the Globals area and define how many elements the array has in it? also 2) you've Dim-ed Buff as (0) bytes long - THATS NO LENGTH? wont u need it long enough to store the name?? {Or does Dim buff(0) mean it can be any length?} (if Im wrong on the above points please correct me, cos Im a newbie?) Last edited by colin9876 : 11-17-2007 at 06:41 PM. |
|
||||
|
Remove 'Return m' if you want the msgbox to appear, and the TextBox be assigned.
Return leaves the sub immediately. Quote:
It is absolutely legal to use it. The result will be a local variable. If it were declared under Sub Globals then it would have been a global variable. See this topic for more information: http://www.basic4ppc.com/help/variables.html 2) You can declare an empty array. Later you will need to redimension it with another dim or (in this case) call a function that returns an array. Code:
buff() =Reg.GetValue("ControlPanel\Owner\","Owner")
Using ArrayLen you can find the size of the array returned. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Accessing info from Windows WM6.1 DLL | aerohost | Questions & Help Needed | 3 | 08-18-2008 06:14 PM |
| How to obatin screen size and o/s info? | alfcen | Questions & Help Needed | 8 | 04-13-2008 04:25 AM |
| Would like some more info | Mr_Gee | Questions & Help Needed | 5 | 02-26-2008 06:01 AM |
| XML-support needed | Frank | Questions & Help Needed | 2 | 01-29-2008 07:56 PM |
| Detab in IDE and Error info | agraham | Basic4ppc Wishlist | 3 | 11-11-2007 11:34 AM |