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 "Command" in [All]

Interfaces

.

      void CommandStateChange(int Command, [MarshalAs(UnmanagedType.VariantBool)] bool Enable);

.

      Sub CommandStateChange(ByVal Command As Integer, <MarshalAs(UnmanagedType.VariantBool)> ByVal Enable As Boolean)

.

    void InvokeCommand(IntPtr pici);

.

    void GetCommandString(int idcmd, uint uflags, int reserved, StringBuilder commandstring, int cch);

.

''' Specifies Style of the band object, its Name(displayed in explorer menu) and HelpText(displayed in status bar when menu command selected).

.

''' Specifies Style of the band object, its Name(displayed in explorer menu) and HelpText(displayed in status bar when menu command selected).

.

     uint uCommand, uint dwData,

.

    Function ShowHelp(ByVal hwnd As IntPtr, <MarshalAs(UnmanagedType.LPWStr)> ByVal pszHelpFile As String, ByVal uCommand As Integer, ByVal dwData As Integer, ByVal ptMouse As tagPoint, <MarshalAs(UnmanagedType.IDispatch)> ByVal pDispatchObjectHit As Object) As Integer

.

public interface IOleCommandTarget

.

    //IOleCommandTarget interface from your application, it would

.

Interface IOleCommandTarget

.
Documentation
[IOleCommandTarget] on MSDN
.

    public interface IOleCommandTarget

.

        //IOleCommandTarget interface from your application, it would

.

Here is some complete code for the two classes that are required to fully utilize the IOleCommandTarget COM interface as referenced on http://msdn.microsoft.com/en-us/library/office/aa701079(v=office.12).aspx#infopath2007hostinginfopathforms_notavailable . I am posting this becasue we all know how MS likes to make links and pages disappear from time to time. While they are still valid, you can get example projects at: http://www.microsoft.com/en-us/download/details.aspx?id=21356 InfoPath2007UsingIOLECommands.exe and InfoPath2007UsingIOLECommandsCOM.exe. Happy InfoPathing! If there is such a thing. The happy part that is...

.

NativeCommands.cs

.

    /// This class' methods wrap the IOLE commands.

.

    /// for using IOLE Commands.

.

    public class NativeCommands

.

        private string lastCommandExecuted;

.

        /// returns the last command that was executed.

.

        public string LastCommandExecuted

.

                return lastCommandExecuted;

.

        /// This structure holds the command to be queried and the result of the query

.

            /// Command to be queried

.

            /// Gets or sets the command to be queried.

.

        //import the IOLECommandTarget interface to perform IOLE commands

.

        //IOLECommandTarget is registered in the registry

.

        private interface IOleCommandTarget

.

            /// Checks to see if a given command can be executed

.

            /// <param name="pguidCmdGroup">Unique identifier of the command group, NULL to specify the standard group</param>

.

            /// <param name="cCmds">The number of commands in the prgCmds array</param>

.

            /// <param name="prgCmds">Array of OLECMD structures that indicate the commands status information is required</param>

.

            /// <param name="pCmdText">Pointer to name or status of command, NULL indicates this is not necessary</param>

.

            /// Executes a specified command

.

            /// <param name="pguidCmdGroup">Command group</param>

.

            /// <param name="nCmdID">Identifier of command to execute</param>

.

            /// <param name="nCmdExecOpt">Options for executing the command</param>

.

            /// <param name="pvaOut">Command output</param>

.

        /// Designates the type of support provided by an object for the specified command

.

            /// The command is supported by this object

.

            /// The command is available and enabled

.

            /// The command is an on-off toggle and is currently on

.

        /// Queries whether or not a command can be executed

.

        /// <param name="commandID">ID number of the command to query</param>

.

        /// <returns>True if command can be performed and false if it cannot</returns>

.

        public bool QueryCommandStatus(FormControlCommandIds.CommandIds commandId)

.

            OLECMD[] commands = new OLECMD[1];

.

            commands[0].CmdId = Convert.ToUInt16(commandId,CultureInfo.CurrentCulture);

.

            commands[0].CmdF = 0;

.

            QueryCommandStatus(commands);

.

            //if command is supported and enabled command can be executed

.

            return (((commands[0].CmdF & (uint)OleCmdf.Supported) != 0) && ((commands[0].CmdF & (uint)OleCmdf.Enabled) != 0));

.

        /// Queries whether or not a command can be executed

.

        /// <param name="commands">Group of commands to be queried</param>

.

        public void QueryCommandStatus(OLECMD[] commands)

.

            //Get a IOLECommandTarget object form the ActiveX control

.

            IOleCommandTarget commandTarget = _infoPathControl.GetOcx() as IOleCommandTarget;

.

                commandTarget.QueryStatus(ref FormControlCommandIds.CommandGroup, Convert.ToUInt16(commands.Length), commands, IntPtr.Zero);

.

                throw new HostedException("An error occurred while attempting to query commands", ex);

.

        #region Command Execution

.

        /// Checks whether or not the specified command is on or off

.

        /// <param name="commandID">Command to be executed</param>

.

        /// <returns>True if command is activated or False if not</returns>

.

        public bool IsCommandOn(FormControlCommandIds.CommandIds commandId)

.

            OLECMD[] commands = new OLECMD[1];

.

            commands[0].CmdId = Convert.ToUInt16(commandId,CultureInfo.CurrentCulture);

.

            commands[0].CmdF = 0;

.

            QueryCommandStatus(commands);

.

            return (((commands[0].CmdF & (uint)OleCmdf.Supported) != 0) && ((commands[0].CmdF & (uint)OleCmdf.Enabled) != 0) &&

.

                ((commands[0].CmdF & (uint)OleCmdf.Latched) != 0));

.

        /// Executes a given command

.

        /// <param name="CommandID">Command to be executed</param>

.

        /// <returns>Results of executing a command</returns>

.

        public object ExecuteCommand(FormControlCommandIds.CommandIds commandId)

.

            return ExecuteCommand(commandId, null);

.

        /// Executes a given command with specified parameters

.

        /// <param name="CommandID">Command to be executed</param>

.

        /// <returns>Results of executing the command</returns>

.

        public object ExecuteCommand(FormControlCommandIds.CommandIds commandId, object vaIn)

.

            //remember the last command executed

.

            lastCommandExecuted = commandId.ToString();

.

            //make sure the command can be executed first

.

            if (!QueryCommandStatus(commandId))

.

            // Get the commandTarget from the control

.

            IOleCommandTarget commandTarget = _infoPathControl.GetOcx() as IOleCommandTarget;

.

                commandTarget.Exec(ref FormControlCommandIds.CommandGroup, Convert.ToUInt16(commandId,CultureInfo.CurrentCulture),

.

                throw new HostedException("An error occurred while executing command " + commandId.ToString(), ex);

.

    /// The class makes calls to perform commands against the form control

.

    /// Class is designed to be a central point for executing commands against a form control

.

    public class FormController : NativeCommands

.

        /// Commands

.

            /// Uses the supported InfoPath IOLECommand

.

        /// Makes sure the command was executed properly

.

        /// <param name="commandResult">The result from executing the command</param>

.

        /// <returns>The result from executing the command</returns>

.

        private object ChkResult(object commandResult)

.

            if ((commandResult !=null) && (commandResult.GetType().Equals(typeof(int))))

.

                int result = (int)commandResult;

.

                    throw new NonApplicableCommandException("The command could not be executed at this time because it is not applicable. Command: " +

.

                        LastCommandExecuted);

.

            return commandResult;

.

        /// Makes sure the command was executed properly

.

        /// <param name="commandResult">The result from executing the command</param>

.

        /// <param name="expectedReturnType">The type of object the command was expected to return</param>

.

        /// <returns>The result from executing the command</returns>

.

        private object ChkResult(object commandResult, Type expectedReturnType)

.

            commandResult = ChkResult(commandResult);

.

            if ((commandResult!=null) && (!commandResult.GetType().Equals(expectedReturnType)))

.

                    " but received " + commandResult.GetType().ToString() + "\nCommand: " + LastCommandExecuted);

.

            return commandResult;

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.Save));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SaveAs));

.

                        ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.Close));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingBold));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingItalic));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingUnderline));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingStrikethrough));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingSuperscript));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingSubscript));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.IncreaseFontSizeBy2));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.DecreaseFontSizeBy2));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ClearFontFormatting));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingHeading1));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingHeading2));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingHeading3));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingHeading4));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingHeading5));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingHeading6));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFontFormattingNormal));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetFontsAvailableCount), typeof(int)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetFontAvailableByIndex, index), typeof(string)),CultureInfo.CurrentCulture

.

                        ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedTextFont),typeof(string)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedTextFont, value));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetFontSizesAvailableCount),typeof(int)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetFontSizeAvailableByIndex, index), typeof(string)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedTextFontSize), typeof(string)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedTextFontSize, value));

.

                            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedTextFontColor), typeof(int)), CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedTextFontColor, vaIn));

.

                        ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetDefaultFontColor), typeof(int)),CultureInfo.CurrentCulture

.

                        ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedTextHighlightColor), typeof(int)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedTextHighlightColor, vaIn));

.

                        ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetDefaultHighlightColor), typeof(int)),CultureInfo.CurrentCulture

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.AlignTextLeft));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.AlignTextCenter));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.AlignTextRight));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.AlignTextJustify));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.IncreaseIndent));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.DecreaseIndent));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSingleLineSpacing));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetDoubleLineSpacing));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.Set15LineSpacing));

.

                        ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedTextBackgroundColor)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedTextBackgroundColor, vaIn));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.Undo));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.Redo));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.Cut));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.Copy));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.Paste));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectAll));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.FormatPainterCopyFormatting));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.FormatPainterApplyFormatting));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.FormatPainterCopyFormattingPersistent));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.FormatPainterApplyFormattingPersistent));

.

                return IsCommandOn(FormControlCommandIds.CommandIds.SetFindReplaceOptionUseWildcards);

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFindReplaceOptionUseWildcards, value));

.

                return IsCommandOn(FormControlCommandIds.CommandIds.SetFindReplaceOptionMatchCase);

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFindReplaceOptionMatchCase, value));

.

                return IsCommandOn(FormControlCommandIds.CommandIds.SetFindReplaceOptionWholeWordOnly);

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFindReplaceOptionWholeWordOnly, value));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetFindReplaceOptionSearchDirection),typeof(int)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFindReplaceOptionSearchDirection, value));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetFindReplaceState),typeof(int)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetFindString),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetFindString, value));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetReplaceWithString),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetReplaceWithString, value));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.FindReplaceFindNext));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.Replace));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ReplaceAll));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ClearBulletedList));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ClearNumberedList));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertNumberedList));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertBulletedList));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertNumberedListDecimal));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertNumberedListRomanUppercase));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertNumberedListRomanLowercase));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertNumberedListAlphaUppercase));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertNumberedListAlphaLowercase));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertBulletedList));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertBulletedListEmptyCircle));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertBulletedListSolidSquare));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.DrawTable));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.EraseTable));

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertTable, vaIn));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.DeleteSelectedTable));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectTable));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertColumnLeft));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertColumnRight));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertRowAbove));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertRowBelow));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.DeleteSelectedColumns));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.DeleteSelectedRows));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectColumns));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectPreviousColumn));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectNextColumn));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectRows));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectPreviousRow));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectNextRow));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectCell));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.MergeCells));

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SplitCells, vaIn));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedCellAlignmentTop));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedCellAlignmentMiddle));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedCellAlignmentBottom));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedCellVerticalAlignment),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedCellPadding, vaIn));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedCellTopPadding),typeof(string)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedCellRightPadding),typeof(string)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedCellBottomPadding),typeof(string)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedCellLeftPadding),typeof(string)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetTableHorizontalAlignment),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetTableHorizontalAlignment, value));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetTableDirection),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetTableDirection, value));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedRowHeight),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedRowHeight, value));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSelectedColumnWidth),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSelectedColumnWidth, value));

.

                return IsCommandOn(FormControlCommandIds.CommandIds.SelectNextRow);

.

                return IsCommandOn(FormControlCommandIds.CommandIds.SelectPreviousRow);

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectNextRow));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectPreviousRow));

.

                return IsCommandOn(FormControlCommandIds.CommandIds.SelectNextColumn);

.

                return IsCommandOn(FormControlCommandIds.CommandIds.SelectPreviousColumn);

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectNextColumn));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectPreviousColumn));

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.FindNextMisspelledWord),typeof(bool)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSpellingSuggestionsCount),typeof(int)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSpellingSuggestion, index), typeof(string)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetCurrentMisspelledWord),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.IgnoreMisspelledWord, misspelled));

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.IgnoreAllOfMisspelledWord, misspelled));

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.CorrectMisspelledWord, vaIn));

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.CorrectAllOfMisspelledWord, vaIn));

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.AddWordToDictionary, misspelled));

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.DeleteMisspelledWord, misspelled));

.

                return IsCommandOn(FormControlCommandIds.CommandIds.SetSpellingOptionCheckAsYouType);

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetSpellingOptionCheckAsYouType, value));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetPictureInlineWithText));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetPictureToLeftOfText));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetPictureToRightOfText));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetPictureHeight),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetPictureWidth, value));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetPictureWidth),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetPictureWidth, value));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetPictureAlternativeText),typeof(string)),CultureInfo.CurrentCulture

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetPictureAlternativeText, value));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetPictureTextWrapping),typeof(string)),CultureInfo.CurrentCulture

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ShowInsertSymbolDialog));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertImage, filePath));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertPictureFromFile));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertHorizontalLine));

.

                return IsCommandOn(FormControlCommandIds.CommandIds.SelectHyperlink);

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetHyperlinkAddress),typeof(string)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetHyperlinkDisplayText),typeof(string)),CultureInfo.CurrentCulture

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SelectHyperlink));

.

                ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.InsertHyperlink, vaIn));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.RemoveHyperlink));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GotoFirstErrorOnView));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GotoNextErrorOnView));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ShowCurrentErrorMessage));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.WorkOffline));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.IsFormDirectionLeftToRight),typeof(uint)),CultureInfo.CurrentCulture

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.IsFormDirectionRightToLeft),typeof(uint)),CultureInfo.CurrentCulture

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetTextDirectionDefault));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetTextDirectionLeftToRight));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetTextDirectionRightToLeft));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.Submit));

.

                    ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.GetSubmitButtonCaption),typeof(string)),CultureInfo.CurrentCulture

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ShowBordersShadingDialog));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ShowDigitalSignaturesDialog));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ShowSetLanguageDialog));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ShowMergeFormDialog));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ShowImportFormDataDialog));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ShowExportToWebDialog));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ShowExportToPDFXPSDialog));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ShowExportToExcelDialog));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetAutoSpaceBetweenAsianTextAndNumbers));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.SetAutoSpaceBetweenAsianAndLatinText));

.

            ChkResult(ExecuteCommand(FormControlCommandIds.CommandIds.ClearAutoSpace));

.

    /// <summary>Retrieves the command-line arguments associated with a Shell link object</summary>

.

    /// <summary>Sets the command-line arguments for a Shell link object</summary>

.

    /// <summary>Retrieves the show command for a Shell link object</summary>

.

    /// <summary>Sets the show command for a Shell link object. The show command sets the initial show state of the window.</summary>

.

    '[helpstring("Retrieves the shell link command-line arguments")]

.

    '[helpstring("Sets the shell link command-line arguments")]

.

    '[propget, helpstring("Retrieves or sets the shell link show command")]

.

    '[propput, helpstring("Retrieves or sets the shell link show command")]

.

    /// <summary>Retrieves the command-line arguments associated with a Shell link object</summary>

.

    /// <summary>Sets the command-line arguments for a Shell link object</summary>

.

    /// <summary>Retrieves the show command for a Shell link object</summary>

.

    /// <summary>Sets the show command for a Shell link object. The show command sets the initial show state of the window.</summary>

.

    ''' <summary>Retrieves the command-line arguments associated with a Shell link object</summary>

.

    ''' <summary>Sets the command-line arguments for a Shell link object</summary>

.

    ''' <summary>Retrieves the show command for a Shell link object</summary>

.

    ''' <summary>Sets the show command for a Shell link object. The show command sets the initial show state of the window.</summary>

.

     // Command creation callback

.

     HRESULT OnCreateUICommand(UInt32 commandId,

.

                   UI_CommandType typeID,

.

                   [Out, MarshalAs(UnmanagedType.Interface)] out IUICommandHandler commandHandler);

.

     // Command destroy callback

.

     HRESULT OnDestroyUICommand(UInt32 commandId,

.

                UI_CommandType typeID,

.

                [MarshalAs(UnmanagedType.Interface)] IUICommandHandler commandHandler);

.
Summary
The IUICommandHandler interface is implemented by the application and defines the methods for gathering Command information and handling Command events from the Windows Ribbon (Ribbon) framework.
.

// Command handler interface

.

public interface IUICommandHandler

.

     HRESULT Execute(UInt32 commandId,              // the command that has been executed

.

             [MarshalAs(UnmanagedType.Interface)] IUISimplePropertySet commandExecutionProperties); // additional data for this execution

.

     HRESULT UpdateProperty(UInt32 commandId,

.
Documentation
[IUICommandHandler] on MSDN
.

     // Loads and instantiates the views and commands specified in markup

.

     HRESULT GetUICommandProperty(UInt32 commandId, [In] ref PropertyKey key, out PropVariant value);

.

     HRESULT SetUICommandProperty(UInt32 commandId, [In] ref PropertyKey key, [In] ref PropVariant value);

.

     HRESULT InvalidateUICommand(UInt32 commandId, UI_Invalidations flags, [In] ref PropertyKey key);

.

     // Flush all the pending UI command updates

.

        [In, MarshalAs(UnmanagedType.BStr)] string strCommandline,

.

    void DeviceCommand(

dhcpsapi

.

        SqlCommand selCommand = new SqlCommand(strSQL, sqlConnection1);

.

        selCommand.CommandType = CommandType.Text;

.

        SqlDataReader rowReader = selCommand.ExecuteReader();

gsapi

.

        // execute this command, to convert pdf to tiff

coredll

.

    uint MF_BYCOMMAND = 0x00000000;

.

    string lpCommandLine,

.

    uint MF_BYCOMMAND = 0x00000000;

.

Use MF_BYCOMMAND to specify the item ID on [itemId] parameter or use MF_BYPOSITION to specify the zero-based index of the item, if neither MF_BYCOMMAND nor MF_BYPOSITION is specified the item ID is used.

.

    EnableMenuItem(hMenu, 1002, MF_BYCOMMAND | MF_GRAYED);

.

    uint WM_COMMAND = 0x0111;

.

nCmdShow is an integer type parameter specifying how the window is to be shown. See ShowWindowCommand

wininet

.
Summary
Sends commands directly to an FTP server.
.

public static extern bool FtpCommandA

.

[MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszCommand,

.

IntPtr phFtpCommand);

.

Declare Function FtpCommandA Lib "wininet.dll" _

.

ByVal lpszCommand As String, _

.

ByVal phFtpCommand As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean

.

lpszCommand (in) A pointer to a string that contains the command to send to the FTP server.

.

phFtpCommand (out) A pointer to a handle that is created if a valid data socket is opened. The fExpectResponse parameter must be set to TRUE for phFtpCommand to be filled.

.

Dim ret As Boolean = FTPCommandA(ConnectionHandle, False, 0, sCommand, IntPtr.Zero, IntPtr.Zero)

.
Documentation

msi

.

static extern UInt32 MsiApplyPatch(string patchPackage, string installPackage, INSTALLTYPE installType, string commandLine);

.

commandLine

.

   Specifies command line property settings

.

static extern UInt32 MsiInstallProduct(string packagePath, string commandLine);

.

Declare Function MsiInstallProduct Lib "msi.dll" (packagePath As String, commandLine As String) As UInt32

.

szCommandLine

.

A null-terminated string that specifies the command line property settings. This should be a list of the format Property=Setting Property=Setting. For more information, see About Properties.

.

To perform an administrative installation, include ACTION=ADMIN in szCommandLine. For more information, see the ACTION property.

.

You can completely remove a product by setting REMOVE=ALL in szCommandLine.

.

        // The sql command. Note the "?" placeholder for the value.

.

        // Open a view to use to apply the change. Here's where you specify your sql command.

userenv

.

To build: run the following commands at bash command prompt, after copying an icon file, say bfe.ico, to the cwd:

Structures

.

    public struct CMINVOKECOMMANDINFOEX {

.

        public int            cbSize;        // Marshal.SizeOf(CMINVOKECOMMANDINFO)

.

        public int            dwHotKey;        // Optional hot key to assign to any application activated by the command. If the fMask member does not specify CMIC_MASK_HOTKEY, this member is ignored.

.

        public IntPtr        hIcon;            // Icon to use for any application activated by the command. If the fMask member does not specify CMIC_MASK_ICON, this member is ignored.

.

        public string        lpVerbW;                // Unicode verb, for those commands that can use it.

.

        public string        lpParametersW;        // Unicode parameters, for those commands that can use it.

.

        public string        lpDirectoryW;        // Unicode directory, for those commands that can use it.

.

        public POINT        ptInvoke;                // Point where the command is invoked. This member is not valid prior to Microsoft Internet Explorer 4.0.

.

Structure CMINVOKECOMMANDINFOEX

.
Documentation
[CMINVOKECOMMANDINFOEX] on MSDN
.

public static extern bool CreateProcessWithTokenW(IntPtr hToken, LogonFlags dwLogonFlags, string lpApplicationName, string lpCommandLine, CreationFlags dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, [In] ref STARTUPINFO lpStartupInfo, out PROCESS_INFORMATION lpProcessInformation);

.

    Public Shared Function CreateProcessWithTokenW(hToken As IntPtr, dwLogonFlags As Integer, lpApplicationName As String, lpCommandLine As String, dwCreationFlags As Integer, lpEnvironment As IntPtr, lpCurrentDirectory As IntPtr, ByRef lpStartupInfo As STARTUPINFO, ByRef lpProcessInformation As PROCESS_INFORMATION) As Boolean

.
Summary
Used by the (NetBIOS) function to retrieve the list of LAN Adapters. The LANA_ENUM structure is pointed to by the ncb_buffer member of the NCB structure when an application issues the NCBENUM command.
.

  *  Structure returned to the NCB command NCBENUM.

.

        public uint dwCommandId;

.
Summary
The NAME_BUFFER structure contains information about a local network name via the (NetBIOS) API Call. One or more NAME_BUFFER structures follows an ADAPTER_STATUS structure when an application specifies the NCBASTAT command in the ncb_command member of the NCB structure.
32: NCB
.
Summary
.

        byte ncb_command;

.

   Dim ncb_command As Byte

.

   UCHAR   ncb_command;        /* command code           */

.

                   /* state when an ASYNCH command   */

.

        public ushort Command;

.

    /// Wrapper for the ScsiPassThrough command

.

        /// Constructor for the command to send to the robot

.

            public string lpCommand;

.

   Public lpCommand As String

.

        public int CurrentCommands;

.

    public bool CommandQueueing;

.

        public int idCommand;

.

        Public idCommand As Int32

.

        public int idCommand;

.

     public ShowWindowCommands ShowCmd;

.

     Public showCmd As ShowWindowCommand

.

POINT, RECT, ShowWindowCommands

user32

.
Summary
Cancels shutdown of the computer. Same as console command "Shutdown -a"
.

        void IContextMenu.GetCommandString(int idCmd, uint uFlags, int pwReserved, StringBuilder commandString, int cchMax)

.

                commandString = new StringBuilder("...");

.

                commandString = new StringBuilder("...");

.

        void IContextMenu.InvokeCommand (IntPtr pici)

.

                Type typINVOKECOMMANDINFO = Type.GetType("ShellExt.INVOKECOMMANDINFO");

.

                INVOKECOMMANDINFO ici = (INVOKECOMMANDINFO)Marshal.PtrToStructure(pici, typINVOKECOMMANDINFO);

.

            Win32.ShowWindow(hwnd, ShowWindowCommands.Normal );

.
Summary
DeferWindowPosCommands - Enumeration for DeferWindowPos() API call for parameter uFlags
.

enum DeferWindowPosCommands :uint {

.

Public Enum DeferWindowPosCommands As UInteger

.

Public Enum DeferWindowPosCommands

.
Documentation
[DeferWindowPosCommands] on MSDN
.

        internal const UInt32 MF_BYCOMMAND    =0x00000000;

.

    internal const UInt32 MF_BYCOMMAND    =0x00000000;

.

     Main(System.Environment.GetCommandLineArgs())

.

Compile at bash command line with: gcc -Wall idle.c

.

internal const UInt32 MF_BYCOMMAND =0x00000000;

.

MF_BYCOMMAND

.

Indicates that uIDItem gives the identifier of the menu item. If neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified, the MF_BYCOMMAND flag is the default flag.

.

Sendmessage(hwndMain, WM_COMMAND, intMID,  0) 'Click the MenuItem!

.

internal const UInt32 MF_BYCOMMAND =0x00000000;

.

MF_BYCOMMAND

.

Indicates that uIDItem gives the identifier of the menu item. If neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified, the MF_BYCOMMAND flag is the default flag.

.

    /// <param name="uiCommand">Command to issue when retrieving data.</param>

.

    public static extern int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, out RAWINPUT pData, ref int pcbSize, int cbSizeHeader);

.

    /// <param name="uiCommand">Command to issue when retrieving data.</param>

.

    public static extern int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, byte[] pData, ref int pcbSize, int cbSizeHeader);

.

            outSize = Win32API.GetRawInputData(m.LParam, RawInputCommand.Input, out input, ref size, Marshal.SizeOf(typeof(RAWINPUTHEADER)));

.

    public static extern uint GetRawInputDeviceInfo(int deviceHandle, uint command, ref DeviceInfo data, ref uint dataSize);

.

static extern uint GetRawInputDeviceInfo(IntPtr hDevice, uint uiCommand, IntPtr pData, ref uint pcbSize);

.

Declare Function GetRawInputDeviceInfo Lib "user32.dll" Alias "GetRawInputDeviceInfoW" (ByVal hDevice As IntPtr, ByVal uiCommand As DeviceInfoTypes, ByVal pData As IntPtr, ByRef pcbSize As UInteger) As Integer

.

Sendmessage(hwndMain, WM_COMMAND, intMID,  0) 'Click the MenuItem!

.

DialogBoxCommandID

.

This code assumes a form called frmMain with a command button called cmdClick a picture box called picClicker and a text box called txtResults

.

Note Twips are no more. Also, I stripped the FOR loop of delta moves from the command button click to the middle of the picture box.

.

private const int WM_SYSCOMMAND = 0x112;

.

   SendMessage(ctrl.Handle, WM_SYSCOMMAND, MOUSE_MOVE, ref nul);

.

    const int WM_SYSCOMMAND = 274;

.

    SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0);

.

Public Shared Function ShowWindowAsync(hWnd As IntPtr, <MarshalAs(UnmanagedType.I4)>nCmdShow As ShowWindowCommands) As <MarshalAs(UnmanagedType.Bool)> Boolean

.

ShowWindowCommands

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


 
Access PInvoke.net directly from VS: