stormbreaker Posted August 13, 2012 Share Posted August 13, 2012 (edited) Hello everyone, recently (you could call it a day before yesterday), I made a robot (connected to my PC) which I could control using WinSock. This is fairly easy in C++, but could anyone please guide me how to write the function WSASetService (an example is greatly appreciated) in AU3. All I have done so far is this: Func _WSASetService() $WSAQUERYSET = DllStructCreate("dword;wstr;word") ;incomplete structure $RESULT = DllCall($hWs2_32, "int", "WSASetServiceW", "struct", $WSAQUERYSET, "int", 0, "Dword", 0) EndFunc I have no idea for typedefs really. By the way, could anyone tell me how do I search for proper typedefs in the header files of Windows SDK. Thanks... MKISH Edited August 13, 2012 by MKISH ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
JohnOne Posted August 13, 2012 Share Posted August 13, 2012 You might get quicker help if you post your easy C++ code. 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...
stormbreaker Posted August 13, 2012 Author Share Posted August 13, 2012 JohnOne, I am just asking for a translation of WSASetServiceW (Winsock) function and WSAQUERYSET structure from C++ to AU3. I don't suppose, you will need C++ code for that. ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
JohnOne Posted August 13, 2012 Share Posted August 13, 2012 Well you have written the code and the call in C++ and it's fairly easy, why not just post your simple fairly easy code you wrote in C++ and it will make it much easier for someone to translate. 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...
Moderators SmOke_N Posted August 13, 2012 Moderators Share Posted August 13, 2012 John, why do you need the code, it's windows API, and he gave you the function and typedef he needed. Anyway, @OP, I'm confused on why you didn't google it, msdn has what yo need: http://msdn.microsoft.com/en-us/library/windows/desktop/ms742211%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/windows/desktop/ms741679%28v=vs.85%29.aspx DllCall and DllStructCreate in the help file have your autoit types. Just curious on why you're not using the original method if it works still. ( round | wheel ) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
JohnOne Posted August 13, 2012 Share Posted August 13, 2012 The idea was if the OP has already wrapped the function in C++ It's much easier to translate the structure. 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...
stormbreaker Posted August 13, 2012 Author Share Posted August 13, 2012 Dear Smoke_N, I had already googled it and thats how I implemented it in C++, but I was not able to translate the types (such as LPGUID, LPWSAVERSION and many others...) to AutoIt. Thats okay in C++ as all I had to do was include Winsock2 header file and everything was done. The reason for choosing AU3 was that it provides me simplicity (makes the process understandable). One way of doing this would of course be making a DLL with C++ and then calling it via DllCall(), but I rejected it, to make the process understandable. Regards ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
stormbreaker Posted August 14, 2012 Author Share Posted August 14, 2012 Anyone??? ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
jaberwacky Posted August 14, 2012 Share Posted August 14, 2012 SmOke_N pretty gave you everything you need to get started. I'll add DllStructGetPtr and use "ptr" instead of "struct". Good luck! Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
stormbreaker Posted August 16, 2012 Author Share Posted August 16, 2012 DllCall is not much of a problem here. The real problem is WSAQUERYSET structure. ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 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