cheeseslice Posted January 8, 2009 Posted January 8, 2009 Hi,I had started another topic yesterday (http://www.autoitscript.com/forum/index.php?showtopic=87272) but I don't think I used the right topic title to get the specific help that I need, though Zinthose did point me in the right direction. I hope it's ok to start a new topic.I need to create a script that will send a username and password and login to a workstation running xp sp2. The reason for this application is so that I can then send it remotely to all the machines on my network using psexec, I need them all to log in with the same credentials so that I can run presentations on them at certain times over the next couple of days.With the advice from here, google and msdn I have realised that I need to create a service that will then use the following functions:openinputdesktop - http://msdn.microsoft.com/en-us/library/ms684309(VS.85).aspxsetthreaddesktop - http://msdn.microsoft.com/en-us/library/ms686250(VS.85).aspxsendinput - http://msdn.microsoft.com/en-us/library/ms646310(VS.85).aspxThese are all part of the user32.dllThis is where I've got to so far and I was wondering if someone could give me a bit more advice now. I've never used autoit with dll's before and I don't fully understand how to go about getting this to work.Thanks
cheeseslice Posted January 8, 2009 Author Posted January 8, 2009 I have found the code that I need but it's written in c++ from 4 years ago: HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId()); // Switch into the Winlogon desktop if (!SelectDesktop("Winlogon")) { return FALSE; } // Winlogon uses hotkeys to trap Ctrl-Alt-Del... // HWND w=FindWindow("SAS window class","SAS window"); SendMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE)); HWND w=NULL; // evil forever loop follows? while( NULL != (w=FindWindow(NULL,"Welcome to Windows")) ) SendMessage(w, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE)); // Alt-P for password edit keybd_event( VK_MENU, 0, 0, NULL ); keybd_event( VkKeyScan('p'), 1, 0, NULL ); keybd_event( VkKeyScan('p'), 1, KEYEVENTF_KEYUP, NULL ); keybd_event( VK_MENU, 0, KEYEVENTF_KEYUP, NULL ); Sleep( 50 ); // maybe not needed // Enter the password char password[] = "not4u2no"; for( int c=0; c<strlen(password); c++ ) { keybd_event( VkKeyScan(password[c]), 1, 0, NULL ); keybd_event( VkKeyScan(password[c]), 1, KEYEVENTF_KEYUP, NULL ); } // Send the enter key and do the default (logon) keybd_event( VK_RETURN, 0, 0, NULL ); keybd_event( VK_RETURN, KEYEVENTF_KEYUP, 0, NULL ); // Switch back to our original desktop if (old_desktop != NULL) SelectHDESK(old_desktop); Is it possible for me to translate this to autoit?
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