Solved

Switch User in Windows XP

Posted on 2002-03-21
4
832 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now