Starstar Posted January 13, 2014 Share Posted January 13, 2014 (edited) DllCall("Rasapi32.dll","ERROR_SUCCESS","RasSetEntryDialParams","szEntryName","InT-LINK","szUserName","aaa","szPassword","111") Please Guide Me..........Please http://msdn.microsoft.com/en-us/library/windows/desktop/aa377821%28v=vs.85%29.aspx Edited January 13, 2014 by Starstar Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
CiVQ Posted January 13, 2014 Share Posted January 13, 2014 Hello. I don't know, whether a typo or not, but you need to input the variables (e.g. $szEntryName) and not their names into the DllCall function. The return variable of the RasSetEntryDialParams function is a dword variable, the "ERROR_SUCCESS" is one possible value of it. (when everything went ok, this is the return value) The second parameter of the RasSetEntryDialParams function is a pointer to a RASDIALPARAMS structure, so you have to create it before calling the function. I encourage you to browse the following Autoit Help topics: http://www.autoitscript.com/autoit3/docs/functions/DllCall.htm http://www.autoitscript.com/autoit3/docs/functions/DllStructCreate.htm (don't get me wrong, if I misjudged your Autoit and programming skills...) That's what I can help you. May the experts answer your post, and direct you to the good direction. Best regards. CiV I know that my code is ugly. But it works. Mostly. Link to comment Share on other sites More sharing options...
Zedna Posted January 13, 2014 Share Posted January 13, 2014 (edited) Good way to learn how to work with DllCall and API is to look at working sources in standard include files and compare DllCalls from there with their MSDN documentation. --> "C:\Program Files\AutoIt3\Include\WinAPI.au3" Edited January 13, 2014 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JohnOne Posted January 13, 2014 Share Posted January 13, 2014 Here's a clue, there is no such type as ERROR_SUCCESS in DllCall Starstar 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Starstar Posted January 13, 2014 Author Share Posted January 13, 2014 Hello. I encourage you to browse the following Autoit Help topics: http://www.autoitscript.com/autoit3/docs/functions/DllCall.htm http://www.autoitscript.com/autoit3/docs/functions/DllStructCreate.htm (don't get me wrong, if I misjudged your Autoit and programming skills...) That's what I can help you. May the experts answer your post, and direct you to the good direction. Best regards. CiV No No you are not on misjudge you are on welljudge. i am not professional i am a student. And i am realy thanks for all of you. Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Starstar Posted January 13, 2014 Author Share Posted January 13, 2014 Here's a clue, there is no such type as ERROR_SUCCESS in DllCall HMm......It is a Point... Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
JohnOne Posted January 13, 2014 Share Posted January 13, 2014 (edited) Your call should end up looking something like this. DllCall("Rasapi32.dll", "dword", "RasSetEntryDialParams", "wstr", $lpszPhonebook, "ptr", DllStructGetPtr($rasdialparams), "bool", $fRemovePassword) $rasdialparams is a structure which can be built by studying it here. Edited January 13, 2014 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Starstar Posted January 13, 2014 Author Share Posted January 13, 2014 Thanks JohnOne....... Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Starstar Posted January 14, 2014 Author Share Posted January 14, 2014 $lpszPhonebook = @AppDataDir& "\Microsoft\Network\Connections\Pbk\rasphone.pbk" $szEntryName="HM-LINK" $szUserName="AAa" $szPassword="wadf" Local Const $tagSTRUCT1 = "struct;int dwSize;CHAR szEntryName[RAS_MaxEntryName + 1];CHAR szUserName[UNLEN + 1];CHAR szPassword[PWLEN + 1];CHAR; endstruct" $rasdialparams = DllStructCreate($tagSTRUCT1) DllCall("Rasapi32.dll", "dword", "RasSetEntryDialParams", "wstr", $lpszPhonebook, "ptr", DllStructGetPtr($rasdialparams),"CHAR", $szEntryName, "CHAR", $szUserName, "CHAR", $szPassword) If @error Then MsgBox(0,"","Error in DllCall "&@error) EndIf i am trying like this But i could not success.......Please Help Me. If anyone Knows about this...... Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
CiVQ Posted January 14, 2014 Share Posted January 14, 2014 Well, I don't know about the windows dialing API, but your structure is badly defined for sure. It should be something like this: Local Const $tagSTRUCT1 = "struct;int dwSize;CHAR szEntryName["&$RAS_MaxEntryName + 1&"];CHAR szUserName["&$UNLEN + 1&"];CHAR szPassword["&$PWLEN + 1&"];CHAR; endstruct" You should to find out by yourself, how to get $RAS_MaxEntryName (maybe the count of current items in hold); $UNLEN may be StringLen($szUserName) or the maximum accepted name length, or something else; so as $PWLEN. I know that my code is ugly. But it works. Mostly. Link to comment Share on other sites More sharing options...
Starstar Posted January 14, 2014 Author Share Posted January 14, 2014 (edited) Thanks CiVQ....But my Problem still remain.... Edited January 14, 2014 by Starstar Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Zedna Posted January 16, 2014 Share Posted January 16, 2014 expandcollapse popup$fun=_SetUserNamePassword(@AppDataDir& "\Microsoft\Network\Connections\Pbk\rasphone.pbk","HM-LINK","Asd", "HGj") If Not @error Then MsgBox(0,"OK","Done") ElseIf @error Then MsgBox(0,"Error","Error is "&@error) EndIf Func _SetUserNamePassword($lpszPhonebook, $szEntryName, $szUserName, $szPassword, $fRemovePassword = False) Local Const $tagRASDialParams = "struct;dword dwSize;char szEntryName[256];char szPhoneNumber[256];char szCallbackNumber[256];char szUserName[256];char szPassword[256];char szDomain[256];dword dwSubEntry;ulong_ptr dwCallbackId;dword dwIfIndex;endstruct" #cs typedef struct _RASDIALPARAMS { DWORD dwSize; TCHAR szEntryName[RAS_MaxEntryName + 1]; TCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1]; TCHAR szCallbackNumber[RAS_MaxCallbackNumber + 1]; TCHAR szUserName[UNLEN + 1]; TCHAR szPassword[PWLEN + 1]; TCHAR szDomain[DNLEN + 1]; DWORD dwSubEntry; ULONG_PTR dwCallbackId; DWORD dwIfIndex; } RASDIALPARAMS, *PRASDIALPARAMS; #ce Local $tInfo = DllStructCreate($tagRASDialParams) DllStructSetData($tInfo, "Size", DllStructGetSize($tInfo)) DllStructSetData($tInfo, "szEntryName", $szEntryName) DllStructSetData($tInfo, "szPhoneNumber", '') DllStructSetData($tInfo, "szCallbackNumber", '') DllStructSetData($tInfo, "szUserName", $szUserName) DllStructSetData($tInfo, "szPassword", $szPassword) DllStructSetData($tInfo, "szDomain", '') DllStructSetData($tInfo, "dwSubEntry", 1) ; ? 0-all DllStructSetData($tInfo, "dwCallbackId", 0) ; ? DllStructSetData($tInfo, "dwIfIndex", 0) ; ? Local $aResult = DllCall("Rasapi32.dll", "dword", "RasSetEntryDialParams", "wstr", $lpszPhonebook, "struct*", $tInfo, "bool", $fRemovePassword) EndFunc Starstar 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Starstar Posted January 16, 2014 Author Share Posted January 16, 2014 Zedna Thanks a lot of you............ Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Zedna Posted January 16, 2014 Share Posted January 16, 2014 (edited) Does it work? Because I didn't test it I just corrected your AU3 syntax (from deleted post) according to MSDN description. Hints: Post what you have tried to get more help on this forum Don't delete your posts. Edited January 16, 2014 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now