Ich arbeite an Win32-Anwendung. Alle Zeichnungen werden in WM_PAINT erstellt. Es funktioniert gut. Ich habe eine weitere Funktionalität hinzugefügt. Wenn ich auf die Schaltfläche klicke, wird die Eingabeaufforderung ausgeführt. Dies kann ich mit WinExec tun. Jetzt, wenn ich Cmd.exe als im Hintergrund verschiebe, wird Zeichnung nicht getan. Ich aktualisiere den Code mit CreateProcess als auch das gleiche passiert ist. Kann mir bitte jemand helfen, was mit diesem Code nicht stimmt. Ist es, weil, wenn ich auf dieses Fenster konzentriere, der Fokus losgelassen wird und das Zeichnen nicht gemacht wird.Zeichnung Problem in Win32-Anwendung
-Code
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
TCHAR wchCmdPath[MAX_PATH];
memset(wchCmdPath,_T('\0'),MAX_PATH);
GetSystemDirectory(wchCmdPath,MAX_PATH);
wcscat(wchCmdPath,_T("\\cmd.exe"));
// Start the child process.
if(!CreateProcess(NULL, // No module name (use command line)
wchCmdPath, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi) // Pointer to PROCESS_INFORMATION structure
)
{
printf("CreateProcess failed (%d).\n", GetLastError());
return;
}
// Close process and thread handles.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
InvalidateRect(hwnd,NULL,TRUE);
UpdateWindow(hwnd);
Vielen Dank im Voraus
Es wäre viel einfacher, das Problem zu erkennen, wenn Sie die relevanten Teile Ihres Codes veröffentlicht haben. –