cmdSend.cpp 558 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "Win32.h"
  2. #include "ID.h"
  3. #include "Function.h"
  4. #include "SharedValue.h"
  5. //Send
  6. bool SendCommand(LPCSTR command)
  7. {
  8. DWORD size = strlen(command);
  9. if (WriteFile(UIw_key, command, size, NULL, NULL) != 0)
  10. {
  11. FlushFileBuffers(UIw_key);
  12. return true;
  13. }
  14. else
  15. {
  16. Err(_T("发送命令失败\n可能是因为服务器已被关闭"));
  17. return false;
  18. }
  19. }
  20. bool SendCommand_WhenStop(LPCSTR command)
  21. {
  22. DWORD size = strlen(command);
  23. if (WriteFile(UIw_key, command, size, NULL, NULL) != 0)
  24. {
  25. FlushFileBuffers(UIw_key);
  26. return true;
  27. }
  28. else
  29. {
  30. return false;
  31. }
  32. }