如何激活应用程序? [英] how to activate an application?
本文介绍了如何激活应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Visual Basic中,我使用
Appactivate(AcadApp.caption);
in Visual Basic ,I use
Appactivate(AcadApp.caption);
推荐答案
这可以通过windows api's
在你的班级中添加定义
[DllImportAttribute(" User32.dll")]
private static extern int FindWindow(String ClassName,String
WindowName);
[DllImportAttribute(" User32.dll")]
private static extern int SetForegroundWindow(int hWnd);
//激活应用程序
int hWnd = FindWindow(null,这是我的应用程序标题) ;
if(hWnd> 0)
{
SetForegroundWindow(hWnd);
}
Shak。
" zhou" < ZY **** @ sohu.com>在消息中写道
新闻:eL ************** @ TK2MSFTNGP11.phx.gbl ...
This can be achieved by windows api''s
Add the definitions inside your class
[DllImportAttribute( "User32.dll" )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttribute( "User32.dll" )]
private static extern int SetForegroundWindow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWindow( hWnd );
}
Shak.
"zhou" <zy****@sohu.com> wrote in message
news:eL**************@TK2MSFTNGP11.phx.gbl...
在Visual Basic中,我使用
Appactivate(AcadApp.caption);
in Visual Basic ,I use
Appactivate(AcadApp.caption);
这可以通过windows api实现
在类中添加定义
[DllImportAttribute(" User32.dll")]
private static extern int FindWindow( String ClassName,String
WindowName);
[DllImportAttribute(" User32.dll")]
private static extern int SetForegroundWindow(int hWnd );
//激活一个应用程序
int hWnd = FindWindow(null,这是我的应用程序标题);
if (hWnd> 0)
{
SetForegroundWindow(hWnd);
}
Shak 。
" zhou" < ZY **** @ sohu.com>在消息中写道
新闻:eL ************** @ TK2MSFTNGP11.phx.gbl ...
This can be achieved by windows api''s
Add the definitions inside your class
[DllImportAttribute( "User32.dll" )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttribute( "User32.dll" )]
private static extern int SetForegroundWindow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWindow( hWnd );
}
Shak.
"zhou" <zy****@sohu.com> wrote in message
news:eL**************@TK2MSFTNGP11.phx.gbl...
在Visual Basic中,我使用
Appactivate(AcadApp.caption);
in Visual Basic ,I use
Appactivate(AcadApp.caption);
当在用户桌面上有一个资源管理器时,这种方法不起作用/>
窗口打开,标题与应用程序标题相同。
---------------------- ----------------------
Manish Agarwal< ma *********** @ hotmail.com> ;
http://personal.vsnl.com/mkag
Shakir Hussain < SH ** @ fakedomain.com>在留言中写道
新闻:%2 **************** @ tk2msftngp13.phx.gbl ...
This approach will not work when at user desktop there is an explorer
window open with same title as your application title.
--------------------------------------------
Manish Agarwal <ma***********@hotmail.com>
http://personal.vsnl.com/mkag
"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
这可以通过windows api实现
在你的类中添加定义
[DllImportAttribute(" User32.dll")]
private static extern int FindWindow (String ClassName,String
WindowName);
[DllImportAttribute(" User32.dll")]
private static extern int SetForegroundWindow(int hWnd);
/ /激活应用程序
int hWnd = FindWindow(null,这是我的应用程序标题);
if(hWnd> 0)
{
SetForegroundWindow(hWnd) ;
}
Shak。
" zhou" < ZY **** @ sohu.com>在消息中写道
新闻:eL ************** @ TK2MSFTNGP11.phx.gbl ...
This can be achieved by windows api''s
Add the definitions inside your class
[DllImportAttribute( "User32.dll" )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttribute( "User32.dll" )]
private static extern int SetForegroundWindow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWindow( hWnd );
}
Shak.
"zhou" <zy****@sohu.com> wrote in message
news:eL**************@TK2MSFTNGP11.phx.gbl...
在Visual Basic中,我使用
Appactivate(AcadApp.caption);
in Visual Basic ,I use
Appactivate(AcadApp.caption);
这篇关于如何激活应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文