• Welcome to Valhalla Legends Archive.
 

Can Someone Verify This

Started by ShaDoWDeM, May 18, 2006, 02:01 PM

Previous topic - Next topic

l)ragon

Quote from: J on May 18, 2006, 08:14 PM
I revamped the first function for you, fixing a few things. Due to my lack of VB installed, or even Windows for that matter, it's untested, but it should work.

Fixes:

1. Variable declarations - str is declared and not used.
2. If statements - instead of doing four lines (start, action, action, end), why not just use your label and jump to that in one line?
3. Default values - remember that numbers are initalized to 0, booleans to false (at least, in Java), and Strings to "". You don't need to assign a 0 value to a number when it already has that value.
4. Last but not least, indent. Unless of course SMF killed your code (place it within [code.][/.code] tags, minus the ".")

Private Sub getHandle()
    On Error Goto Err
    Dim HWnd As Long, PID As Long

    HWnd = FindWindow("SWarClass", vbNullString)
    If HWnd = 0 Then Goto Err 'Window not found

    Call GetWindowThreadProcessId(HWnd, PID)
    pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, PID)

Err:
    '// No action is needed
End Sub


You shoulden't use Err as a linefeed in VB6.
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

rabbit

If you're going to capture errors, CAPTURE them.  Using "On Error Goto label" and having nothing after "label" is almost as bad as using "On Error Resume Next".
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

ShaDoWDeM

#17
yupper

warz

What is this program supposed to do?

ShaDoWDeM

#19
anti-hack which i got done