Sign in to follow this  
Followers 0
realkiller

Problem net view

2 posts in this topic

i am trying to view all computers using net view, the problem is i only get my own computer and not the rest(i am in the same workgroup)

#include <GDIPlus.au3>
#include <GuiComboBox.au3>
#Include <File.au3>
#include <Array.au3>


Global Const $AC_SRC_ALPHA      = 1
Global Const $ULW_ALPHA         = 2
Global $old_string = "", $runthis = ""
Global $launchDir = @DesktopDir

FileInstall("G:\Other\Remote 4U\Remote4U.png", @ScriptDir&"\Remote4U.png")
FileInstall("G:\Other\Remote 4U\grey.GIF", @ScriptDir&"\grey.GIF")

_GDIPlus_Startup()
$pngSrc = @scriptdir&"\Remote4U.png"
$hImage = _GDIPlus_ImageLoadFromFile($pngSrc)
$width =  _GDIPlus_ImageGetWidth ($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)

; Create layered window

$GUI = GUICreate("Remote 4U", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)

SetBitMap($GUI, $hImage, 0)
; Register notification messages


GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()


;fade in png background
for $i = 0 to 255 step 10
    SetBitMap($GUI, $hImage, $i)
next


; create child MDI gui window to hold controls
; this part could use some work - there is some flicker sometimes...
$controlGui = GUICreate("ControlGUI", $width, $height, 0,0,$WS_POPUP,BitOR($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
$pclist=GUICtrlCreateListView  ("Name|Status | OS | GHZ | Ram | Dell Tag", 380,35,300,320)
; child window transparency is required to accomplish the full effect, so $WS_EX_LAYERED above, and
; I think the way this works is the transparent window color is based on the image you set here:

GUICtrlCreatePic(@ScriptDir & "\grey.gif",0,0,$width,$height)
GuiCtrlSetState(-1,$GUI_DISABLE)

$Ldapknop = GUICtrlCreateButton("Scan LDAP", 450, 0, 100)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1,0xFFFFFF)

$NetViewknop = GUICtrlCreateButton("Scan Net View", 570, 0, 100)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1,0xFFFFFF)






; just a text label



GUISetState()




While 1
$msg = GUIGetMsg()

    Select
        

Case $msg = $Ldapknop
            
Case $msg = $NetViewknop
ProgressOn("Progress", "Refeshing", "0 percent")

RunWait(@ComSpec & ' /c net view > ' & @TempDir & "\netview.txt", '', @SW_HIDE)
$count = _FileCountLines(@TempDir & "\netview.txt")
$file = FileOpen(@TempDir & "\netview.txt", 0)
For $i = 0 To $count 
    ProgressSet( $i, $count="100" & " percent")
    $line = FileReadLine($file)
    If StringInStr($line, "\\") <> 0 Then
    $NetView = _StringBetween1($line, "\\", " ")
    EndIf
Next

FileClose($file)
FileDelete(@TempDir & "\netview.txt")
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
GUICtrlCreateListViewItem($NetView&"|None|XP|3.0|1024|3d552bg",$pclist)



Case $msg = $GUI_EVENT_CLOSE
Exit
    EndSelect




WEnd


AdlibDisable ()
if $runthis <> "" then 
    if fileexists($launchDir & "\" & $runthis) then 
        beep(1000,50)
        beep(2000,50)
        _ShellExecute($runthis, "", $launchDir)
    EndIf
EndIf

GUIDelete($controlGui)
;fade out png background
for $i = 255 to 0 step -10
    SetBitMap($GUI, $hImage, $i)
next

; Release resources
_WinAPI_DeleteObject($hImage)
_GDIPlus_Shutdown()




; ====================================================================================================

; Handle the WM_NCHITTEST for the layered window so it can be dragged by clicking anywhere on the image.
; ====================================================================================================


Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
  if ($hWnd = $GUI) and ($iMsg = $WM_NCHITTEST) then Return $HTCAPTION
EndFunc

; ====================================================================================================


; SetBitMap
; ====================================================================================================


Func SetBitmap($hGUI, $hImage, $iOpacity)
  Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend

  $hScrDC  = _WinAPI_GetDC(0)
  $hMemDC  = _WinAPI_CreateCompatibleDC($hScrDC)
  $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
  $hOld    = _WinAPI_SelectObject($hMemDC, $hBitmap)
  $tSize   = DllStructCreate($tagSIZE)
  $pSize   = DllStructGetPtr($tSize  )
  DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth ($hImage))
  DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
  $tSource = DllStructCreate($tagPOINT)
  $pSource = DllStructGetPtr($tSource)
  $tBlend  = DllStructCreate($tagBLENDFUNCTION)
  $pBlend  = DllStructGetPtr($tBlend)
  DllStructSetData($tBlend, "Alpha" , $iOpacity    )
  DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
  _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
  _WinAPI_ReleaseDC   (0, $hScrDC)
  _WinAPI_SelectObject($hMemDC, $hOld)
  _WinAPI_DeleteObject($hBitmap)
  _WinAPI_DeleteDC    ($hMemDC)
EndFunc
; I don't like AutoIt's built in ShellExec. I'd rather do the DLL call myself.
Func _ShellExecute($sCmd, $sArg="", $sFolder = "", $rState = @SW_SHOWNORMAL)
   $aRet = DllCall("shell32.dll", "long", "ShellExecute", _
      "hwnd",   0, _
      "string", "", _
      "string", $sCmd, _
      "string", $sArg, _
      "string", $sFolder, _
      "int",    $rState)
   If @error Then Return 0
       
   $RetVal = $aRet[0]
   If $RetVal > 32 Then
       Return 1
   else  
    Return 0
   EndIf
EndFunc

Func _StringBetween1($s_String, $s_Start = 0, $s_End = 0)
    $s_Start = StringInStr($s_String, $s_Start) + StringLen($s_Start)
    Return StringMid($s_String, $s_Start, StringInStr($s_String, $s_End) - $s_Start)
EndFunc

Share this post


Link to post
Share on other sites



Is it a problem with the script or when you do a run net view do you also get nothing?


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0