窗口问题

raywu 2003-10-07 06:37:32
请问如何可以检测到是否存在某窗口??
...全文
18 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
tansm 2003-10-13
  • 打赏
  • 举报
回复
刚才的程序有点点问题,应该在:
_Form1=new Form1;
这句话后加入拦截这个实例的卸载事件,在卸载事件中执行:
_Form1 = null;
tansm 2003-10-13
  • 打赏
  • 举报
回复
我想我应该理解你的意思是:
class Windows
static Form1 _Form1;
static Form2 _Form2;

public static Form1 form1{
get{
if(_Form1==null)
_Form1=new Form1;
return _Form1;
}
}


//.................

end class

//...........
Windows.form1.Show()
raywu 2003-10-13
  • 打赏
  • 举报
回复
Up
raywu 2003-10-12
  • 打赏
  • 举报
回复
大家可以交流吗..?
我的QQ:172918760
请留下你们的QQ
agu 2003-10-11
  • 打赏
  • 举报
回复
// Activate an application with a window with a specific class name.
BOOL COneT32App::FirstInstance()
{
CWnd *pWndPrev, *pWndChild;

// Determine if a window with the class name exists...
if (pWndPrev = CWnd::FindWindow(_T("MyNewClass"),NULL))
{
// If so, does it have any popups?
pWndChild = pWndPrev->GetLastActivePopup();

// If iconic, restore the main window.
if (pWndPrev->IsIconic())
pWndPrev->ShowWindow(SW_RESTORE);

// Bring the main window or its popup to the foreground
pWndChild->SetForegroundWindow();

// and you are done activating the other application.
return FALSE;
}
}

raywu 2003-10-11
  • 打赏
  • 举报
回复
就是通过一个button打开一窗口,但当该窗口存在的时候就不在新建一个.
Reeezak 2003-10-10
  • 打赏
  • 举报
回复
ActiveForm 属性
或者ActiveMdiChild 属性
cdbnzc 2003-10-10
  • 打赏
  • 举报
回复
目的是什么呢?是不是要否判断一个窗口是否关闭呢?
还是有没有创建成功?
raywu 2003-10-10
  • 打赏
  • 举报
回复
可以举个例子吗?
raywu 2003-10-08
  • 打赏
  • 举报
回复
up
whl9234 2003-10-07
  • 打赏
  • 举报
回复

mdi自窗体吗?
wangjs720 2003-10-07
  • 打赏
  • 举报
回复
用API函数FindWindow(),GetWindow各EnumerWindow()
用法你查MSDN吧
kuangren 2003-10-07
  • 打赏
  • 举报
回复
Form newform=new Form();
if(newform==null)
{
MessageBox.Show("没有newform");
}
else
{
MessageBox.Show("newform存在");
}

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧