Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
AnswerRe: manifest files Pin
jschell22-Jul-12 7:00
jschell22-Jul-12 7:00 
GeneralDeclare variable as Interface vs. Class Pin
trinh.nguyen21-Jul-12 0:55
trinh.nguyen21-Jul-12 0:55 
AnswerRe: Declare variable as Interface vs. Class Pin
DaveyM6921-Jul-12 1:31
professionalDaveyM6921-Jul-12 1:31 
AnswerRe: Declare variable as Interface vs. Class Pin
Abhinav S21-Jul-12 5:28
Abhinav S21-Jul-12 5:28 
Questionblock data copy from pen drive to PC using c# Pin
haldin20-Jul-12 20:13
haldin20-Jul-12 20:13 
AnswerRe: block data copy from pen drive to PC using c# Pin
Abhinav S20-Jul-12 20:39
Abhinav S20-Jul-12 20:39 
AnswerRe: block data copy from pen drive to PC using c# Pin
Eddy Vluggen21-Jul-12 8:04
professionalEddy Vluggen21-Jul-12 8:04 
QuestionInvalid argument (Converted from VB.Net) Pin
Midnight Ahri20-Jul-12 17:12
Midnight Ahri20-Jul-12 17:12 
i'm new in C#, i converted some code from my previous project and i have an error here.
i've put arrows between the code, i believe AppBarSettings type is APPBARDATA, but why it's still error? Confused | :confused:


TBAppBar class below,
C#
public class TBAppBar
        {
            [DllImport("shell32", EntryPoint = "SHAppBarMessage", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            private static extern int GetAppBarMessage(int dwMessage, ref APPBARDATA pData);
            [DllImport("shell32", EntryPoint = "SHAppBarMessage", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
            private static extern int SetAppBarMessage(int dwMessage, ref APPBARDATA pData);

            //Get Message Sent By App Bar

            //Send Message To App BAr

            private struct APPBARDATA
            {
                //AppBar Structure
                public int cbSize;
                public int hwnd;
                public int uCallbackMessage;
                public int uEdge;
                public Rectangle rc;
                public int lParam;
            }

            //Get Current State
            private const Int32 ABM_GETSTATE = 0x4;
            //Get TaskBar Position
            private const Int32 ABM_GETTASKBARPOS = 0x5;
            //Apply Setting(s)
            private const Int32 ABM_SETSTATE = 0xa;
            //Autohide
            private const Int32 ABS_AUTOHIDE = 0x1;
            //Always on Top
            private const Int32 ABS_ALWAYSONTOP = 0x2;

            private bool TBAppBAutoHide;

            private bool TBAppBarAlwaysOnTop;
            public TBAppBar()
            {
                this.GetState();
                //Get Current State
            }


            private void GetState()
            {
                APPBARDATA AppBarSetting = new APPBARDATA();
                //What Setting?

                AppBarSetting.cbSize = Marshal.SizeOf(AppBarSetting);
                //Initialise

          --->  Int32 AppBarState = GetAppBarMessage(ABM_GETSTATE, AppBarSetting); <---
                //Get Current State

                switch (AppBarState)
                {
                    case 0:
                        //Nothing Set
                        TBAppBAutoHide = false;
                        TBAppBarAlwaysOnTop = false;

                        break;
                    case ABS_ALWAYSONTOP:
                        //Always On Top
                        TBAppBAutoHide = false;
                        TBAppBarAlwaysOnTop = true;

                        break;
                    default:
                        TBAppBAutoHide = true;
                        //AutoHide
                        break;
                }
            }

            //Apply Settings
            private void SetState()
            {

                APPBARDATA AppBarSetting = new APPBARDATA();
                //Setting We Want To Apply
                AppBarSetting.cbSize = Marshal.SizeOf(AppBarSetting);
                //Initialise

                if (this.AutoHide)
                {
                    AppBarSetting.lParam = ABS_AUTOHIDE;
                    //AutoHide
                }

                if (this.AlwaysOnTop)
                {
                    AppBarSetting.lParam = AppBarSetting.lParam | ABS_ALWAYSONTOP;
                    //Always On Top
                }
                SetAppBarMessage(ABM_SETSTATE, AppBarSetting);
            }

            public bool AutoHide
            {
                //Autohide
                get { return TBAppBAutoHide; }
                set
                {
                    TBAppBAutoHide = value;
                    this.SetState();
                }
            }

            public bool AlwaysOnTop
            {
                //Always On Top
                get { return TBAppBarAlwaysOnTop; }
                set
                {
                    TBAppBarAlwaysOnTop = value;
                    this.SetState();
                }
            }
        }

GeneralRe: Invalid argument (Converted from VB.Net) Pin
Wes Aday20-Jul-12 17:51
professionalWes Aday20-Jul-12 17:51 
AnswerRe: Invalid argument (Converted from VB.Net) Pin
Midnight Ahri20-Jul-12 19:00
Midnight Ahri20-Jul-12 19:00 
GeneralRe: Invalid argument (Converted from VB.Net) Pin
Dave Kreskowiak21-Jul-12 3:13
mveDave Kreskowiak21-Jul-12 3:13 
QuestionSelecting thread from multiples Pin
MAW3020-Jul-12 15:54
MAW3020-Jul-12 15:54 
AnswerRe: Selecting thread from multiples Pin
Richard MacCutchan20-Jul-12 22:35
mveRichard MacCutchan20-Jul-12 22:35 
QuestionRe: Backgroundworker Thread Issue Pin
munishk20-Jul-12 6:50
munishk20-Jul-12 6:50 
AnswerRe: Backgroundworker Thread Issue Pin
Ian Shlasko20-Jul-12 7:39
Ian Shlasko20-Jul-12 7:39 
AnswerMessage Closed PinPopular
20-Jul-12 7:56
WebMaster20-Jul-12 7:56 
GeneralRe: Backgroundworker Thread Issue Pin
munishk21-Jul-12 3:50
munishk21-Jul-12 3:50 
AnswerRe: Backgroundworker Thread Issue Pin
DaveyM6920-Jul-12 7:56
professionalDaveyM6920-Jul-12 7:56 
AnswerRe: Backgroundworker Thread Issue Pin
Sunil P V20-Jul-12 20:33
Sunil P V20-Jul-12 20:33 
GeneralRe: Backgroundworker Thread Issue Pin
munishk21-Jul-12 3:50
munishk21-Jul-12 3:50 
GeneralRe: Backgroundworker Thread Issue Pin
Sunil P V21-Jul-12 18:51
Sunil P V21-Jul-12 18:51 
QuestionProblem with Math.Tan Function Pin
computerpublic20-Jul-12 6:12
computerpublic20-Jul-12 6:12 
AnswerRe: Problem with Math.Tan Function Pin
BobJanova20-Jul-12 6:20
BobJanova20-Jul-12 6:20 
GeneralRe: Problem with Math.Tan Function Pin
computerpublic20-Jul-12 6:22
computerpublic20-Jul-12 6:22 
GeneralRe: Problem with Math.Tan Function Pin
computerpublic20-Jul-12 6:30
computerpublic20-Jul-12 6:30 

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

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