Solved

Switch User in Windows XP

Posted on 2002-03-21
4
833 Views
Last Modified: 2012-05-04
I would like to know how to use Windows XP's new Fast User Switching feature to switch user in VB code.
0
Comment
Question by:SimonORorke
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Expert Comment

by:RainUK
ID: 6889038
Have you looked on MSDN? Although I have not had a look in MSDN lately I assume it is a set of Win32 APIs, probably similar to something like Win2Ks LogonUser, LoadUSerProfile, SwitchDesktop etc.
0
 

Author Comment

by:SimonORorke
ID: 6890214
I've scoured MSDN!  I did find what what looks like a way of doinng it with MFC, which is no good for VB.  I could not see how to do it with API, though that must be possible.
0
 
LVL 3

Accepted Solution

by:
jbil earned 200 total points
ID: 6891598
See KB Q310153 to do in in c++

"HOW TO: Write an Application That Supports Fast User Switching in Windows XP (Q310153)"

Here is cheesy way to do it in vb by kebd_event...

Private Const VK_RWIN = &H5C
Private Const VK_LWIN = &H5B
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Sub Form_Click()
keybd_event VK_LWIN, 0, 0, 0
   
    keybd_event vbKeyL, 0, 0, 0
   
    keybd_event VK_LWIN, 0, KEYEVENTF_KEYUP, 0
    keybd_event vbKeyL, 0, KEYEVENTF_KEYUP, 0

End Sub
0
 

Author Comment

by:SimonORorke
ID: 6893382
Hello jbil

Q310153 has much interesting info about coding to support user switching in applications, but does not, as far as I can see, actually tell me how to switch users.  However, your "cheesy" VB solution will do nicely!  Thanks.

Simon
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question