?
Solved

Switch User in Windows XP

Posted on 2002-03-21
4
Medium Priority
?
836 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 800 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

777 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