Click here to Skip to main content
16,004,991 members
Home / Discussions / C#
   

C#

 
GeneralRe: Printing Arrays... Pin
Gmartin (No Time To Login)30-Nov-04 22:14
sussGmartin (No Time To Login)30-Nov-04 22:14 
GeneralRe: Printing Arrays... Pin
Gmartin (No Time To Login)30-Nov-04 22:16
sussGmartin (No Time To Login)30-Nov-04 22:16 
QuestionHow to make C# (client) and VB6(server) send string to each other on a network Pin
Member 155463330-Nov-04 1:28
Member 155463330-Nov-04 1:28 
AnswerRe: How to make C# (client) and VB6(server) send string to each other on a network Pin
Nick Parker30-Nov-04 14:50
protectorNick Parker30-Nov-04 14:50 
GeneralOverride Background Image property Pin
lmaks30-Nov-04 1:19
lmaks30-Nov-04 1:19 
GeneralRe: Override Background Image property Pin
Daniel Turini30-Nov-04 2:28
Daniel Turini30-Nov-04 2:28 
GeneralControls appear black after locking computer Pin
sommarafton30-Nov-04 0:10
sommarafton30-Nov-04 0:10 
GeneralRe: Controls appear black after locking computer Pin
Alex Korchemniy30-Nov-04 8:30
Alex Korchemniy30-Nov-04 8:30 
Strage bug. I bet the bug is very small. If you really can't figure it out you can try to catch the session events.

First you need to register for the events. Make sure you are running on XP. Use this:

[DllImport("Wtsapi32.dll")]<br />
extern public static bool WTSRegisterSessionNotification(IntPtr handle, double flags);<br />
<br />
[DllImport("Wtsapi32.dll")]<br />
extern public static bool WTSUnRegisterSessionNotification(IntPtr handle);


Override the WndProc method in your window kinda like this:

protected override void WndProc(ref System.Windows.Forms.Message m)
{
	switch(m.Msg)
	{
              case (int)WM_WTSESSION_CHANGE:
//            switch(m.WParam)
// DO check for all types of changes
        }
}


To make life easier here are my constant definitions:

public const int WM_WTSSESSION_CHANGE = 0x02B1;<br />
public const int WTS_CONSOLE_CONNECT = 0x1;<br />
public const int WTS_CONSOLE_DISCONNECT = 0x2;<br />
public const int WTS_REMOTE_CONNECT = 0x3;<br />
public const int WTS_REMOTE_DISCONNECT = 0x4;<br />
public const int WTS_SESSION_LOGON = 0x5;<br />
public const int WTS_SESSION_LOGOFF = 0x6;<br />
public const int WTS_SESSION_LOCK = 0x7;<br />
public const int WTS_SESSION_UNLOCK = 0x8;


This posting is provided "AS IS" with no warranties, and confers no rights.

Alex Korchemniy
GeneralRe: Controls appear black after locking computer Pin
Brian Delahunty30-Nov-04 9:50
Brian Delahunty30-Nov-04 9:50 
GeneralConvert to DateTime Pin
ongo30-Nov-04 0:06
ongo30-Nov-04 0:06 
GeneralRe: Convert to DateTime Pin
Sven Cipido30-Nov-04 0:58
Sven Cipido30-Nov-04 0:58 
GeneralRe: Convert to DateTime Pin
sommarafton30-Nov-04 2:32
sommarafton30-Nov-04 2:32 
GeneralRe: Convert to DateTime Pin
Skynyrd30-Nov-04 9:01
Skynyrd30-Nov-04 9:01 
GeneralConvert 1,2,3.. to A,B,C... Pin
Jan R Hansen29-Nov-04 23:47
Jan R Hansen29-Nov-04 23:47 
QuestionHow do i clear all error providers in one command? Pin
JDUK29-Nov-04 23:04
JDUK29-Nov-04 23:04 
Generalraising event from SQL-Server to C# Pin
TehMedic29-Nov-04 21:08
TehMedic29-Nov-04 21:08 
GeneralRe: raising event from SQL-Server to C# Pin
Daniel Turini30-Nov-04 2:18
Daniel Turini30-Nov-04 2:18 
QuestionFunction Parameters in a C DLL? Pin
Arsalan Malik29-Nov-04 19:43
Arsalan Malik29-Nov-04 19:43 
AnswerRe: Function Parameters in a C DLL? Pin
leppie29-Nov-04 20:30
leppie29-Nov-04 20:30 
GeneralRe: Function Parameters in a C DLL? Pin
Arsalan Malik29-Nov-04 22:12
Arsalan Malik29-Nov-04 22:12 
GeneralRe: Function Parameters in a C DLL? Pin
Dave Kreskowiak30-Nov-04 1:59
mveDave Kreskowiak30-Nov-04 1:59 
GeneralWindows Form Controls in MFC Container Pin
Member 1697729-Nov-04 19:32
Member 1697729-Nov-04 19:32 
GeneralDataGrid And Table relationship Pin
Old Gun29-Nov-04 18:19
Old Gun29-Nov-04 18:19 
GeneralAI-back propogation Pin
kasimalla29-Nov-04 17:54
kasimalla29-Nov-04 17:54 
GeneralRe: AI-back propogation Pin
Dave Kreskowiak30-Nov-04 1:56
mveDave Kreskowiak30-Nov-04 1:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.