alloc_console does work, but it create another cmd window, seems not
better than dialog
This commit is contained in:
		
							parent
							
								
									4ed9aa39c7
								
							
						
					
					
						commit
						76a6b4e09e
					
				| @ -628,4 +628,8 @@ extern "C" | |||||||
|         return bSystem; |         return bSystem; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     void alloc_console_and_redirect() { | ||||||
|  |         AllocConsole(); | ||||||
|  |         freopen("CONOUT$", "w", stdout); | ||||||
|  |     } | ||||||
| } // end of extern "C"
 | } // end of extern "C"
 | ||||||
| @ -455,6 +455,7 @@ extern "C" { | |||||||
|     fn win_stop_system_key_propagate(v: BOOL); |     fn win_stop_system_key_propagate(v: BOOL); | ||||||
|     fn is_win_down() -> BOOL; |     fn is_win_down() -> BOOL; | ||||||
|     fn is_local_system() -> BOOL; |     fn is_local_system() -> BOOL; | ||||||
|  |     fn alloc_console_and_redirect(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| extern "system" { | extern "system" { | ||||||
| @ -2383,3 +2384,9 @@ pub fn message_box(text: &str) { | |||||||
|         .collect::<Vec<u16>>(); |         .collect::<Vec<u16>>(); | ||||||
|     unsafe { MessageBoxW(std::ptr::null_mut(), text.as_ptr(), caption.as_ptr(), MB_OK) }; |     unsafe { MessageBoxW(std::ptr::null_mut(), text.as_ptr(), caption.as_ptr(), MB_OK) }; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | pub fn alloc_console() { | ||||||
|  |     unsafe { | ||||||
|  |         alloc_console_and_redirect(); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user