Chris S.
(MM club member)
2005-08-05 11:30 PM
KiXforms - Active Directory Browser Version 2

Here is a new Active Directory Browser that utilizes TreeViews and fnLDAPQuery(). As it uses ADO AD to query active directory it is as fast as Active Directory Users and Computers when browsing your AD. In fact, I've often found myself double-clicking on objects and wondering why the object properties didn't come up.

Requires some version of KiXforms, but I'm not sure which. If it doesn't display properly on your system, download the latest development build. Also requires Windows 2000 and higher and Active Directory.

I have plans for this form upcoming, so stay tuned. If you, however, want to use this as a template for your own project feel free. Just give me credit for building the template.

Code:
Break On

$=SetOption("Explicit","On")

Global $System,$Form,$MessageBox1,$ImageList1

;region === KiXforms Region ===============================================

$System = CreateObject("Kixtart.System")

;region === MessageBox ====================================================
$MessageBox1 = $System.MessageBox()
$MessageBox1.Title = "Information..."
$MessageBox1.Style = 68
;endregion

;region === ImageList =====================================================
$ImageList1 = $System.ImageList
$ImageList1.ImageSize = 16,16
$ImageList1.TransparentColor = 255,0,255
$ImageList1.AddStrip($System.Bitmap.FromBase64String(fnBitmapStrip()))
;endregion

;region === Main Form =====================================================
$Form = $System.Form()
$Form.DockPadding = 1,1,1,1

$Form.Icon = $ImageList1.Images(9)
$Form.FontName = "Tahoma"
$Form.Size = 800,600
$Form.Center()
;endregion

;region === Clipboard =====================================================
$Form.Clipboard1 = $Form.Controls.TextBox("",0,0,0,0)
$Form.Clipboard1.Hide
;endregion

;region === Menus =========================================================
$Form.Menu = $System.MainMenu()

;region === File Menu =====================================================
$Form.FileMenu = $Form.Menu.MenuItems.Add("&File")

$Form.FileMenu.ExitApp = $Form.FileMenu.MenuItems.Add("Exit")
$Form.FileMenu.ExitApp.OnClick = "Quit()"
;endregion

;region === Edit Menu =====================================================
$Form.EditMenu = $Form.Menu.MenuItems.Add("&Edit")

$Form.EditMenu.CopyADsPath = $Form.EditMenu.MenuItems.Add("Copy ADsPath of Current Container")
$Form.EditMenu.CopyADsPath.OnClick = "fnCopy()"
;endregion

;endregion

;region === Toolbar =======================================================
$Form.ToolGroupBox = $Form.Controls.GroupBox()
$Form.ToolGroupBox.Height = 30
$Form.ToolGroupBox.Dock = 1

$Form.UpButton = $Form.ToolGroupBox.ToolButton("",2,2,26,26)
$Form.UpButton.FlatStyle = 1
$Form.UpButton.Icon = 47
$Form.UpButton.OnClick = "fnOnUp()"
$Form.UpButton.ToolTipText = "Up One Level"

$Form.Console = $Form.ToolGroupBox.ToolButton("",$Form.UpButton.Right + 2,2,26,26)
$Form.Console.Style = 1
$Form.Console.FlatStyle = 1
$Form.Console.Pushed = 1
$Form.Console.Icon = $ImageList1.Images(3)
$Form.Console.OnClick = "fnOnShowHide()"
$Form.Console.ToolTipText = "Show/Hide Console Tree"
;endregion

;region === Status Bar ====================================================
$Form.StatusGroupBox = $Form.GroupBox()
$Form.StatusGroupBox.Height = 20
$Form.StatusGroupBox.Dock = 2
;endregion

;region === TreeView ======================================================
$Form.TreeView1 = $Form.TreeView()
$Form.TreeView1.Dock = 3
$Form.TreeView1.HideSelection = 0
$Form.TreeView1.ImageList = $ImageList1
$Form.TreeView1.OnAfterSelect = "fnOnAfterSelect()"
$Form.TreeView1.OnBeforeExpand = "fnOnBeforeExpand()"
$Form.TreeView1.Width = $Form.ClientWidth / 4
$Form.TreeView1.Tag = $Form.TreeView1.Width
;endregion

;region === Splitter ======================================================
$Form.Splitter1 = $Form.Splitter()
$Form.Splitter1.Dock = 3
;endregion

$Form.GroupBox1 = $Form.Controls.GroupBox()
$Form.GroupBox1.Dock = 5

;region === Listview Label ================================================
$Form.Label1 = $Form.GroupBox1.Label()
$Form.Label1.BorderStyle = 2
$Form.Label1.Dock = 1
$Form.Label1.Height = 20
$Form.Label1.TextAlign = 16
;endregion

;region === ListView ======================================================
$Form.ListView1 = $Form.GroupBox1.ListView()
$Form.ListView1.Dock = 5
$Form.ListView1.OnDoubleClick = "fnOnDoubleClick()"
$Form.ListView1.SmallImageList = $ImageList1

$ = $Form.ListView1.Columns.Add("Name",0.35*$Form.ListView1.ClientWidth)
$ = $Form.ListView1.Columns.Add("Class",0.25*$Form.ListView1.ClientWidth)
$ = $Form.ListView1.Columns.Add("Description",0.40*$Form.ListView1.ClientWidth)
;endregion

fnAddRootItems()
$Form.Show
;endregion

While $Form.Visible
$=Execute($Form.DoEvents)
Loop

Exit 1

;region === Functions =====================================================

Function fnAddRootItems()
Dim $objDomain,$objContainer,$rootDN,$node,$item,$child,$c
$objDomain = GetObject("LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext"))
Global $lockoutThreshold $lockoutThreshold = $objDomain.lockoutThreshold
$rootDN = Join(Split(Join(Split($objDomain.distinguishedName,"DC="),""),","),".")
$node = $Form.TreeView1.Nodes.Add($rootDN,6,6)
$node.Tag = $objDomain.ADsPath
$Form.Text = $objDomain.ADsPath

For Each $objContainer in $objDomain
Select
Case $objContainer.Class = "organizationalUnit"
$child = $node.Nodes.Add(Split($objContainer.Name,"=")[1],15,15)
$Item = $Form.ListView1.Items.Add(Split($objContainer.Name,"=")[1],15)
Case 1
$child = $node.Nodes.Add(Split($objContainer.Name,"=")[1],5,5)
$Item = $Form.ListView1.Items.Add(Split($objContainer.Name,"=")[1],5)
EndSelect
$Item.SubItems(1).Text = $objContainer.Class
$Item.SubItems(2).Text = $objContainer.Description
$child.Tag = $objContainer.ADsPath
$c=$child.Nodes.Add("")
Next

$Form.TreeView1.SelectedNode = $node
$node.Expand()
EndFunction

Function fnCopy()
$Form.Clipboard1.Text = $Form.Text
$Form.Clipboard1.SelectionLength = Len($Form.Clipboard1.Text)
$Form.Clipboard1.Copy
EndFunction

Function fnLDAPQuery($What,Optional $From,$Filter,$OrderBy,$Scope,$User,$Pswd)

Dim $oCon,$oCMD,$oRS,$sQ,$aR,$C,$R

$sQ="<"+IIf($From="","LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext"),
$From)+">;"+$Filter+";"+IIf(VarType($What)>8192,Join($What,','),$What)+";"+
IIf($Scope<>"base" And $Scope<>"onelevel","subtree",$Scope)

$oCon=CreateObject("ADODB.Connection")
$oCon.Provider="ADsDSOObject"
$oCon.Properties("Encrypt Password").Value=1
$oCon.Properties("ADSI Flag").Value=1
If $User And $Pswd
$oCon.Properties("User ID").Value=$User
$oCon.Properties("Password").Value=$Pswd
EndIf
$oCon.Open("Active Directory Provider")

$oCMD=CreateObject("ADODB.Command")
$oCMD.ActiveConnection=$oCon
$oCMD.CommandText=$sQ
$oCMD.Properties("Page Size").Value=1000
$oCMD.Properties("Timeout").Value=30
$oCMD.Properties("Cache Results").Value=0

If InStr($OrderBy,"distinguishedName")
$oRS=CreateObject("ADODB.Recordset")
$oRS.CursorLocation=3
$oRS.Sort=$OrderBy
$oRS.Open($sQ,$oCon,0,1,1)
Else
If $OrderBy
$oCMD.Properties("Sort On").Value=$OrderBy
EndIf
$oRS=$oCMD.Execute
EndIf
If @ERROR Exit @ERROR EndIf
If $oRS.BOF And $oRS.EOF Exit @ERROR EndIf

$aR = $oRS.GetRows()
Dim $aFR[Ubound($aR,2),Ubound($aR,1)]
For $R=0 to Ubound($aR,2)
For $C=0 to Ubound($aR,1)
$aFR[$R,$C]=$aR[$C,$R]
Next
Next

$fnLDAPQuery=$aFR
EndFunction

Function fnOnAfterSelect()
Dim $node,$sWhat,$aResults,$r,$item
$node = $Form.TreeView1.SelectedNode

$Form.Cursor = $System.CursorStyle.WaitCursor
$Form.Text = $node.Tag
$Form.ListView1.BeginUpdate()
$Form.ListView1.Items.Clear()

$sWhat = "Name","objectClass","description","userAccountControl","badPwdCount","ADsPath"
$aResults = fnLDAPQuery($sWhat,$node.Tag,,,"OneLevel")

For $r = 0 to Ubound($aResults)
If VarType($aResults[$r,1]) & 8192
Select
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "user" And $aResults[$r,3] & 2
$Item = $Form.ListView1.Items.Add($aResults[$r,0],18)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "user" And $aResults[$r,4] = $lockoutThreshold
$Item = $Form.ListView1.Items.Add($aResults[$r,0],19)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "user"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],17)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "computer" And $aResults[$r,3] & 2
$Item = $Form.ListView1.Items.Add($aResults[$r,0],1)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "computer"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],0)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "group"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],22)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "contact"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],4)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "organizationalUnit"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],15)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "domainPolicy"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],7)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "nTFRSSettings"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],14)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "rpcContainer"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],16)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "foreignSecurityPrincipal"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],13)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "volume"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],24)
Case $aResults[$r,1][Ubound($aResults[$r,1])] = "trustedDomain"
$Item = $Form.ListView1.Items.Add($aResults[$r,0],6)
Case 1
$Item = $Form.ListView1.Items.Add($aResults[$r,0],5)
EndSelect
$Item.SubItems(0).Tag = $aResults[$r,5]
$Item.SubItems(1).Text = $aResults[$r,1][Ubound($aResults[$r,1])]
$Item.SubItems(2).Text = IIf(VarType($aResults[$r,2]) & 8192,Join($aResults[$r,2]),$aResults[$r,2])
EndIf
Next

$Form.Label1.Text = " " + $node.Text + " " + $Form.ListView1.Items.Count + " objects"

$Form.ListView1.Tag = $node
$Form.ListView1.EndUpdate()
$Form.Cursor = $System.CursorStyle.Default
EndFunction

Function fnOnBeforeExpand()
Dim $sWhat,$sFilter,$aResults,$r,$node,$child
If $Form.TreeView1.EventNode.Nodes.Count = 1 And $Form.TreeView1.EventNode.Nodes(0).Text = ""
$Form.Cursor = $System.CursorStyle.WaitCursor
$Form.TreeView1.EventNode.Nodes.Remove($Form.TreeView1.EventNode.Nodes(0))
$sWhat = "Name","ADsPath","objectClass"
$sFilter = "(|(objectCategory=organizationalUnit)(objectCategory=container))"
$aResults = fnLDAPQuery($sWhat,$Form.TreeView1.EventNode.Tag,$sFilter,,"OneLevel")
For $r = 0 to Ubound($aResults)
Select
Case AScan($aResults[$r,2],"organizationalUnit")=>0
$node = $Form.TreeView1.EventNode.Nodes.Add($aResults[$r,0],15,15)
$node.Tag = $aResults[$r,1]
$child = $node.Nodes.Add("")
Case AScan($aResults[$r,2],"container")=>0
$node = $Form.TreeView1.EventNode.Nodes.Add($aResults[$r,0],5,5)
$node.Tag = $aResults[$r,1]
$child = $node.Nodes.Add("")
EndSelect
Next
$Form.Cursor = $System.CursorStyle.Default
EndIf
$Form.TreeView1.EventNode.Expand()
EndFunction

Function fnOnDoubleclick()
Dim $item,$node,$i
$item = $Form.ListView1.SelectedItem
$node = $Form.TreeView1.SelectedNode
If $item.SubItems(1).Text = "organizationalUnit" Or $item.SubItems(1).Text = "container"
$node.Expand()
For $i = 0 to $node.Nodes.Count - 1
If $node.Nodes($i).Text = $item.Text
$Form.TreeView1.SelectedNode = $node.Nodes($i)
EndIf
Next
fnOnBeforeExpand()
Else
If $MessageBox1.Show($item.SubItems(0).Tag+@CRLF+@CRLF+"Copy to clipboard?") = 6
$Form.Clipboard1.Text = $item.SubItems(0).Tag
$Form.Clipboard1.SelectionLength = Len($Form.Clipboard1.Text)
$Form.Clipboard1.Copy
EndIf
EndIf
EndFunction

Function fnOnUp()
$Form.Cursor = $System.CursorStyle.WaitCursor
$Form.TreeView1.SelectedNode = $Form.TreeView1.SelectedNode.Parent
$Form.Cursor = $System.CursorStyle.DefaultCursor
EndFunction

Function fnOnShowHide()
If $Form.TreeView1.Visible
$Form.TreeView1.Hide
$Form.Splitter1.Hide
$Form.GroupBox1.Left = 0
$Form.GroupBox1.ClientWidth = $Form.ClientWidth
$Form.Refresh()
Else
$Form.TreeView1.Show
$Form.Splitter1.Show
$Form.GroupBox1.Dock = 5
$Form.Refresh()
EndIf
EndFunction

Function fnBitmapStrip()
$fnBitmapStrip = "
Qk32DAAAAAAAAHYAAAAoAAAAkAEAABAAAAABAAQAAAAAAIAMAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/AAAA//8A/wAAAP8A
/wD//wAA////ANAAAAAAAADd0AAAAAD//93QAAAAAAAA3d3d3d3d3d3d3d3d3d3d3d3d3d3d
3d3d3d3d0AAN3d3d3dAAAA3d3d3d3d3d0A3URN3d3d3QDd3d3d3d3d0A3d3d3dAADd3QDd3d
3d3QAA3d3d3d3d3d3d3dTd0AAAAAAN3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d///d
3d3d3QAAAA3d3d3d3dAN3d3d3YAAAAAA1ERERETd3d3d3dAADd3d3d3d3d3d3d3dd3d3d3d3
dw13d3d3f5mZ/Xd3d3d3AHcN3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d14iHDd3d3df//3
cN3d3d3d3dAHcE7E3d3d0AeA3d3d3d3d1OwN3QAAC/MAAE5g3d3d3Q//8N3d3d1ERERN3dRE
13d3d3dw3d3d3d3d3d3d3d3d3d3d3d3URERERN3d3dRERE+Zmf3d1ERDMzMzMN3d1ERETsDd
3d3de7u7u7BMxESExE3d3QAAC/MAAAAA3d3dAADd3d1/ioiIiIiHcH+KiIj5+Z+ff4qIiITs
B3DURERERERETQAADQAA0AAA3QAAAAAAAADd3XiIdw3d3d13d3f/Dd3d3d3QB4uE7E3d3dAH
iHgN3d0AA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3d3d3//8N0AAACPcN3d3QAAAI9w
3d3dAAAAgzMzjd1/73AAj3DdAAB/+MgN3d0AAAAP+A+MgNd/iId48Id9eIiIiIiCp3DX+AzM
zEh3Ddf4DMzMSHcN1/73zMxIdw3U///0iIiITX8oKCgv//+A1////////3B4iIcAd3dwcHiI
hwB3d3Bw3d1/d3dwfd3d3X+IiHB93d13CP///4Dd3dd3cP//Dd3Q/0T0RE/w3d2d3dAAAAAN
f7i4uLcN3dTX////iIj/cH////f//3AA3QAAAA/4Dd3dAAAAD/gN3d0AAAAP+A3d3dd3AAAP
+A0AAACPcN3d3dAAAAAACPcN3dd/eP//Dd1////////3cNf4AAAACHcN1/gAAAAIdw3Xd3AA
AAh3DdRERERERERNf////////4DXi4uLh3d3fX//93B4iIcAf//3cHiIhwDd3df4+PgN3d3d
1/+Pjw3d3X////8AAN3d3dd////w3dD/SP////Dd3Z3d3QAADd1/////9w3U1NeLi4uHd3d9
f3d/9///f33d0AAAAAAN3d3QAAAAAA3d3dAAAAAADd3d3dAAAAAADQAAAA/4Dd3d3QAAAAAA
/4Dd3dd////w3deIiIiIiIhw1///////dw3X//////93Ddf//////3cN1ERERERERE3Xd3d3
d3d3fd14uLh93d3deIiIcH//93B4iIhwf//3cN3d3X+Pj4Dd3d3df/j48N3df////4993d3d
3df///8A0P//////8N2ZmZ3d3d3d3Xi4uHd33URN3Xi4uH3d3d1///////933d3dAAAAAA3d
3d0AAAAADd3d3QAAAAAN3d3d3QAAAAAN0AAAAAAN3d3d0AAAAAAAAN3d3df///8A3Xd3d3d3
d33deIiIiIj3Dd14iIiIiPcN3XiIiIiI9w3d3d3d3d3d3d3d3d3d3d3d3dd3d93d3d3Xd3d9
eIiIcNd3d314iIhw3d3d13f4+A3d3d3Xd4+PDd1/////h93d3d3d3X//d93QAAAAAAAA3dmZ
3d3d3d3d14uH3d3d1N3d13d33d3d3Xd3d3d3d33d3d3QAAAA3d3d3dAAAADd3d3d0AAAAN3d
3d3d0AAAAN3dAAAAAA3d3d3d3dAAAAAA3d3d3X//d93d3d3d3d3d3d3Xd3d3d3fd3dd3d3d3
d93d13d3d3d33d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3Xd3d93d3d3dd3d33d3d3d
3Xd3fd3d3d3dd3d93Xd3d3d93d3d3d3d13fd3d3d3d3d3d3d3Z3d3d3d3d3dd33d3d3d3d3d
3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3QAAAA3d3d
3d3d3QAAAA3d3d3d13fd3d3d3d3d3d3d
"
EndFunction
;endregion



masken
(MM club member)
2005-08-17 02:43 PM
Re: KiXforms - Active Directory Browser Version 2

Nice indeed

Chris S.
(MM club member)
2005-08-18 11:42 PM
Re: KiXforms - Active Directory Browser Version 2

Edited the original to include the more supported System.Bitmap.FromBase64String method.

Is that better, Shawn?


ShawnAdministrator
(KiX Supporter)
2005-08-19 01:03 AM
Re: KiXforms - Active Directory Browser Version 2

rofl ... "more supported" ... thats one way to put it ja. (chuckle)

20thCenturyBoy
(Lurker)
2005-12-04 01:09 PM
Re: KiXforms - Active Directory Browser Version 2

Unfortunately I get the following errors when trying to run this script:

Code:
 $objDomain = GetObject("LDAP://" + GetObject("LDAP://rootDSE").Get("defaultNamingContext"))



fails with:

ERROR : invalid method/function call: missing ')'!

and

Code:
$sQ="<"+IIf($From="","LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext"),
$From)+">;"+$Filter+";"+IIf(VarType($What)>8192,Join($What,','),$What)+";"+
IIf($Scope<>"base" And $Scope<>"onelevel","subtree",$Scope)



fails with:

ERROR : invalid method/function call: missing comma!

I am using the latest Kixforms (2.3.0 build 45) and Kixtart (Kix2010.451)

I'd love to get this working, any ideas?


Les
(KiX Master)
2005-12-04 03:59 PM
Re: KiXforms - Active Directory Browser Version 2

OS?

ShawnAdministrator
(KiX Supporter)
2005-12-04 04:14 PM
Re: KiXforms - Active Directory Browser Version 2

Plus, might want to try the latest development build of Kixforms ... here:

Kixforms Development Build


20thCenturyBoy
(Lurker)
2005-12-05 01:17 AM
Re: KiXforms - Active Directory Browser Version 2

OS is WinXP SP2.

I'll try the latest dev build of Kixforms, but surely the error is a Kixtart error, not a Kixforms one? I don't understand why the first error is complaining of a missing bracket when they are clearly matched.

Have people successfully run this script without modification? If so what versions of Kix/Kiforms are you using?


LonkeroAdministrator
(KiX Master Guru)
2005-12-05 01:28 AM
Re: KiXforms - Active Directory Browser Version 2

just devide the line:
Code:

$objDomain = GetObject("LDAP://" + GetObject("LDAP://rootDSE").Get("defaultNamingContext"))



to search the error:
Code:

$rootDSE = GetObject("LDAP://rootDSE")
@error ?
$defaultNamingContext = $rootDSE.Get("defaultNamingContext")
@error ?
$objDomain = GetObject("LDAP://" + $defaultNamingContext)
@error ?



Schuliebug
(Hey THIS is FUN)
2005-12-29 11:58 AM
Re: KiXforms - Active Directory Browser Version 2

Doesn't work with KiXforms 2.46.35, does work with 2.46.33! Shawn has been notified of the problem.

Schuliebug
(Hey THIS is FUN)
2005-12-29 02:56 PM
Re: KiXforms - Active Directory Browser Version 2

As of the latest devbuild 2.46.36 it works again.

LonkeroAdministrator
(KiX Master Guru)
2006-06-17 11:38 PM
Re: KiXforms - Active Directory Browser Version 2

just to note.
it does nothing.

just flashes the explorer window really quickly and that's it.


LonkeroAdministrator
(KiX Master Guru)
2006-06-18 12:21 AM
Re: KiXforms - Active Directory Browser Version 2

added some debug lines and suddenly, this is what makes kixtart silently quit:
Code:

$ImageList1 = $System.ImageList
$ImageList1.ImageSize = 16,16
$ImageList1.TransparentColor = 255,0,255
$ImageList1.AddStrip($System.Bitmap.FromBase64String(fnBitmapStrip()))



using wkix 4.52 rc-1 and kf build 46 (just downloaded)


LonkeroAdministrator
(KiX Master Guru)
2006-06-18 12:24 AM
Re: KiXforms - Active Directory Browser Version 2

yet more checking:
$ImageList1.AddStrip($System.Bitmap.FromBase64String(fnBitmapStrip()))

kills kixtart.


Reno
(Fresh Scripter)
2009-12-17 06:41 PM
Re: KiXforms - Active Directory Browser Version 2

I am hoping someone can help me. I built an app using the code Chris S provided here, and it has worked well, but I am now experiencing what Lonkero reported here, that the line:
$ImageList1.AddStrip($System.Bitmap.FromBase64String(fnBitmapStrip()))
kills kixtart. I have confirmed that it is what is killing my app too. It used to happen on just some machines (which I reimaged to fix), now it is most machines (xp sp3).
Can anyone suggest a possible solution to for this. I am not familar with how to create these strips but it looks like that is what I will need to do. Perhaps someone has a converted strip already I can plug in and reassign app icons?
Thanks for any help you might be able to provide.
Reno


Chris S.
(MM club member)
2009-12-17 07:50 PM
Re: KiXforms - Active Directory Browser Version 2

The above script is still working for me. What version of KiXforms and KiXtart are you using?