Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "system" in [All]

odbc32

.
Summary
Provide access to configured user and system Data Source Names (DSN) and installed ODBC drivers
.

Depending on the value of Direction, you may access System DSN, User DSN or both. Since the same DSN name may be used in User and System DSN, watch out for possible duplicate values.

.

Here is a simple function to obtain the Data Source Names installed on the system (this functionality is not available in ODBC.net):

.

/// Obtains all the ODBC DSNs installed on the system and returns them in a List<string> object.

.

    Private Sub OnGetODBCConnectionNames(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbExpSID.DropDown, cmbImpSid.DropDown

.

This VB.Net code loads a combo box with only the SQL Server related System DSNs.

.

On XP, Win2k and Win2k3, the system DSN's are stored in the registry in

wintrust

.

    using System;

.

    using System.Runtime.InteropServices;

.

         ProviderUnknown = 0x800b0001,           // Trust provider is not recognized on this system

.

System.Console.WriteLine("Signature is OK: {0}", WinTrust.VerifyEmbeddedSignature(fileName));

wininet

.

    Dim s As New System.Text.StringBuilder

.

    ByVal hInternetSession As System.IntPtr,

.

    ByVal lContext As System.IntPtr) As System.IntPtr

.

[System.Runtime.InteropServices.DllImport("Wininet.dll")]

.

///     Retrieves the connected state of the local system.

.

///         Local system has a valid connection to the Internet, but it might or might not be currently

.

///         <description>Local system uses a local area network to connect to the Internet.</description>

.

///         <description>Local system uses a modem to connect to the Internet.</description>

.

///         <description>Local system is in offline mode.</description>

.

///         <description>Local system uses a proxy server to connect to the Internet.</description>

.

///         <description>Local system has RAS installed.</description>

.

using System;

.

using System.Runtime.InteropServices;

.

Try NetworkInterface.GetIsNetworkAvailable() in the the System.Net.NetworkInformation namespace. It returns true when a network is available and false otherwise. See also: http://msdn2.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getisnetworkavailable(VS.80).aspx. NOTE: this is all new in .NET 2.0!

.

static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref System.UInt32 pcchCookieData, int dwFlags, IntPtr lpReserved);

.

    ByVal pchCookieData As System.Text.StringBuilder, ByRef pcchCookieData As Integer, ByVal flags As Integer, ByVal reserved As Integer) As _

.

    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)> Boolean

.

    static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref System.UInt32 pcchCookieData, int dwFlags, IntPtr lpReserved);

.

static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref System.UInt32 pcchCookieData, int dwFlags, IntPtr lpReserved);

.

    ByVal pchCookieData As System.Text.StringBuilder, ByRef pcchCookieData As Integer, ByVal flags As Integer, ByVal reserved As Integer) As _

.

    <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.Bool)> Boolean

.

     System.Object nullObject = 0;

.

     System.Object nullObjStr = strTemp;

.

Above signature is not working for x64 systems. See INTERNET_CACHE_ENTRY_INFO for a version that works on both x86 and x64.

.

    Private Sub cmdGetPolicy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGetPolicy.Click

.

    'sBuffer = System.Runtime.InteropServices.Marshal.AllocHGlobal(dwBufferLength)

.

        MsgBox("1st Party: There was an error: Code " & CStr(System.Runtime.InteropServices.Marshal.GetLastWin32Error()))

.

    Private Sub cmdSetPolicy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSetPolicy.Click

.

        MsgBox("There was an error: Code " & CStr(System.Runtime.InteropServices.Marshal.GetLastWin32Error()))

irprops

.

        Public lastSeen As SystemTime

.

        Public lastUsed As SystemTime

.

            Me.lastSeen = New SystemTime

.

            Me.lastUsed = New SystemTime

.

    Private Structure SystemTime

imm32

.

public class ImeForm : System.Windows.Forms.Form

.

            string str = System.Text.Encoding.Default.GetString(buf,os,buf.Length-os);

.

private void button1_Click(object sender, System.EventArgs e)

user32

.

[System.Windows.Forms.InputLanguage]

.
Summary
Places the given window in the system-maintained clipboard format listener list.
.

System.Windows.Rect

.

AllowSetForegroundWindow(System.Diagnostics.Process.GetCurrentProcess().Id)

.

The system restricts which processes can set the foreground window. A process can set the foreground window only if one of the following conditions is true:

.

- The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo).

.

Imports System.Runtime.InteropServices

.

    Private Shared Function GetSystemMenu(ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr

.

        Dim hMenu = GetSystemMenu(Me.Handle, False)

.

Public Shared Function AttachThreadInput(ByVal idAttach As System.UInt32, ByVal idAttachTo As System.UInt32, ByVal fAttach As Boolean) As Boolean

.

If the system must increase the size of the multiple-window- position structure beyond the initial size specified by the nNumWindows parameter but cannot allocate enough memory to do so, the system fails the entire window positioning sequence (BeginDeferWindowPos

.
Summary
.

static extern int BroadcastSystemMessageEx(uint flags, ref uint lpInfo, uint Msg, [MarshalAs(UnmanagedType.SysUInt)] ulong wParam, [MarshalAs(UnmanagedType.SysInt)] long lParam, out BSMINFO pbsmInfo);

.
Documentation
[BroadcastSystemMessageEx] on MSDN
.

  System.Diagnostics.Process.Start("Shutdown", "-a");

.

static extern bool CheckDlgButton(IntPtr hDlg, int nIDButton, System.Windows.Forms.CheckState uCheck);

.

[System.Runtime.InteropServices.DllImport("user32.dll")]

.

System.Windows.Forms.Cursor.Clip

.

I read on google about a flaw in the .Net System.Windows.Forms.Clipboard.SetDataObject

.

     System.Windows.Forms.Clipboard.SetDataObject("your message here \n if you would like", true);

.

     System.Windows.Forms.Clipboard.SetDataObject("your message here \n if you would like", true);

.

System.Windows.Forms.Clipboard.SetDataObject("your message here \n if you would like", true);

.

private static extern bool SetSystemCursor(IntPtr hcur, uint id);

.

string folderPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

.

   SetSystemCursor(LoadCursor(IntPtr.Zero, OCR_WAIT), OCR_NORMAL);

.

     SetSystemCursor(CopyIcon(cursor), OCR_NORMAL);

.

     SetSystemCursor(LoadCursor(IntPtr.Zero, OCR_WAIT), OCR_NORMAL);

.

    private void button1_Click(object sender, System.EventArgs e) {

.

    Using s As New System.IO.MemoryStream(embeddedBitmap)

.

If you come across this error "System.Runtime.InteropServices.MarshalDirectiveException: Cannot marshal 'parameter #6': Invalid managed/unmanaged type combination (this value type must be paired with Struct).", you may want to use

.

        [System.Runtime.InteropServices.ComRegisterFunctionAttribute()]

.

                System.Console.WriteLine(e.ToString());

.

        [System.Runtime.InteropServices.ComUnregisterFunctionAttribute()]

.

                System.Console.WriteLine(e.ToString());

.

/// <param name="lpClassName">Pointer to a null-terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If lpClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, provided that the module that registers the class is also the module that creates the window. The class name can also be any of the predefined system class names.</param>

.

/// <param name="x">Specifies the initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area. If x is set to CW_USEDEFAULT, the system selects the default position for the window's upper-left corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child window, the x and y parameters are set to zero.</param>

.

/// <param name="nWidth">Specifies the width, in device units, of the window. For overlapped windows, nWidth is the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, the system selects a default width and height for the window; the default width extends from the initial x-coordinates to the right edge of the screen; the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, the nWidth and nHeight parameter are set to zero.</param>

.

/// <param name="nHeight">Specifies the height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If the nWidth parameter is set to CW_USEDEFAULT, the system ignores nHeight.</param> <param name="hWndParent">Handle to the parent or owner window of the window being created. To create a child window or an owned window, supply a valid window handle. This parameter is optional for pop-up windows.

.

/// <item>the system class was registered by a different module</item>

.

''' <param name="lpClassName">Pointer to a null-terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If lpClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, provided that the module that registers the class is also the module that creates the window. The class name can also be any of the predefined system class names.</param>

.

''' <param name="x">Specifies the initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area. If x is set to CW_USEDEFAULT, the system selects the default position for the window's upper-left corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child window, the x and y parameters are set to zero.</param>

.

''' <param name="nWidth">Specifies the width, in device units, of the window. For overlapped windows, nWidth is the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, the system selects a default width and height for the window; the default width extends from the initial x-coordinates to the right edge of the screen; the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, the nWidth and nHeight parameter are set to zero.</param>

.

''' <param name="nHeight">Specifies the height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If the nWidth parameter is set to CW_USEDEFAULT, the system ignores nHeight.</param> <param name="hWndParent">Handle to the parent or owner window of the window being created. To create a child window or an owned window, supply a valid window handle. This parameter is optional for pop-up windows.

.

''' <item>the system class was registered by a different module</item>

.

using System;

.

using System.Collections.Generic;

.

using System.ComponentModel;

.

using System.Diagnostics;

.

using System.Linq;

.

using System.Text;

.

using System.Runtime.InteropServices;

.

            wndclass.hIcon = Win32.LoadIcon(IntPtr.Zero, new IntPtr((int)SystemIcons.IDI_APPLICATION));

.

Instantiate a [System.Windows.Forms.Form] and set its properties to control its style.

.

The [System.Windows.Forms.NativeWindow] class can be used to encapsulate a window handle. It provides properties and methods that can be used to perform the same behavior as the CreateWindowEx method.

.

[System.Windows.Forms.Form.Close]

.

        System.Threading.Thread.Sleep(10);

.

        if (range.Height > SystemInformation.DragSize.Height

.

                || range.Width > SystemInformation.DragSize.Width)

.

    public const System.Int32 IDANI_OPEN = 1;

.

    public const System.Int32 IDANI_CAPTION = 3;

.

    [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]

.

      public RECT(System.Drawing.Rectangle rectangle)

.

      public RECT(System.Drawing.Point location, System.Drawing.Size size)

.

      public System.Int32 Left;

.

      public System.Int32 Top;

.

      public System.Int32 Right;

.

      public System.Int32 Bottom;

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

    static extern bool DrawAnimatedRects(System.IntPtr hwnd, int idAni,

.

      [System.Runtime.InteropServices.In] ref RECT lprcFrom,

.

      [System.Runtime.InteropServices.In] ref RECT lprcTo);

.

    [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]

.

    static extern System.IntPtr FindWindow(string lpClassName, string lpWindowName);

.

    [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]

.

    static extern System.IntPtr FindWindowEx(System.IntPtr hwndParent, System.IntPtr hwndChildAfter,

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

    static extern bool GetWindowRect(System.IntPtr hWnd, out RECT lpRect);

.

    static public void ShowHideAnimated(System.Windows.Forms.Form form, System.Boolean show)

.

      System.IntPtr hWnd =

.

        FindWindowEx(FindWindow("Shell_TrayWnd", null), System.IntPtr.Zero, "TrayNotifyWnd", null);

.

      if (hWnd != System.IntPtr.Zero)

.

        to.Left = System.Windows.Forms.SystemInformation.VirtualScreen.Right - form.Width;

.

        to.Top = System.Windows.Forms.SystemInformation.VirtualScreen.Bottom -

.

          System.Windows.Forms.SystemInformation.CaptionHeight -

.

            (System.Windows.Forms.SystemInformation.FrameBorderSize.Height * 2);

.

        to.Right = System.Windows.Forms.SystemInformation.VirtualScreen.Right;

.

        to.Bottom = System.Windows.Forms.SystemInformation.VirtualScreen.Bottom;

.

    [StructLayout(System::Runtime::InteropServices::LayoutKind::Sequential)]

.

    RECT(System::Drawing::Rectangle rectangle) {

.

    RECT(System::Drawing::Point location, System::Drawing::Size size) {

.

    System::Int32 Left;

.

    System::Int32 Top;

.

    System::Int32 Right;

.

    System::Int32 Bottom;

.

          to->Left = System::Windows::Forms::SystemInformation::VirtualScreen.Rig ht - 32;

.

          to->Top = System::Windows::Forms::SystemInformation::VirtualScreen.Bot tom -32;

.

          to->Right = System::Windows::Forms::SystemInformation::VirtualScreen.Rig ht;

.

          to->Bottom = System::Windows::Forms::SystemInformation::VirtualScreen.Bot tom;

.

#define DFCS_INMENU 0x0040 /* modifier for DFC_MENU as captionbtn drawn in systemmenu */

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

    static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

    [System.Runtime.InteropServices.DllImport("user32.dll")]

.

        hMenu = GetSystemMenu(frm.Handle,false);

.

using System.Windows.Forms;

.

    Private Shared Function GetSystemMenu(ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr

.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

.

    EnableMenuItem(GetSystemMenu(Me.Handle, False), SC_CLOSE, MF_GRAYED)

.

class ManagedWinapi.SystemWindow that has a settable Enabled property.

.

Private Shared Function EnumChildWindows(ByVal hWndParent As System.IntPtr, ByVal lpEnumFunc As EnumWindowsProc, ByVal lParam As Integer) As Boolean

.

Imports System.Runtime.InteropServices

.

method ManagedWinapi.SystemWindow.FilterDescendantWindows().

.

using System;

.

using System.Text;

.

using System.Windows.Forms;

.

using System.Runtime.InteropServices;

.

using System.Collections.Generic;

.

using System.Runtime.InteropServices;

.

using System;

.

using System.Text;

.

Use System.Windows.Forms.Screen.AllScreens to get an array of all displays on the system.

.

using System;

.

using System.Drawing;

.

using System.Collections;

.

using System.ComponentModel;

.

using System.Windows.Forms;

.

using System.Data;

.

using System.Diagnostics;

.

using System.Runtime.InteropServices;

.

using System.Threading;

.

Imports System

.

Imports System.Drawing

.

Imports System.Collections

.

Imports System.ComponentModel

.

Imports System.Windows.Forms

.

Imports System.Data

.

Imports System.Diagnostics

.

Imports System.Runtime.InteropServices

.

Imports System.Threading

.

     Main(System.Environment.GetCommandLineArgs())

.

To shut down or restart the system on NT/2K/XP, the calling process must use the AdjustTokenPrivileges function to enable the SE_SHUTDOWN_NAME privilege.

.

    /// Stop flashing. The system restores the window to its original state.

.

    ' Stop flashing. The system restores the window to its original state.

.

        .cbSize = System.Runtime.InteropServices.Marshal.SizeOf(fwi)

.

    /// Stop flashing. The system restores the window to its original state.

.

    ' Stop flashing. The system restores the window to its original state.

.

        .cbSize = System.Runtime.InteropServices.Marshal.SizeOf(fwi)

.

  ByRef pszItemText As System.Text.StringBuilder, _

.

static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey);

.

    Shared Function GetAsyncKeyState(ByVal vKey As System.Windows.Forms.Keys) As Short

.

    private static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey); // Keys enumeration

.

    private static extern short GetAsyncKeyState(System.Int32 vKey);

.

        foreach (System.Int32 i in Enum.GetValues(typeof(Keys)))

.

    public static bool IsKeyPushedDown(System.Windows.Forms.Keys vKey) {

.

Imports System.Runtime.InteropServices

.

     Shared Function GetAsyncKeyState(ByVal vKey As System.Windows.Forms.Keys) As Short

.

     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

.

Is there some Windows Message posted when the user changes the Blink Time in the system control ?

.

Use SystemInformation.CaretBlinkTime property

.

[SystemInformation] on MSDN

.

Because GetClassLongPtr is not available on older 32-bit operating systems, a special wrapper function is required. The MSDN documentation specifies that GetClassLongPtr is supported on older 32-bit operating systems such as Windows 95. However, the Win32 API actually uses a macro to change GetClassLongPtr to GetClassLong on these older systems.

.

Because GetClassLongPtr is not available on older 32-bit operating systems, a special wrapper function is required. The MSDN documentation specifies that GetClassLongPtr is supported on older 32-bit operating systems such as Windows 95. However, the Win32 API actually uses a macro to change GetClassLongPtr to GetClassLong on these older systems.

.

Private Shared Function GetClassName(ByVal hWnd As System.IntPtr, _

.

   ByVal lpClassName As System.Text.StringBuilder, _

.

    <Out()> ByVal lpClassName As System.Text.StringBuilder, _

.

Private Sub Button1_Click(ByVal sender As System.Object, _

.

    ByVal e As System.EventArgs) Handles Button1.Click

.

class ManagedWinapi.SystemWindow that has a ClassName property.

.

Private Shared Function GetClientRect(ByVal hWnd As System.IntPtr, _

.

The Win32 RECT structure is not compatible with the .NET System.Drawing.Rectangle structure.

.

ClientRectangle property of the System.Windows.Forms.Control class

.

using System;

.

using System.Text;

.

using System.Windows.Forms;

.

using System.Runtime.InteropServices;

.

    STATE_SYSTEM_NONE = 0,

.

    STATE_SYSTEM_INVISIBLE = 0x00008000,

.

    STATE_SYSTEM_PRESSED = 0x00000008

.

     STATE_SYSTEM_NONE = 0

.

     STATE_SYSTEM_INVISIBLE = &H8000

.

     STATE_SYSTEM_PRESSED = &H8

.

cbi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(cbi);

.

cbi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(cbi)

.

// DON'T use System.Drawing.Point, the order of the fields in System.Drawing.Point isn't guaranteed to stay the same.

.

<System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> _

.

using System.Collections.Generic;

.

using System.Runtime.InteropServices;

.

System.Windows.Forms.Cursor.Position

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: