Desktop Functions: Smart Device Functions:
|
Search Results for "system" in [All]ws2_321: accept
System.Net.Sockets.Socket.Accept() 2: inet_ntoa
<System.Runtime.InteropServices.DllImport("ws2_32.dll", CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> 3: send System.Net.Sockets.Socket (class) Socket.SendTo () - better to use It)) 4: SendTo System.Net.Sockets.Socket (class) Socket.SendTo () - better to use It)) 5: WSAData
public String systemStatus;
internal string szSystemStatus; 6: WSAIoctl
IntPtr s, System.Net.Sockets.IOControlCode dwIoControlCode,
System.Diagnostics.Debug.WriteLine(qs.szServiceInstanceName);
System.Net.Sockets.AddressFamily.InterNetwork, gsapi
private static extern void gsapi_delete_instance(System.IntPtr pinstance);
Private Shared Sub gsapi_delete_instance(ByVal pinstance As System.IntPtr)
System.IntPtr pinstance; /* Class instance variable */
if (pinstance != System.IntPtr.Zero)
pinstance = System.IntPtr.Zero; 10: gsapi_exit
System.IntPtr pinstance; /* Class instance variable */
if (pinstance != System.IntPtr.Zero)
pinstance = System.IntPtr.Zero;
private static extern int gsapi_new_instance(ref System.IntPtr pinstance, System.IntPtr handle);
Private Shared Function gsapi_new_instance(ByRef pinstance As System.IntPtr, ByVal handle As System.IntPtr) As Integer
System.IntPtr pinstance= IntPtr.Zero; using System; using System.Runtime.InteropServices;
private static extern int gsapi_new_instance(ref System.IntPtr pinstance, System.IntPtr handle);
private static extern void gsapi_delete_instance(System.IntPtr pinstance); misc12: Comments I need to use this call to permit the user to browse the network neighborhood and select a specific computer system, and the .Net implementation of the wrapper for this does not seem to support the BIG_BROWSEFORCOMPUTER option! If anyone has figured this out, could they please post the information to this web site and let me know at MAILTO:kendrhyd@sympatico.ca? Thanks. One question: The APIs here appear to be machanically created from some other source - from things like "System.Windows.Forms.NativeMethods"? The functions are present, but not the structures and data types used in the params. Any plans to do a mechanical dump of the structures as well? The real magic of marshalling is getting the param types set up correctly, which for structures can be quite a pain. The site is great. I've managed to convince our nazi systems bods to allow access through our proxy. One thing is bothering me though, I've used the code for IActiveDesktop (and all associated enums and structs and whatnot) in C# and it doesn't seem to want to work. If I attempt to create a new instance of IActiveDesktop with "IActiveDesktop ad=new IActiveDesktop();" and try to change the desktop wallpaper I am told "Cannot create an instance of the abstract class or interface 'MyProject.MyClass.IActiveDesktop'". If I don't explicitly create a new instance, I get an error that tells me "Use of unassigned local variable 'ad'". Am I doing something stupid here? 13: FAQ
using System.Runtime.InteropServices; winmm
Private Shared Function mciGetErrorString(ByVal dwError As Integer, ByVal lpstrBuffer As System.Text.StringBuilder, ByVal uLength As Integer) As Integer 15: mciSendString
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) 16: midiInGetNumDevs The winmm dll may not execute properly on 64-bit systems. Consequently, the StructLayout must be Sequential, with CharSet = Ansi, and Pack = 4. This particular type has some special layout considerations (the c union keyword) which typically means developers would use the explicit layout. However, the explicit layout breaks down on 64-bit systems for any type with an IntPtr in the type. Consequently, the C# types have been redesigned to use Sequential layout so that they will automatically adjust to 64-bit systems. This means private fields with public properties which perform the gunky work of making it look like there is a union. 19: mixerGetDevCaps
using System;
using System.Runtime.InteropServices; The winmm dll may not execute properly on 64-bit systems. Consequently, the StructLayout must be Sequential, with CharSet = Ansi, and Pack = 4. This particular type has some special layout considerations (the c union keyword) which typically means developers would use the explicit layout. However, the explicit layout breaks down on 64-bit systems for any type with an IntPtr in the type. Consequently, the C# types have been redesigned to use Sequential layout so that they will automatically adjust to 64-bit systems. This means private fields with public properties which perform the gunky work of making it look like there is a union. 21: PlaySound
''' The pszSound parameter is a system-event alias in the
private void button2_Click(object sender, System.EventArgs e)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click In .Net 2.0 you can use the System.Media.SoundPlayer class instead: Or you can play a system specific sound:
My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Asterisk)
static extern UInt32 timeGetSystemTime( ref MmTime mmTime, UInt32 sizeMmTime );
Declare Function timeGetSystemTime Lib "winmm.dll" (TODO) As TODO 23: timeGetTime 24: timeSetEvent System.Threading.Timer
<System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=32)> _
[System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 32)]
waveOutGetDevCaps(i, wc, System.Runtime.InteropServices.Marshal.SizeOf(wc))
System.Diagnostics.Debug.WriteLine("\n" + waveOutCaps.ToString());
System.Diagnostics.Debug.WriteLine("\n" + waveInCaps.ToString());
using System;
using System.Runtime.InteropServices;
System.Console.Write(wave.waveOutGetNumDevs()); comctl3227: ImageList_DrawEx
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
namespace System.Windows.Forms
/// so the image is blended with the color of the destination device context or <see cref="ImageListDrawColor.Default"/> so the image is drawn using the system highlight color as the foreground color.</param>
/// <exception cref="System.ComponentModel.Win32Exception">Unable to draw the image with defined parameters.</exception>
/// <exception cref="System.ArgumentOutOfRangeException">The imageIndex is not in the current list.</exception>
/// <exception cref="System.ComponentModel.Win32Exception">The image cannot be added as an overlay.</exception>
/// <exception cref="System.ComponentModel.Win32Exception">The image cannot be added as an overlay.</exception>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
namespace System.Windows.Forms
/// so the image is blended with the color of the destination device context or <see cref="ImageListDrawColor.Default"/> so the image is drawn using the system highlight color as the foreground color.</param>
/// <exception cref="System.ComponentModel.Win32Exception">Unable to draw the image with defined parameters.</exception>
/// <exception cref="System.ArgumentOutOfRangeException">The imageIndex is not in the current list.</exception>
/// <exception cref="System.ComponentModel.Win32Exception">The image cannot be added as an overlay.</exception>
/// <exception cref="System.ComponentModel.Win32Exception">The image cannot be added as an overlay.</exception> shell32
using System;
using System.Runtime.InteropServices;
using System.Text; 30: CSIDL
CSIDL_SYSTEM = 0x0025, // GetSystemDirectory()
CSIDL_SYSTEMX86 = 0x0029, // x86 system directory on RISC System.Enviroment.SpecialFolder 31: CSIDL
/// CSIDL values provide a unique system-independent way to identify special folders used frequently by applications,
/// but which may not have the same name or location on any given system. For example, the system folder may be
/// "C:\Windows" on one system and "C:\Winnt" on another. These constants are defined in Shlobj.h and Shfolder.h.
/// The remaining CSIDLs correspond to either file system folders or virtual folders. Where the CSIDL
/// identifies a file system folder, a commonly used path is given as an example. Other paths may be used.
/// Version 5.0. The file system directory that is used to store administrative tools for an individual user.
/// The file system directory that corresponds to the user's nonlocalized Startup program group.
/// Version 4.71. The file system directory that serves as a common repository for application-specific data.
/// redistributable Shfolder.dll for systems that do not have the Microsoft Internet Explorer 4.0 integrated Shell installed.
/// Version 6.0. The file system directory acting as a staging area for files waiting to be written to CD.
/// Version 5.0. The file system directory containing administrative tools for all users of the computer.
/// The file system directory that corresponds to the nonlocalized Startup program group for all users.
/// Valid only for Microsoft Windows NT systems.
/// Version 5.0. The file system directory containing application data for all users. A typical path is
/// The file system directory that contains files and folders that appear on the desktop for all users.
/// A typical path is C:\Documents and Settings\All Users\Desktop. Valid only for Windows NT systems.
/// The file system directory that contains documents that are common to all users. A typical paths is
/// C:\Documents and Settings\All Users\Documents. Valid for Windows NT systems and Microsoft Windows 95
/// and Windows 98 systems with Shfolder.dll installed.
/// The file system directory that serves as a common repository for favorite items common to all users.
/// Valid only for Windows NT systems.
/// Version 6.0. The file system directory that serves as a repository for music files common to all users.
/// Version 6.0. The file system directory that serves as a repository for image files common to all users.
/// The file system directory that contains the directories for the common program groups that appear on the
/// Valid only for Windows NT systems.
/// The file system directory that contains the programs and folders that appear on the Start menu for all users.
/// A typical path is C:\Documents and Settings\All Users\Start Menu. Valid only for Windows NT systems.
/// The file system directory that contains the programs that appear in the Startup folder for all users.
/// A typical path is C:\Documents and Settings\All Users\Start Menu\Programs\Startup. Valid only for Windows NT systems.
/// The file system directory that contains the templates that are available to all users. A typical path is
/// C:\Documents and Settings\All Users\Templates. Valid only for Windows NT systems.
/// Version 6.0. The file system directory that serves as a repository for video files common to all users.
/// The file system directory that serves as a common repository for Internet cookies. A typical path is
/// The file system directory used to physically store file objects on the desktop (not to be confused with
/// The file system directory that serves as a common repository for the user's favorite items. A typical path is
CSIDL_HISTORY = 0x0022, // The file system directory that serves as a common repository for Internet history items.
/// Version 4.72. The file system directory that serves as a common repository for temporary Internet files.
/// Version 5.0. The file system directory that serves as a data repository for local (nonroaming) applications.
/// The file system directory that serves as a common repository for music files. A typical path is
/// Version 5.0. The file system directory that serves as a common repository for image files.
/// Version 6.0. The file system directory that serves as a common repository for video files.
/// A file system directory containing the link objects that may exist in the My Network Places virtual folder.
/// Previous to Version 6.0. The file system directory used to physically store a user's common repository of documents.
/// ITEMIDLIST for the virtual location, or refer to the technique described in Managing the File System.
/// The file system directory that contains the link objects that can exist in the Printers virtual folder.
/// Version 6.0. The file system directory containing user profile folders. A typical path is C:\Documents and Settings.
/// Valid only for Windows NT, Windows 2000, and Windows XP systems. Not valid for Windows Millennium Edition (Windows Me).
/// The file system directory that contains the user's program groups (which are themselves file system directories).
/// The file system directory that contains shortcuts to the user's most recently used documents. A typical path is
/// The file system directory that contains Send To menu items. A typical path is C:\Documents and Settings\username\SendTo.
/// The file system directory containing Start menu items. A typical path is C:\Documents and Settings\username\Start Menu.
/// The file system directory that corresponds to the user's Startup program group. The system starts these programs
CSIDL_SYSTEM = 0x0025, // Version 5.0. The Windows System folder. A typical path is C:\Windows\System32.
/// The file system directory that serves as a common repository for document templates. A typical path is
/// Version 5.0. The Windows directory or SYSROOT. This corresponds to the %windir% or %SYSTEMROOT% environment variables. or better yet, use the dotnet function "System.Environment.ExpandEnvironmentVariables" System.Environment.ExpandEnvironmentVariables Both the ExtractAssociatedIcon and 'System.Drawing.Icon.ExtractAssociatedIcon' extract only a 32x32 pixels icon. Use static method 'System.Drawing.Icon.ExtractAssociatedIcon(string filePath)' in assembly 'System.Drawing.dll' (.net 2) 34: ExtractIcon
using System;
using System.Drawing;
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices
Imports System.Drawing
iconsrc.Save(System.IO.File.OpenWrite(icondestpath)) 35: ExtractIconEx
using System;
using System.Drawing;
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices
Imports System.Drawing
iconsrc.Save(System.IO.File.OpenWrite(icondestpath))
static extern TODO FileSystemWatcher(TODO);
Declare Function FileSystemWatcher Lib "shell32.dll" (TODO) As TODO Drag FileSystemWatcher control in your form from toolbox and add the events for created,deletion and renaming. this.fileSystemWatcher.EnableRaisingEvents = true; this.fileSystemWatcher.IncludeSubdirectories = true; this.fileSystemWatcher.SynchronizingObject = this; this.fileSystemWatcher.Created += new System.IO.FileSystemEventHandler(this.fileSystemWatcher_Created); this.fileSystemWatcher.Deleted += new System.IO.FileSystemEventHandler(this.fileSystemWatcher_Deleted); this.fileSystemWatcher.Renamed += new System.IO.RenamedEventHandler(this.fileSystemWatcher_Renamed); public System.IO.FileSystemWatcher fileSystemWatcher; private void fileSystemWatcher_Renamed(object sender, RenamedEventArgs e) private void fileSystemWatcher_Deleted(object sender, FileSystemEventArgs e) private void fileSystemWatcher_Created(object sender, FileSystemEventArgs e) By this property if you want to check file has been removed ,deleted from physical path then this will be true and you can check like if you have a tree view and you dont want to repopulate your tree view then use filesystemwatcher and repopulate the tree only when files have been changed,delete or rename. or you can throw a messagebox like above. 37: FindExecutable
Imports System.Runtime.InteropServices
Imports System.Text using System; using System.Text; using System.Runtime.InteropServices; private void mnuDynamic_Click(object sender, System.EventArgs e)
/// in the system image list that has changed.
/// in the system image list that has changed.
/// An image in the system image list has changed.
' An image in the system image list has changed.
For older systems such as Windows 2000 that do not have the entry point 40: PickIconDlg
private static extern int PickIconDlg(IntPtr hwndOwner, System.Text.StringBuilder lpstrFile, int nMaxFile, ref int lpdwIconIndex);
System.Text.StringBuilder sb;
iconfile = Environment.GetFolderPath(Environment.SpecialFolder.System);
sb = new System.Text.StringBuilder(iconfile, 500); Dim iconfile As String = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\shell32.dll" Be sure to also set the System.AppUserModel.ID property of any shortcuts created for your application to the same value, as well, or they may not be pinnable to the taskbar. 42: SHAppBarMessage
/// Sends an appbar message to the system.
/// Registers a new appbar and specifies the message identifier that the system should use to
/// <description>Unregisters an appbar, removing the bar from the system's internal list.</description>
/// system taskbar. Other objects, particularly toolbars supplied with third-party software, also can be
/// Notifies the system to activate or deactivate an appbar. The lParam member of the APPBARDATA
/// <description>Notifies the system when an appbar's position has changed.</description>
Imports System
Imports System.Text
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Timers
Imports System.Runtime.InteropServices
Private MyDockForm As System.Windows.Forms.Form
Dim PosfixTimer As New System.Timers.Timer
Shared Function GetSystemMetrics(ByVal Index As Integer) As Integer
<DllImport("User32.dll", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Auto)> _
Friend Sub New(ByRef DockForm As System.Windows.Forms.Form, ByVal dockStyle As AppBarDockStyle, ByVal AppBarSize As Size)
abd.rc.bottom = SystemInformation.PrimaryMonitorSize.Height
abd.rc.right = SystemInformation.PrimaryMonitorSize.Width
abd.rc.right = SystemInformation.PrimaryMonitorSize.Width
abd.rc.bottom = SystemInformation.PrimaryMonitorSize.Height
Private Overloads Sub OnLoad(ByVal sender As Object, ByVal e As System.EventArgs)
Private Overloads Sub OnClosing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) 43: SHBindToParent using System; using System.Collections; // ArrayList using System.Text; using System.Windows.Forms; // MessageBox using System.Runtime.InteropServices; using System; using System.Runtime.InteropServices;
SFGAO_FILESYSTEM = 0x40000000,
IntPtr pathPtr = Marshal.AllocHGlobal((int)(260 * Marshal.SystemDefaultCharSize)); If using .net version 1.1 or greater, you can use [System.Windows.Forms.FolderBrowserDialog] instead -- as long as you are only browsing for folders! If you want to browse for computers or printers, the .Net version does not seem to support this. 46: ShellAbout Windows 95/98/Me: ShellAbout is supported by the Microsoft Layer for Unicode (MSLU). To use MSLU, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows Me/98/95 Systems. using System.Runtime.InteropServices; using System.Reflection; 47: ShellExecuteEx
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices
info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(info)
Dim ex As New System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error())
info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(info);
Dim ex As New System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error())
System.Diagnostics.Debug.Write(hresult); 49: SHFileOperation
using System.Runtime.InteropServices;
Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(string, Microsoft.VisualBasic.FileIO.UIOption, Microsoft.VisualBasic.FileIO.RecycleOption); 50: SHFormatDrive The options field should be 0 for a full disk format, pass SHFMT_OPT_FULL for a Quick Format, or set SHFMT_OPT_SYSONLY to create an MS-DOS System Boot Disk. 51: SHGetFileInfo
using System;
using System.Runtime.InteropServices;
using System.Drawing;
/// <summary>get system icon index</summary>
/// that returns a 32x32 or 16x16 System.Drawing.Icon depending on which function you call
Icon icon = (Icon)System.Drawing.Icon.FromHandle(shinfo.hIcon).Clone(); If you only want to get the icon you can use managed System.Drawing.Icon.ExtractAssociatedIcon(String file) 52: SHGetFolderPath
// Version 5.0. The file system directory that is used
// Version 5.0. The file system directory containing
// Version 4.71. The file system directory that serves as
// for systems that do not have the Microsoft Internet Explorer 4.0
// Version 5.0. The file system directory containing
// The file system directory that contains documents
// Valid for Windows NT systems and Microsoft Windows 95 and
// Windows 98 systems with Shfolder.dll installed.
// The file system directory that serves as a common repository
// The file system directory that serves as a common repository
// Version 4.72. The file system directory that serves as
// Version 5.0. The file system directory that serves as a data
// Version 5.0. The file system directory that serves as
// Previous to Version 6.0. The file system directory used to
// Managing the File System.
// Valid only for Windows NT, Windows 2000, and Windows XP systems.
// Version 5.0. The Windows System folder. A typical
// path is C:\Windows\System32.
System = 0x0025,
// This corresponds to the %windir% or %SYSTEMROOT% environment
CSIDL_SYSTEM = 0x0025, // GetSystemDirectory()
CSIDL_SYSTEMX86 = 0x0029, // x86 system directory on RISC
/// Gets the system fonts directory path. 54: SHGetImageList These images are the size specified by GetSystemMetrics called with SM_CXSMICON and GetSystemMetrics called with SM_CYSMICON.
public static readonly Guid System = new Guid( "1AC14E77-02E7-4E5D-B744-2EB1AE5198B7" );
public static readonly Guid SystemX86 = new Guid( "D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27" ); also you will get the english FolderPath, even on a System with another Language. On a German System the Playlists-Folder is called "Musikwiedergabelisten", but you will get "Playlists"
string s = System.Runtime.InteropServices.Marshal.PtrToStringUni( pPath );
System.Runtime.InteropServices.Marshal.FreeCoTaskMem( pPath ); 56: SHGetMalloc <System.Runtime.InteropServices.DllImportAttribute("shell32.dll", EntryPoint:="SHGetNameFromIDList")> _
<System.Runtime.InteropServices.InAttribute()> _
ByVal pidl As System.IntPtr, _
ByRef ppszName As System.IntPtr) As Integer Imports System Imports System.Runtime.InteropServices
SYSTEM = &H25
SYSTEMX86 = &H29
SYSTEM= &H1000 ' Windows 7 and later. The specified items are system items.
FILESYSANCESTOR = &H10000000 ' may contain children with FILESYSTEM
FILESYSTEM = &H40000000 ' is a win32 file system object (file/folder/root)
<System.Runtime.InteropServices.DllImportAttribute("shell32.dll", EntryPoint:="ILFree")> _
Private Shared Sub ILFree(<System.Runtime.InteropServices.InAttribute()> ByVal pidl As System.IntPtr)
<System.Runtime.InteropServices.DllImportAttribute("shell32.dll", EntryPoint:="SHGetNameFromIDList")> _
<System.Runtime.InteropServices.InAttribute()> _
ByVal pidl As System.IntPtr, _
ByRef ppszName As System.IntPtr) As Integer
<System.Runtime.InteropServices.DllImportAttribute("shell32.dll", EntryPoint:="SHParseDisplayName")> _ <System.Runtime.InteropServices.InAttribute(), _ System.Runtime.InteropServices.MarshalAsAttribute( _
System.Runtime.InteropServices.UnmanagedType.LPWStr)> _ ByVal pszName As String, <System.Runtime.InteropServices.InAttribute()> _ ByVal pbc As System.IntPtr, _ ByRef ppidl As System.IntPtr, _
/// Converts an item identifier list to a file system path. (Note: SHGetPathFromIDList calls the ANSI version, must call SHGetPathFromIDListW for .NET)
/// <param name="pszPath">Address of a buffer to receive the file system path. This buffer must be at least MAX_PATH characters in size.</param>
''' Converts an item identifier list to a file system path. (Note: SHGetPathFromIDList calls the ANSI version, must call SHGetPathFromIDListW for .NET)
''' <param name="pszPath">Address of a buffer to receive the file system path. This buffer must be at least MAX_PATH characters in size.</param>
<MarshalAs(UnmanagedType.LPTStr)> pszPath As System.Text.StringBuilder ) As <MarshalAs(UnmanagedType.Bool)> Boolean
fileP = My.Computer.FileSystem.SpecialDirectories.MyDocuments
MessageBox.Show(c.FileSystem.SpecialDirectories.MyDocuments);
CSIDL_SYSTEM = 0x0025, // GetSystemDirectory()
CSIDL_SYSTEMX86 = 0x0029, // x86 system directory on RISC System.Drawing.SystemIcons, although note that not all icons are included and at least the Shield icon is incorrect on Win 7 / Win 2008. Cut off search results after 60. Please refine your search. |