Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Emulate Ctrl+Alt+Del
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Emulate Ctrl+Alt+Del
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01066166
Message ID:
01066166
Views:
77
I am trying to automatically run a program every afternoon through the Windows Scheduler. The program must send keystrokes to the desktop. The program runs fine as long as the computer is not "locked" (i.e., the screen that reads "Press Ctrl-Alt-Del to unlock this computer") is not showing. To unlock the computer, I am trying to send the Ctrl+Alt+Del key combination to the screen to bring up the "Unlock Computer" dialog box and then send password keystrokes to that screen. I have found C code to accomplish this. However, I am not a C programmer. I have included the code below. Will someone please show me how to convert this code to Visual FoxPro. Thank you very much!!!!



// Static routine used to fool Winlogon into thinking CtrlAltDel was pressed

void *
SimulateCtrlAltDelThreadFn(void *context)
{
HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());

// Switch into the Winlogon desktop
if (!vncService::SelectDesktop("Winlogon"))
{
vnclog.Print(LL_INTERR, VNCLOG("failed to select logon desktop\n"));
return FALSE;
}

vnclog.Print(LL_ALL, VNCLOG("generating ctrl-alt-del\n"));

// Fake a hotkey event to any windows we find there.... :(
// Winlogon uses hotkeys to trap Ctrl-Alt-Del...
PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE));

// Switch back to our original desktop
if (old_desktop != NULL)
vncService::SelectHDESK(old_desktop);

return NULL;
}
Brent L. Hackett
Next
Reply
Map
View

Click here to load this message in the networking platform