環境 WindowsXp、VSC++6.0
現状 使用変数を取り入れるModelessDialogWindowはCKolamDesignerAppプログラムを起動すると 同時に表示され、かつactiveになります。本体(ChildViewで表示している)のWindowはカーソルで一度クリックしてactiveになります。
希望は表示はするが、activeなWindowはDialogではなく、本体のViewにしたい。
どのようなコードがあればよいか助言をおねがいします
dialogWindowの表示設定は以下のとおりです
void CChildView::OnParameterSet()
{
// 2009/10/27 t.yoshino モードレス表示
// 親ウィンドウの位置を得る
CRect rectParent;
GetWindowRect(&rectParent);
// 子ウィンドウの位置を得る
CRect rectChild;
m_wndParam.GetWindowRect(&rectChild);
// 親の右端から子の幅分オフセットさせた位置に配置
long width = rectChild.right - rectChild.left;
rectChild.right = rectParent.right;
rectChild.left = rectChild.right - width;
// 親ウィンドウの中ほどの高さに配置 by ミッヒー
long parentHeight = rectParent.bottom - rectParent.top;
long childHeight = rectChild.bottom - rectChild.top;
rectChild.top = rectParent.top + parentHeight / 4;
rectChild.bottom = rectChild.top + childHeight;
// ここまで
m_wndParam.MoveWindow(&rectChild);
m_wndParam.BringWindowToTop(); // 前に持ってくる
m_wndParam.ShowWindow(SW_SHOW); // 表示
} //endof OnParameterSet(
// CKolamDesignerApp initialization
BOOL CKolamDesignerApp::InitInstance()
{
AfxEnableControlContainer();
略
pFrame->PostMessage(WM_COMMAND, ID_PARAMETER_SET);
return TRUE;
}
> m_wndParam.MoveWindow(&rectChild);
> m_wndParam.BringWindowToTop(); // 前に持ってくる
> m_wndParam.ShowWindow(SW_SHOW); // 表示
ここを
m_wndParam.SetWindowPos(
wndTop,
rectChild.left,
rectChild.top,
rectChild.right - rectChild.left,
rectChild.bottom - rectChild.top,
SWP_NOACTIVATE | SWP_SHOWWINDOW);
に変えてみたらどうですか?
助言ありがとう
残念ながら 以下のエラーになりました
mDesigner4.6.2\ChildView.cpp(551) : error C2664: 'SetWindowPos' : 1 番目の引数を 'const class CWnd' から 'const class CWnd *' に変換できません。 (新しい機能 ; ヘルプを参照)
この変換を実行可能なユーザー定義変換演算子がないか、または演算子を呼び出せません。
この対処法は初歩のことかもしれませんが 教えてください
m_wndParam.SetWindowPos(
&wndTop,
rectChild.left,
rectChild.top,
rectChild.right - rectChild.left,
rectChild.bottom - rectChild.top,
SWP_NOACTIVATE | SWP_SHOWWINDOW);
でいいんじゃない?
ありがとうございました
期待どうりになりました。
一度は &wndTopポインター変数にしてみたのですが、同じ様なエラーが出たのです、
なにか他も変えたためにエラーになったのでしょう。
今回は注意深く そこだけ変えて 正しく動作しました
ツイート | ![]() |