• Welcome to Valhalla Legends Archive.
 

Invalid use of null?

Started by warz, May 13, 2006, 07:24 PM

Previous topic - Next topic

l)ragon

    Dim HWND As Long, PiD As Long, phandle As Long
   
    HWND = FindWindow(windowclass, windowcaption)
    If (HWND <> 0) Then
        GetWindowThreadProcessId HWND, PiD
        phandle = OpenProcess(PROCESS_ALL_ACCESS, False, PiD)
        If (phandle <> 0) Then
            WriteProcessMemory phandle, ByVal Address&, Value, 1, 0&
        End If
        CloseHandle phandle
    End If

This is how I use those calls from something I built quite some time ago and it still works aswell.

The way you have yours set up looks right.
Your PROCESS_ALL_ACCESS is the right value also.

So what are you useing this on?
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

warz

#16
The problem has been fixed. The visual basic version of my class now works. The definition of VirtualAllocEx was incorrect.

UserLoser

Quote from: warz on May 14, 2006, 07:32 PM
Quote from: UserLoser on May 14, 2006, 07:16 PM
Don't use Null keyword at all in VB...it's rather pointless.  Btw, second parameter should be 0 not False.  There's a difference.  A BOOL isn't same as a boolean in Visual Basic.  NULL isn't same as Null keyword in VB.  Don't use it.  NULL as defined on MSDN would be 0 in Visual Basic (or in anything really).  #define NULL (void*)0 or something to that affect.  MSDN prototypes are all C++ syntaxish based.

Well, false and 0 should be interpreted the same way. Either way, it doesn't change the result of the call.

False and 0 in Visual Basic is not the same as the Null keyword in Visual Basic at all.  If anything needs to be passed as a null parameter, use 0 (same thing as passing vbNullString aka "")

warz

Well, this is fairly old, but I wasn't talking about the Null keyword. I was only talking about the False keyword, and 0.

l2k-Shadow

the way i interpret it is that False and 0 are the same, however, Null is more like the idea of nothing, while 0 is still a value of a defined variable.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

Joe[x86]

As far as Java is concerned, false and 0 are values, that of a boolean or an int. As for null, it's a 0x0000000000000000 pointer to a java.lang.Object, I believe.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

MyndFyre

I realize that this is the VB forum, but I couldn't let misinformation go.

Quote from: J on May 24, 2006, 07:37 AM
As for null, it's a 0x0000000000000000 pointer to a java.lang.Object, I believe.
Well, it's only 0x00000000 on 32-bit platforms.  And it's not pointing to anything, that's why it's null.  0x00000000 is usually an invalid memory reference.

null can be assigned to any reference of which the type is derived from Object.  This should be more or less any reference, since all Java classes derive from java.lang.Object. 

I'm not sure whether null in Java is implicitly typed.  In C#, there are implicit null typing rules, such as:

string str = "abc";
IPAddress addr = Dns.Resolve("forum.valhallalegends.com").AddressList[0];
str = addr = null;

Line 3 would cause a compile-time error because, even though null is being assigned to addr, addr's type is IPAddress, and even as it's null, it can't be assigned to str.

In Visual Basic .NET, the keyword Nothing should be used instead of Null when you are referring to a null reference.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Joe[x86]

In Java, if I understand correctly, line three would also provide you with a nice error, but (again, I think) when null is passed or assigned it's assumed that it's a java.lang.Object, so replacing line three with something along the lines of addr = (IPAddress)null; would be allowed by the syntax (it may be incomptable types, but that's a different story).

But this is a nice topic and I don't want to kill it, so if someone wants to add to the java aspect, could you split it? Thanks.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

warz

yeaah yeaah yeahh jav-WAH?

Joe[x86]

Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

K

Quote from: l2k-Shadow on May 22, 2006, 02:22 PM
the way i interpret it is that False and 0 are the same, however, Null is more like the idea of nothing, while 0 is still a value of a defined variable.


I believe that the value of False in visual basic 6 is actual -1, strangely enough.  I don't have it installed, so I can't test it, but I seem to recall this being true.


' I hope this is valid Visual Basic syntax
Dim b as Boolean
Dim i as Integer
b = False
i = CInt(b)
MessageBox CStr(i)

FrOzeN

Quote from: K on May 26, 2006, 05:50 PM
Quote from: l2k-Shadow on May 22, 2006, 02:22 PM
the way i interpret it is that False and 0 are the same, however, Null is more like the idea of nothing, while 0 is still a value of a defined variable.


I believe that the value of False in visual basic 6 is actual -1, strangely enough.  I don't have it installed, so I can't test it, but I seem to recall this being true.


' I hope this is valid Visual Basic syntax
Dim b as Boolean
Dim i as Integer
b = False
i = CInt(b)
MessageBox CStr(i)

In VB6, False is "0". True is everything else, but default it's "-1". Also with your code, it's right except MessageBox is "MsgBox" :)
~ FrOzeN

Adron

Quote from: UserLoser on May 22, 2006, 12:21 AM
False and 0 in Visual Basic is not the same as the Null keyword in Visual Basic at all.  If anything needs to be passed as a null parameter, use 0 (same thing as passing vbNullString aka "")

vbNullString is actually not "", and it can be important to separate the two. Use the right one at the right time.

FrOzeN

Quote from: Adron on May 27, 2006, 09:16 AM
vbNullString is actually not "", and it can be important to separate the two. Use the right one at the right time.
I've read about vbNullString hundreds of times but forget the reasoning behind it. But my understanding of it, is that as a value it's the same as "" but Visual Basic handles it different and is a preferred method as it provides some slightly more proficient capabilities over "" (non of which I can remember).

Can you tell me a case of where you would ever use "" instead of vbNullString? (Just as reference, I'm trying to grasp a full understanding of all the minor things in VB6 that tutorials don't touch up on)
~ FrOzeN

warz

This entire thread is easily answered by MSDN.

Quote
Constant: vbNullString
Equiv: String having value 0
Desc: Not the same as a zero-length string (""); used for calling external procedures.

NullChar
Constant: vbNullChar
Equiv: Chr(0)
Desc: Character having value 0

Null
Constant: vbNull
Desc: Null object.

False
Desc: False. The numeric value of this member is 0.