@@ -23,7 +23,8 @@ public partial class MainForm : Form, IMessageFilter
2323 private readonly int _messageId ;
2424 private bool _isButtonTargetMouseDown ;
2525 private string _64BitFilePath ;
26- private string _fileName ;
26+ private string _textFileName ;
27+ private string _imageFileName ;
2728
2829 public MainForm ( )
2930 {
@@ -32,7 +33,8 @@ public MainForm()
3233 _processId = Process . GetCurrentProcess ( ) . Id ;
3334 _messageId = NativeMethods . RegisterWindowMessage ( "WINDOW_TEXT_EXTRACTOR_HOOK" ) ;
3435 _64BitFilePath = "" ;
35- _fileName = "" ;
36+ _textFileName = "" ;
37+ _imageFileName = "" ;
3638 }
3739
3840 protected override void OnLoad ( EventArgs e )
@@ -132,16 +134,16 @@ private void menuItemSaveTextAs_Click(object sender, EventArgs e)
132134 OverwritePrompt = true ,
133135 ValidateNames = true ,
134136 Title = "Save As" ,
135- FileName = File . Exists ( _fileName ) ? Path . GetFileName ( _fileName ) : "*.txt" ,
137+ FileName = File . Exists ( _textFileName ) ? Path . GetFileName ( _textFileName ) : "*.txt" ,
136138 DefaultExt = "txt" ,
137139 RestoreDirectory = false ,
138140 Filter = "Text Documents (*.txt)|*.txt|All Files (*.*)|*.*"
139141 } ;
140142
141143 if ( dialog . ShowDialog ( ) != System . Windows . Forms . DialogResult . Cancel )
142144 {
143- _fileName = dialog . FileName ;
144- File . WriteAllText ( _fileName , txtContent . Text , Encoding . UTF8 ) ;
145+ _textFileName = dialog . FileName ;
146+ File . WriteAllText ( dialog . FileName , txtContent . Text , Encoding . UTF8 ) ;
145147 }
146148 }
147149
@@ -152,15 +154,15 @@ private void menuItemSaveImageAs_Click(object sender, EventArgs e)
152154 OverwritePrompt = true ,
153155 ValidateNames = true ,
154156 Title = "Save As" ,
155- FileName = File . Exists ( _fileName ) ? Path . GetFileName ( _fileName ) : "*.bmp" ,
157+ FileName = File . Exists ( _imageFileName ) ? Path . GetFileName ( _imageFileName ) : "*.bmp" ,
156158 DefaultExt = "bmp" ,
157159 RestoreDirectory = false ,
158160 Filter = "Bitmap Image (*.bmp)|*.bmp|Gif Image (*.gif)|*.gif|JPEG Image (*.jpeg)|*.jpeg|Png Image (*.png)|*.png|Tiff Image (*.tiff)|*.tiff|Wmf Image (*.wmf)|*.wmf"
159161 } ;
160162
161163 if ( dialog . ShowDialog ( ) != System . Windows . Forms . DialogResult . Cancel )
162164 {
163- _fileName = dialog . FileName ;
165+ _imageFileName = dialog . FileName ;
164166 var fileExtension = Path . GetExtension ( dialog . FileName ) . ToLower ( ) ;
165167 var imageFormat = fileExtension == ".bmp" ? ImageFormat . Bmp :
166168 fileExtension == ".gif" ? ImageFormat . Gif :
@@ -242,7 +244,7 @@ public bool PreFilterMessage(ref Message m)
242244 {
243245 if ( _isButtonTargetMouseDown )
244246 {
245- NativeMethods . SetCursor ( Properties . Resources . Target . Handle ) ;
247+ NativeMethods . SetCursor ( Properties . Resources . Target32 . Handle ) ;
246248 var cursorPosition = System . Windows . Forms . Cursor . Position ;
247249 var element = AutomationElement . FromPoint ( new System . Windows . Point ( cursorPosition . X , cursorPosition . Y ) ) ;
248250 if ( element != null && element . Current . ProcessId != _processId )
0 commit comments