netripper

netripper

Dec 26th, 2009
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.27 KB | None | 0 0
  1. Index: CallerUtility/CallerUtility.csproj
  2. ===================================================================
  3. --- CallerUtility/CallerUtility.csproj (revision 12)
  4. +++ CallerUtility/CallerUtility.csproj (working copy)
  5. @@ -2,7 +2,7 @@
  6. <PropertyGroup>
  7. <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  8. <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  9. - <ProductVersion>9.0.21022</ProductVersion>
  10. + <ProductVersion>9.0.30729</ProductVersion>
  11. <SchemaVersion>2.0</SchemaVersion>
  12. <ProjectGuid>{D3300BBE-EF0E-4912-919E-6EC8E64693C0}</ProjectGuid>
  13. <OutputType>WinExe</OutputType>
  14. @@ -65,6 +65,7 @@
  15. <DependentUpon>Form1.cs</DependentUpon>
  16. </Compile>
  17. <Compile Include="LoaderAndParser.cs" />
  18. + <Compile Include="NativeMethods.cs" />
  19. <Compile Include="Program.cs" />
  20. <Compile Include="Properties\AssemblyInfo.cs" />
  21. <EmbeddedResource Include="Form1.resx">
  22. Index: CallerUtility/Form1.cs
  23. ===================================================================
  24. --- CallerUtility/Form1.cs (revision 12)
  25. +++ CallerUtility/Form1.cs (working copy)
  26. @@ -20,6 +20,8 @@
  27. private MessageInterceptor msgInterceptor = null;
  28. private Contact contact;
  29. private String numberToLookup;
  30. + private System.Windows.Forms.Timer showWindowTimer;
  31. +
  32. public CallerUtility()
  33. {
  34. InitializeComponent();
  35. @@ -32,6 +34,10 @@
  36. outgoingCall = new SystemState(SystemProperty.PhoneTalkingCallerNumber);
  37. outgoingCall.Changed += new ChangeEventHandler(outgoingCall_Changed);
  38. this.KeyUp += new KeyEventHandler(CallerUtility_KeyUp);
  39. + showWindowTimer = new System.Windows.Forms.Timer();
  40. + showWindowTimer.Enabled = false;
  41. + showWindowTimer.Interval = 250;
  42. + showWindowTimer.Tick += new EventHandler(showWindowTimer_Tick);
  43. //CheckNumber("90941222");
  44. }
  45.  
  46. @@ -192,6 +198,7 @@
  47.  
  48. private void Dismiss()
  49. {
  50. + showWindowTimer.Enabled = false;
  51. this.TopMost = false;
  52. this.Visible = false;
  53. this.btnLookup.Enabled = false;
  54. @@ -204,8 +211,14 @@
  55. {
  56. this.TopMost = true;
  57. this.Visible = true;
  58. + showWindowTimer.Enabled = true;
  59. }
  60.  
  61. + void showWindowTimer_Tick(object sender, EventArgs e)
  62. + {
  63. + NativeMethods.ShowWindow(this.Handle, NativeMethods.WindowShowStyle.Show);
  64. + }
  65. +
  66. private void CallerUtility_KeyDown(object sender, KeyEventArgs e)
  67. {
  68. if ((e.KeyCode == System.Windows.Forms.Keys.Up))
  69. Index: CallerUtility/NativeMethods.cs
  70. ===================================================================
  71. --- CallerUtility/NativeMethods.cs (revision 0)
  72. +++ CallerUtility/NativeMethods.cs (revision 0)
  73. @@ -0,0 +1,118 @@
  74. +using System;
  75. +using System.Linq;
  76. +using System.Collections.Generic;
  77. +using System.Text;
  78. +using System.Runtime.InteropServices;
  79. +
  80. +namespace CallerUtility
  81. +{
  82. + public class NativeMethods
  83. + {
  84. + #region ShowWindow
  85. +
  86. + // From: http://www.pinvoke.net/default.aspx/user32.ShowWindow
  87. +
  88. + /// <summary>Shows a Window</summary>
  89. + /// <remarks>
  90. + /// <para>To perform certain special effects when showing or hiding a
  91. + /// window, use AnimateWindow.</para>
  92. + ///<para>The first time an application calls ShowWindow, it should use
  93. + ///the WinMain function's nCmdShow parameter as its nCmdShow parameter.
  94. + ///Subsequent calls to ShowWindow must use one of the values in the
  95. + ///given list, instead of the one specified by the WinMain function's
  96. + ///nCmdShow parameter.</para>
  97. + ///<para>As noted in the discussion of the nCmdShow parameter, the
  98. + ///nCmdShow value is ignored in the first call to ShowWindow if the
  99. + ///program that launched the application specifies startup information
  100. + ///in the structure. In this case, ShowWindow uses the information
  101. + ///specified in the STARTUPINFO structure to show the window. On
  102. + ///subsequent calls, the application must call ShowWindow with nCmdShow
  103. + ///set to SW_SHOWDEFAULT to use the startup information provided by the
  104. + ///program that launched the application. This behavior is designed for
  105. + ///the following situations: </para>
  106. + ///<list type="">
  107. + /// <item>Applications create their main window by calling CreateWindow
  108. + /// with the WS_VISIBLE flag set. </item>
  109. + /// <item>Applications create their main window by calling CreateWindow
  110. + /// with the WS_VISIBLE flag cleared, and later call ShowWindow with the
  111. + /// SW_SHOW flag set to make it visible.</item>
  112. + ///</list></remarks>
  113. + /// <param name="hWnd">Handle to the window.</param>
  114. + /// <param name="nCmdShow">Specifies how the window is to be shown.
  115. + /// This parameter is ignored the first time an application calls
  116. + /// ShowWindow, if the program that launched the application provides a
  117. + /// STARTUPINFO structure. Otherwise, the first time ShowWindow is called,
  118. + /// the value should be the value obtained by the WinMain function in its
  119. + /// nCmdShow parameter. In subsequent calls, this parameter can be one of
  120. + /// the WindowShowStyle members.</param>
  121. + /// <returns>
  122. + /// If the window was previously visible, the return value is nonzero.
  123. + /// If the window was previously hidden, the return value is zero.
  124. + /// </returns>
  125. + [DllImport("coredll.dll")]
  126. + public static extern bool ShowWindow(IntPtr hWnd, WindowShowStyle nCmdShow);
  127. +
  128. + /// <summary>Enumeration of the different ways of showing a window using
  129. + /// ShowWindow</summary>
  130. + public enum WindowShowStyle : uint
  131. + {
  132. + /// <summary>Hides the window and activates another window.</summary>
  133. + /// <remarks>See SW_HIDE</remarks>
  134. + Hide = 0,
  135. + /// <summary>Activates and displays a window. If the window is minimized
  136. + /// or maximized, the system restores it to its original size and
  137. + /// position. An application should specify this flag when displaying
  138. + /// the window for the first time.</summary>
  139. + /// <remarks>See SW_SHOWNORMAL</remarks>
  140. + ShowNormal = 1,
  141. + /// <summary>Activates the window and displays it as a minimized window.</summary>
  142. + /// <remarks>See SW_SHOWMINIMIZED</remarks>
  143. + ShowMinimized = 2,
  144. + /// <summary>Activates the window and displays it as a maximized window.</summary>
  145. + /// <remarks>See SW_SHOWMAXIMIZED</remarks>
  146. + ShowMaximized = 3,
  147. + /// <summary>Maximizes the specified window.</summary>
  148. + /// <remarks>See SW_MAXIMIZE</remarks>
  149. + Maximize = 3,
  150. + /// <summary>Displays a window in its most recent size and position.
  151. + /// This value is similar to "ShowNormal", except the window is not
  152. + /// actived.</summary>
  153. + /// <remarks>See SW_SHOWNOACTIVATE</remarks>
  154. + ShowNormalNoActivate = 4,
  155. + /// <summary>Activates the window and displays it in its current size
  156. + /// and position.</summary>
  157. + /// <remarks>See SW_SHOW</remarks>
  158. + Show = 5,
  159. + /// <summary>Minimizes the specified window and activates the next
  160. + /// top-level window in the Z order.</summary>
  161. + /// <remarks>See SW_MINIMIZE</remarks>
  162. + Minimize = 6,
  163. + /// <summary>Displays the window as a minimized window. This value is
  164. + /// similar to "ShowMinimized", except the window is not activated.</summary>
  165. + /// <remarks>See SW_SHOWMINNOACTIVE</remarks>
  166. + ShowMinNoActivate = 7,
  167. + /// <summary>Displays the window in its current size and position. This
  168. + /// value is similar to "Show", except the window is not activated.</summary>
  169. + /// <remarks>See SW_SHOWNA</remarks>
  170. + ShowNoActivate = 8,
  171. + /// <summary>Activates and displays the window. If the window is
  172. + /// minimized or maximized, the system restores it to its original size
  173. + /// and position. An application should specify this flag when restoring
  174. + /// a minimized window.</summary>
  175. + /// <remarks>See SW_RESTORE</remarks>
  176. + Restore = 9,
  177. + /// <summary>Sets the show state based on the SW_ value specified in the
  178. + /// STARTUPINFO structure passed to the CreateProcess function by the
  179. + /// program that started the application.</summary>
  180. + /// <remarks>See SW_SHOWDEFAULT</remarks>
  181. + ShowDefault = 10,
  182. + /// <summary>Windows 2000/XP: Minimizes a window, even if the thread
  183. + /// that owns the window is hung. This flag should only be used when
  184. + /// minimizing windows from a different thread.</summary>
  185. + /// <remarks>See SW_FORCEMINIMIZE</remarks>
  186. + ForceMinimized = 11
  187. + }
  188. +
  189. + #endregion
  190. + }
  191. +}
  192.  
Add Comment
Please, Sign In to add comment