Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何不显示控制台? #3

Open
1536243623 opened this issue Feb 19, 2024 · 2 comments
Open

如何不显示控制台? #3

1536243623 opened this issue Feb 19, 2024 · 2 comments

Comments

@1536243623
Copy link

pub fn creative_ocr_region_net() -> Result<paddleocr::Ppocr, String> {
let current_dir = match env::current_dir() {
Ok(s) => s,
Err(_e) => return Err("ocr_detect_can't find".to_string()),
};
let path = current_dir.join("paddle_ocr").join("PaddleOCR-json.exe");
let p: paddleocr::Ppocr = match paddleocr::Ppocr::new(path, Default::default()) {
Ok(p) => p,
Err(e) => return Err(format!("creative_ocr_region_net error: {}", e)),
};
Ok(p)
}
release环境下会弹出控制台,能否添加不弹出控制台的API?

@xianoem
Copy link

xianoem commented Feb 24, 2024

如果您仍然需要这个,您可以直接将源代码作为模块在您的应用程序中使用。然后在您的模块中添加以下内容:

use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW_FLAG: u32 = 0x08000000;

然后在new fn内部生成进程时,添加以下行:

.creation_flags(CREATE_NO_WINDOW_FLAG)

@1536243623
Copy link
Author

感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants