Closed hacker-h closed 3 years ago
Hi @hacker-h ,
I can understand the need but mirror is just a sample of the library and this feature so not help in learning the dokan api.
But since mirror code can be used and changed for whatever need: On windows there is different ways to start a process without window. Some are listed here https://stackoverflow.com/questions/2139637/hide-console-of-windows-application Hope this answer your question.
Following the SO link you provided, tweaking the Linker SubSystem from Console to Windows is apparently not enough:
Error LNK2019 unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) dokan_mirror C:\Users\Hacker\source\repos\dokany\samples\dokan_mirror\LIBCMTD.lib(exe_winmain.obj) 1
Also my VS2019 cannot detect any entrypoint for dokan_mirror. Are there additional adaptations necessary or is my setup incorrect?
@hacker-h You need to change the current main function prototype to WinMain as explain in the link.
Thanks for the pointers! With those and two more articles I was able to understand and solve the issue: https://stackoverflow.com/a/13872211 https://codingmisadventures.wordpress.com/2009/03/10/retrieving-command-line-parameters-from-winmain-in-win32/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPSTR lpCmdLine,
int nShowCmd) {
LPWSTR *argv;
int argc;
argv = CommandLineToArgvW(GetCommandLine(), &argc);
return wmain(argc, argv);
}
Is it possible to run mirror.exe in background, respectively omit the opening of an additional terminal window, e.g. by keeping the output in the terminal that actually launches the executable? If it is not yet possible, where can it be adapted in code?
I think this feature would be highly convenient, so you do not have a terminal window open all the time.