winapi - Is it possible to embed one application in another application in Windows? -
i'm writing windows application in visual c++ 2008 , want embed calculator (calc.exe) comes windows in it. know if possible, , if is, can give me hints on how achieve that?
yes, it's possible embed calc in own application still run in it's own process space. there may restrictions imposed uac depend on how calc launched. need change parent of main calc window , change it's style ws_child.
void embedcalc(hwnd hwnd) { hwnd calchwnd = findwindow(l"calcframe", null); if(calchwnd != null) { // change parent calc window belongs our apps main window setparent(calchwnd, hwnd); // update style calc window embedded in our main window setwindowlong(calchwnd, gwl_style, getwindowlong(calchwnd, gwl_style) | ws_child); // need update position since changing parent not // adjust automatically. setwindowpos(calchwnd, null, 0, 0, 0, 0, swp_nosize | swp_nozorder); } }
Comments
Post a Comment