Page 2 of 4

Posted: Mon Oct 06, 2003 8:38 pm
by PureUser
x.rasdialparams
???? .... hmm...and what "x" stands for, I wonder ???

2 sec... noop...sorry... I don't used linux about a year already...

Posted: Mon Oct 06, 2003 8:52 pm
by blueznl
sorry pureuser, i was perhaps a little quick, i tend to get 'overcondensed' now and again, but i overcompensate that by being loud and noisy the rest of the time :)

here's the same somewhat better...

struct rasdialparams ; the struct as was shown in another post
...
...
endstructure

x.rasdialparams ; make a variable x of type struct rasdialparams
pokes(@x\szEntryName,"test") ; and fill a certain field

that should be better :-)

Posted: Mon Oct 06, 2003 9:27 pm
by PureUser
;)
By the way Pure User sounds like Poor ;) user ... It is rather funny... I've noticed it just today ;)

Posted: Mon Oct 06, 2003 10:43 pm
by PureUser
RasDial_(null, null, [??], null, null, null )
To what should I place here pointer?
Maybe *poiner=x.rasdialparams ?
Am I right?

Posted: Mon Oct 06, 2003 11:03 pm
by blueznl
rasdial_(0,0,@x,0,0,0)

Posted: Mon Oct 06, 2003 11:13 pm
by Jurgen
PureUser,

A pointer to structure/variabele = the adress of this structure/variabele.
a pointer is always a long.

If you do pointer.l = @mystructure, then you have the adres in pointer.

hope this helps

Posted: Tue Oct 07, 2003 11:00 am
by PureUser

Code: Select all

#RAS_MaxEntryName = 256 
#RAS_MaxPhoneNumber = 128 
#RAS_MaxCallbackNumber = 48 
#UNLEN = 256 
#PWLEN = 256 
#DNLEN = 15 

Structure RASDIALPARAMS 
  dwSize.l 
  szEntryName.b[#RAS_MaxEntryName + 1] 
  szPhoneNumber.b[#RAS_MaxPhoneNumber + 1] 
  szCallbackNumber.b[#RAS_MaxCallbackNumber + 1] 
  szUserName.b[#UNLEN + 1] 
  szPassword.b[#PWLEN + 1] 
  szDomain.b[#DNLEN + 1] 
EndStructure

x.rasdialparams ; make a variable x of type struct rasdialparams 
PokeL(@x\dwSize, SizeOf(RASDIALPARAMS)) 
PokeS(@x\szEntryName,"gin") ; and fill a certain field 
PokeS(@x\szPhoneNumber,"")
PokeS(@x\szCallBackNumber,"")
PokeS(@x\szUserName,"test")
PokeS(@x\szPassword,"test")
PokeS(@x\szDomain,"*")

res=RasDial_(null, null, @x, null, null, null ); it gives an error #610 on win 9x
;This means that the buffer was set incorrectly

;in C\C++ the key to fix trouble is to set 
;#define WINVER 0x400
;before 
;#include <ras.h>
               
Delay (99999)
res=RasDial_(null, null, @x, null, null, null ) gives an error #610 on win 9x
This means that the buffer was set incorrectly

in C\C++ the key to fix trouble is to set
#define WINVER 0x400
before
#include <ras.h>

Any ideas how to translate to PB ?

Posted: Tue Oct 07, 2003 11:54 am
by blueznl
at first glance this looks ok

you can set the dwsize field directly though, no need to poke it

PokeL(@x\dwSize, SizeOf(RASDIALPARAMS))

x\dwsize = SizeOf(RASDIALPARAMS))

on winxp, it returns 87, no other error reported
i'm afraid either i lost you or can't help you any further on this

Posted: Tue Oct 07, 2003 12:04 pm
by PureUser
x\dwsize = SizeOf(RASDIALPARAMS)
Nothing changes... The same error in buffer... :(

Posted: Tue Oct 07, 2003 12:21 pm
by blueznl
try it on another os and see what it does

Posted: Tue Oct 07, 2003 2:27 pm
by Jurgen
checkout the vb example at http://www.mentalis.org/apilist/RasDial.shtml
example : http://www.mentalis.org/apilist/RasDial.shtml#

Code: Select all

#RAS_MaxEntryName = 256 
#RAS_MaxPhoneNumber = 128 
#RAS_MaxCallbackNumber = 128  ; this was wrong
#UNLEN = 256 
#PWLEN = 256 
#DNLEN = 15 

Structure RASDIALPARAMS 
  dwSize.l 
  szEntryName.b[#RAS_MaxEntryName + 1] 
  szPhoneNumber.b[#RAS_MaxPhoneNumber + 1] 
  szCallbackNumber.b[#RAS_MaxCallbackNumber + 1] 
  szUserName.b[#UNLEN + 1] 
  szPassword.b[#PWLEN + 1] 
  szDomain.b[#DNLEN + 1] 
EndStructure

RDP.RASDIALPARAMS
hRasConn.l=NULL

RDP\dwSize = 1052  ;SizeOf(RASDIALPARAMS)
Debug RDP\dwSize
PokeS(@RDP\szEntryName,"test") 
PokeS(@RDP\szPhoneNumber,"012313213") 
PokeS(@RDP\szCallbackNumber ,"*")
PokeS(@RDP\szUserName,"test") 
PokeS(@RDP\szPassword,"test") 
PokeS(@RDP\szDomain,"*") 
res.l = 0
res = RasDial_(null, null, @RDP, null, null, @hRasConn) 
Debug res

Now you have to add a phone book entry with the same entryname.

Posted: Tue Oct 07, 2003 7:01 pm
by PureUser
great thx... This source you should post to the CodeArchiv (imho)... It is V E R Y useful...

Posted: Tue Oct 07, 2003 8:37 pm
by Jurgen
I find it very strange that the sizeof doesn't work correctly, instead 1052 works ?

Does PB have something similar to the #if and #endif as in visual c++ ?

Code: Select all

#define RASDIALPARAMSA struct tagRASDIALPARAMSA
RASDIALPARAMSA
{
    DWORD dwSize;
    CHAR  szEntryName[ RAS_MaxEntryName + 1 ];
    CHAR  szPhoneNumber[ RAS_MaxPhoneNumber + 1 ];
    CHAR  szCallbackNumber[ RAS_MaxCallbackNumber + 1 ];
    CHAR  szUserName[ UNLEN + 1 ];
    CHAR  szPassword[ PWLEN + 1 ];
    CHAR  szDomain[ DNLEN + 1 ];
#if (WINVER >= 0x401)
    DWORD dwSubEntry;
    DWORD dwCallbackId;
#endif
};

Posted: Tue Oct 07, 2003 8:52 pm
by Proteus
Does PB have something similar to the #if and #endif as in visual c++ ?
I'm not sure what #if and #endif do, but if they're compiler directives, you can use CompilerIf and CompilerEndIf.

Posted: Tue Oct 07, 2003 9:07 pm
by Jurgen
Yes something like a compiler directive.

For example the structures members depend on the version of windows your using.

WINVER >= 0x401 (hexadecimal) for NT 4.0 or greater.
WINVER >= 0x500 for windows 2000 or greater.