Hi,
New to C# and trying to build an app that has a logout button.
I just want the user to be able to log out of their Windows session from
within the Windows Form.
I have;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern bool ExitWindowsEx(string teststring1, int testint1);
// private static extern bool ExitWindows(int testint1, int testint2);
// error: entry point not found in user32.dll (?)
and then when the button is clicked;
public void Logout_Click(object sender, System.EventArgs e)
{
ExitWindowsEx(@"EWX_LOGOFF", 0);
// ExitWindows(0, 0);
// error: entry point not found in user32.dll (?)
}
With ExitWindows the entry point is not found, but with ExitWindowsEx
nothing happens (?)
I also see the memory of the .exe increasing by 4k everytime I press the
logout button,
any help greatly appreciated.
Jeremy. 3 13403
Hi,
The 1st parameter of ExitWindowsEx should be an uint, not string and pass 0
(for log off) for the 1st one.
"Jeremy Horton" <je****@e-business-australia.com> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
Hi,
New to C# and trying to build an app that has a logout button.
I just want the user to be able to log out of their Windows session from
within the Windows Form.
I have;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern bool ExitWindowsEx(string teststring1, int testint1);
// private static extern bool ExitWindows(int testint1, int testint2);
// error: entry point not found in user32.dll (?)
and then when the button is clicked;
public void Logout_Click(object sender, System.EventArgs e)
{
ExitWindowsEx(@"EWX_LOGOFF", 0);
// ExitWindows(0, 0);
// error: entry point not found in user32.dll (?)
}
With ExitWindows the entry point is not found, but with ExitWindowsEx
nothing happens (?)
I also see the memory of the .exe increasing by 4k everytime I press the
logout button,
any help greatly appreciated.
Jeremy.
Just as a follow up - you should also check out http://www.pinvoke.net/
Search there for ExitWindowsEx. There is description and sample of how to use it there.
--
Adam Clauss ca*****@tamu.edu
"Jeremy Horton" <je****@e-business-australia.com> wrote in message news:e$**************@TK2MSFTNGP09.phx.gbl... Hi,
New to C# and trying to build an app that has a logout button. I just want the user to be able to log out of their Windows session from within the Windows Form. I have;
[DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern bool ExitWindowsEx(string teststring1, int testint1); // private static extern bool ExitWindows(int testint1, int testint2); // error: entry point not found in user32.dll (?)
and then when the button is clicked;
public void Logout_Click(object sender, System.EventArgs e) { ExitWindowsEx(@"EWX_LOGOFF", 0); // ExitWindows(0, 0); // error: entry point not found in user32.dll (?) } With ExitWindows the entry point is not found, but with ExitWindowsEx nothing happens (?) I also see the memory of the .exe increasing by 4k everytime I press the logout button, any help greatly appreciated. Jeremy.
Shiva - worked first go.
Adam - pinvoke.net, if only I had know this site existed 12hrs ago !!
thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nicolas Lehuen |
last post by:
Hi,
Is it me, or does anyone else get significantly better pystone results under
Cygwin versus the standard Win32 build ?
CYGWIN 1.5.6 + python 2.3.3-1 :
$ time python...
|
by: Francois De Serres |
last post by:
Hiho,
could somebody please enlighten me about the mechanics of C callbacks to
Python? My domain is more specifically callbacks from the win32 API, but
I'm not sure that's where the problem...
|
by: ZhangZQ |
last post by:
Is it possible to dynamicaly to local and call a function in Win32 dll(not a
..net assembly dll) in C# at run time, for example, a C# program popup a
dialogbox to let use input which Win32 dll to...
|
by: Chi Tang |
last post by:
Hi,
I need to implement a stand alone gui application which need to call some
other regular DLL functions (unmanaged code). Should I use .net with C# or
just use Win32 API to write this exe? ...
|
by: Bryan |
last post by:
I have a multi-threaded C# console application that uses WMI
(System.Management namespace) to make RPC calls to several servers (600+ )
and returns ScheduledJobs. The section of my code that...
| |
by: John |
last post by:
My friend told me that his company will migrate the VC++ win32
applications
to C++ .NET windows applications. I don't understand why since
currently
Microsoft only supports .NET on windows...
|
by: cj |
last post by:
Using VB2003 on Windows XP Pro
Why doesn't this work?
Public Class Form1
Inherits System.Windows.Forms.Form
Private Declare Auto Function ExitWindowsEx Lib "user32.dll" (ByVal
uFlags As...
|
by: jbenezech |
last post by:
Hi all ,
I have a perl/java app running under Win32. The application consists of a perl service (Win32::Daemon) and of java classes. The perl service calls every xx hours java classes to perform...
|
by: somuchh8 |
last post by:
Hi, I'm having a lot of trouble with the Win32::Spawn module in perl. Here is my situation, I have a Win32::Spawn call which looks like this:
my $success = undef;
my $cmdline =...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |