helpers.odin 680 B

1234567891011121314151617181920212223242526272829
  1. // +build windows
  2. package win32
  3. import "core:strings";
  4. call_external_process :: proc(program, command_line: string) -> bool {
  5. si := Startup_Info{ cb=size_of(Startup_Info) };
  6. pi := Process_Information{};
  7. return cast(bool)create_process_w(
  8. utf8_to_wstring(program),
  9. utf8_to_wstring(command_line),
  10. nil,
  11. nil,
  12. Bool(false),
  13. u32(0x10),
  14. nil,
  15. nil,
  16. &si,
  17. &pi
  18. );
  19. }
  20. open_website :: proc(url: string) -> bool {
  21. p :: "C:\\Windows\\System32\\cmd.exe";
  22. arg := []string{"/C", "start", url};
  23. args := strings.join(arg, " ", context.temp_allocator);
  24. return call_external_process(p, args);
  25. }