strange... SetWindowPos
This window is created when is executed an application that i launch in my code with shellexecute...
HINSTANCE hHaptek;
HWND wHaptek;
HWND wHaptekC;
hHaptek= ShellExecute(NULL, "open","haptek.exe","", "c:\\",SW_SHOW);
Sleep(3000);
wHaptek= FindWindow("ThunderRT6Main", "Wrapper Haptek");
if (wHaptek!=NULL)
MessageBox(wHaptek,"Esiste","on",MB_OK);
wHaptekC=SetParent(wHaptek,hWndP); //is child of another window
if (wHaptekC!=NULL)
MessageBox(wHaptek,"EsisteFiglio","on",MB_OK);
Sleep(2000);
ShowWindow(wHaptekC,SW_MAXIMIZE);
The handle exist but...
I try function SetWindowPos, ShowWindow, SetWindowText and no one work.
Excuse me for my bad english......... :).... I'm italian!
Help me!
[835 byte] By [
Nikon82] at [2007-11-18 19:16:41]

# 2 Re: strange... SetWindowPos
ShellExecute(NULL, "open","haptek.exe","", "c:\\",SW_SHOW);
wHaptek= FindWindow("ThunderRT6Main", "Wrapper Haptek");
ShowWindow(wHaptek,SW_MAXIMIZE);
The window isn't SW_MAXIMIZE... Why?
THANKS
# 3 Re: strange... SetWindowPos
Probably because wHaptek isn't a handle to the correct window.
When you do ShellExecute, the haptek.exe process is started in the background. ShellExecute return immediately. So, if you immediately call FindWindow, you won't find the window because it isn't created yet.
Check if wHaptek contains the handle to the correct window.
Marc G at 2007-11-9 13:11:59 >

# 6 Re: strange... SetWindowPos
GREAT GREAT GREAT
THANKS A LOT...
the problem is there
wHaptekC=SetParent(wHaptek,hWndP);
i must use e.g.
SetWindowText(wHaptek) and NOT SetWindowText(wHaptekC)
I don't understand... Why?
YOU ARE GREAT!!!!!!!!!!!!!!!!!!!!!!!! :cool: