Click here to Skip to main content
15,921,716 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dragging the panel on the form Pin
Sokka9323-Nov-08 6:52
Sokka9323-Nov-08 6:52 
GeneralRe: Dragging the panel on the form Pin
Paul Conrad23-Nov-08 7:14
professionalPaul Conrad23-Nov-08 7:14 
GeneralRe: Dragging the panel on the form Pin
Sokka9323-Nov-08 7:49
Sokka9323-Nov-08 7:49 
JokeRe: Dragging the panel on the form Pin
Paul Conrad23-Nov-08 8:00
professionalPaul Conrad23-Nov-08 8:00 
GeneralRe: Dragging the panel on the form Pin
netJP12L23-Nov-08 10:04
netJP12L23-Nov-08 10:04 
QuestionC# - COM Port Communications Pin
See_Sharp23-Nov-08 4:36
See_Sharp23-Nov-08 4:36 
GeneralRe: C# - COM Port Communications Pin
Luc Pattyn23-Nov-08 5:34
sitebuilderLuc Pattyn23-Nov-08 5:34 
QuestionAnimateWindow API Pin
#realJSOP23-Nov-08 2:34
professional#realJSOP23-Nov-08 2:34 
I've tried unsuccessfully to get the AnimateWindow API to work. As far as I know, my flags are correct, but no matter what I do, the form just pops up on the screen. Can anyone see anything wrong with this code?

using System;
using System.Runtime.InteropServices;

namespace WinAPI
{
	public class AnimateWindowAPI
	{
		public const int AW_HIDE		= 0x10000;
		public const int AW_ACTIVATE		= 0x20000;
		public const int AW_SLIDE		= 0x40000;
		public const int AW_BLEND		= 0x80000;
		public const int AW_HOR_POSITIVE	= 0x00000001;
		public const int AW_HOR_NEGATIVE	= 0x00000002;
		public const int AW_VER_POSITIVE	= 0x00000004;
		public const int AW_VER_NEGATIVE	= 0x00000008;
		public const int AW_CENTER		= 0x00000010;

		[DllImport("user32.dll", CharSet = CharSet.Auto)]
		public static extern int AnimateWindow(IntPtr hWnd, int dwTime, int dwFlags);
	}
}



I'm calling the function from within the Shown() event handler, like so:

using WinAPI;
private void Form1_Shown(object sender, EventArgs e)
{
	int flags = AnimateWindowAPI.AW_ACTIVATE|AnimateWindowAPI.AW_BLEND;
	AnimateWindowAPI.AnimateWindow(this.Handle, 3000, flags);
	Show();
}



I also wrote some threaded fader code (that doesn't use the AnimateWindow function) to see if I was calling it from the wrong place, and that code works fine.


"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


AnswerRe: AnimateWindow API Pin
DaveyM6923-Nov-08 2:57
professionalDaveyM6923-Nov-08 2:57 
GeneralRe: AnimateWindow API Pin
#realJSOP23-Nov-08 3:31
professional#realJSOP23-Nov-08 3:31 
GeneralRe: AnimateWindow API Pin
DaveyM6923-Nov-08 4:26
professionalDaveyM6923-Nov-08 4:26 
GeneralRe: AnimateWindow API Pin
#realJSOP23-Nov-08 5:16
professional#realJSOP23-Nov-08 5:16 
GeneralRe: AnimateWindow API Pin
DaveyM6923-Nov-08 7:13
professionalDaveyM6923-Nov-08 7:13 
GeneralRe: AnimateWindow API Pin
Judah Gabriel Himango23-Nov-08 8:29
sponsorJudah Gabriel Himango23-Nov-08 8:29 
GeneralRe: AnimateWindow API [modified] Pin
#realJSOP23-Nov-08 8:43
professional#realJSOP23-Nov-08 8:43 
QuestionEdit Domain Password/ Account Policy using C# Pin
steve_w8523-Nov-08 1:24
steve_w8523-Nov-08 1:24 
AnswerRe: Edit Domain Password/ Account Policy using C# Pin
dan!sh 23-Nov-08 1:33
professional dan!sh 23-Nov-08 1:33 
QuestionRe: Edit Domain Password/ Account Policy using C# Pin
steve_w8523-Nov-08 16:29
steve_w8523-Nov-08 16:29 
Questioncxvxcv Pin
vayanan23-Nov-08 1:05
vayanan23-Nov-08 1:05 
AnswerRe: cxvxcv Pin
Mbah Dhaim23-Nov-08 1:32
Mbah Dhaim23-Nov-08 1:32 
QuestionNullReferenceException was unhandled? Pin
dec8222-Nov-08 23:56
dec8222-Nov-08 23:56 
AnswerRe: NullReferenceException was unhandled? Pin
Giorgi Dalakishvili23-Nov-08 0:00
mentorGiorgi Dalakishvili23-Nov-08 0:00 
AnswerRe: NullReferenceException was unhandled? Pin
Thomas Weller23-Nov-08 1:26
Thomas Weller23-Nov-08 1:26 
AnswerRe: NullReferenceException was unhandled? Pin
Mbah Dhaim23-Nov-08 1:37
Mbah Dhaim23-Nov-08 1:37 
AnswerRe: NullReferenceException was unhandled? Pin
DaveyM6923-Nov-08 3:17
professionalDaveyM6923-Nov-08 3:17 

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.