I'm trying to open a new folder in the same window that is already opened. This is the code:
if (DirectoryExists(myfolder)) {
HWND currenthwnd,hwnd;
hwnd=NULL;
currenthwnd=GetForegroundWindow();
if (currenthwnd!=hwnd)
{
hwnd=currenthwnd;
if (hwnd!=NULL)
{
ShellExecute(hwnd, "open", myfolder, NULL, NULL, SW_SHOW);
}
}
}
但它每次都会打开一个新窗口。我怎样才能做到这一点?