I searched google and can not really find anything but snippets of what vbNullPtr is supposed to be used for, that is:
"vbNullPtr Constant: The constant vbNullPtr should be used only for ByRef parameters." Given that a variable to a subroutine is a ByRef by default, that is a pointer, see if the following code snippet may work. Public Const vbNullPtrDef = 0 Sub RZipInitWrapper(ByVal FirstArg, ByRef vbNullPtrVar) Call RZipInit(FirstArg, vbNullPtrVar) End Sub Call RZipInitWrapper(57236465, vbNullPtrDef) or try Dim MyLong MyLong = CLong(0) Call RZipInitWrapper(57236465, MyLong) I do not know if this will work or not as I do not have a DLL to test it on. Regards Joe --- In nsbasic...@yahoogroups.com, "jingjok67" <jingjo...@...> wrote: > > Hi, > > No, that does not work either. It seems nothing (I tried in eVB, too) > except vbNullPtr works. Looks like anything else is still a variant > and vbNullPtr is converted by eVB into something special. > > It looks like the function I am trying to call is badly written and > does not accept 0 instead of NULL. This problem hopefully does not > occur with APIs as they accept 0 instead of NULL ? Does anyone have > experience with this ? > > The only workaround I can think of is to write a C DLL to wrap the > functions that use null pointers, which is quite ugly and I do not > really want to do that. > > Any chance to include vbNullPtr in NS Basic ? > > In the meantime - is there any other ZIP compression library that > works with NS Basic ? > > Thanks for your help. > > > > --- In nsbasic...@yahoogroups.com, "George Henne" <gh@> wrote: > > > > Can you give this a try? > > > > vbNullPtr = clng(0) > > Call RZipInit (57236465, vbNullPtr) > > > > I have no idea if this will work, but the first line forces the subtype > > of vbNullPtr to be a long, which may help. > > > > >Hello George, > > > > > >That is strange, if I try the line > > > > > >Msgbox typename(vbNullPtr) & " " & vbNullPtr > > > > > >in eVB and run the code I get an error that variable vbNullPtr is not > > >defined. But then when I use the vbNullPtr in a declared function > > >call, it works ! I have triple-checked and did not make a writing > mistake. > > > > > >It looks like eVB is only accepting this constant as a parameter for > > >declared functions. > > > > > >What I am trying to do is to use the Resco ZIP DLL, here is the sample > > >code (NS Basic) : > > > > > >Option Explicit > > > > > >Declare "Sub RZipInit Lib ""RZip.dll"" (ByVal uCode As Long, ByRef > > >lpCallbackFunc As Long)" > > > > > >Call RZipInit (57236465, vbNullPtr) > > > > > >This code works fine in eVB but NS Basic gives me an error that > > >vbNullPtr is not defined. > > > > > >I have then done further testing in eVB and NS Basic and found that I > > >cannot substitute vbNullPtr with anything else, i.e. Null, nothing, > > >vbNull, 0, vbNullString, vbNullChar. In that case the code runs but > > >the function fails. ONLY vbNullPtr works. I guess that is the reason > > >why Microsoft added the vbNullPtr in the first place. > > > > > >It looks like the code in the RZipInit dll checks this parameter for > > >NULL (as in C++), i.e. > > >if (param2 == NULL) DoSomething > > >The dll call obviously converts anything except vbNullPtr to something > > >else than NULL (as defined in C) > > > > > > > > >Then... is there any way to use or substitute vbNullPtr in NS Basic or > > >any other trick to make this work ? > > > > > >Thanks for your help. > > > > > > > > > > > > > > >--- In nsbasic...@yahoogroups.com, "George Henne" <gh@> wrote: > > >> > > >> My copy of eVB has decided it does not want to work anymore, so I > can't > > >> try this here at the moment. > > >> > > >> Write a short eVB program that does > > >> > > >> Msgbox typename(vbNullPtr) & " " & vbNullPtr > > >> > > >> Hopefully, that will give the answer. Let us know, so we can add > this to > > >> the Tech Note. > > >> > > >> >Hi, > > >> > > > >> >I need to call an function in a dll with a vbNullPtr (this is > > >> >pre-defined in eVB) value in a parameter. What is the substitute for > > >> >vbNullPtr in NS Basic ? I tried Null but that did not work. > > >> > > > >> >Thanks ! > > >> > > > >> > > > >> >------------------------------------ > > >> > > > >> >Yahoo! Groups Links > > >> > > > >> > > > >> > > > >> > > > > > > > > > > > >------------------------------------ > > > > > >Yahoo! Groups Links > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nsb-ce" group. To post to this group, send email to nsb-ce@googlegroups.com To unsubscribe from this group, send email to nsb-ce+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nsb-ce?hl=en -~----------~----~----~----~------~----~------~--~---