473,624 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to activate an application?

in Visual Basic ,I use
Appactivate(Aca dApp.caption);
Nov 16 '05 #1
10 16484
This can be achieved by windows api's

Add the definitions inside your class

[DllImportAttrib ute( "User32.dll " )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttrib ute( "User32.dll " )]
private static extern int SetForegroundWi ndow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWi ndow( hWnd );
}

Shak.
"zhou" <zy****@sohu.co m> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
in Visual Basic ,I use
Appactivate(Aca dApp.caption);

Nov 16 '05 #2
This can be achieved by windows api's

Add the definitions inside your class

[DllImportAttrib ute( "User32.dll " )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttrib ute( "User32.dll " )]
private static extern int SetForegroundWi ndow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWi ndow( hWnd );
}

Shak.
"zhou" <zy****@sohu.co m> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
in Visual Basic ,I use
Appactivate(Aca dApp.caption);

Nov 16 '05 #3
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**@fakedomai n.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
This can be achieved by windows api's

Add the definitions inside your class

[DllImportAttrib ute( "User32.dll " )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttrib ute( "User32.dll " )]
private static extern int SetForegroundWi ndow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWi ndow( hWnd );
}

Shak.
"zhou" <zy****@sohu.co m> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
in Visual Basic ,I use
Appactivate(Aca dApp.caption);



Nov 16 '05 #4
This is 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**@fakedomai n.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
This can be achieved by windows api's

Add the definitions inside your class

[DllImportAttrib ute( "User32.dll " )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttrib ute( "User32.dll " )]
private static extern int SetForegroundWi ndow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWi ndow( hWnd );
}

Shak.
"zhou" <zy****@sohu.co m> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
in Visual Basic ,I use
Appactivate(Aca dApp.caption);


Nov 16 '05 #5
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**@fakedomai n.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
This can be achieved by windows api's

Add the definitions inside your class

[DllImportAttrib ute( "User32.dll " )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttrib ute( "User32.dll " )]
private static extern int SetForegroundWi ndow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWi ndow( hWnd );
}

Shak.
"zhou" <zy****@sohu.co m> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
in Visual Basic ,I use
Appactivate(Aca dApp.caption);



Nov 16 '05 #6
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**@fakedomai n.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
This can be achieved by windows api's

Add the definitions inside your class

[DllImportAttrib ute( "User32.dll " )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttrib ute( "User32.dll " )]
private static extern int SetForegroundWi ndow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWi ndow( hWnd );
}

Shak.
"zhou" <zy****@sohu.co m> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
in Visual Basic ,I use
Appactivate(Aca dApp.caption);



Nov 16 '05 #7
This is 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**@fakedomai n.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
This can be achieved by windows api's

Add the definitions inside your class

[DllImportAttrib ute( "User32.dll " )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttrib ute( "User32.dll " )]
private static extern int SetForegroundWi ndow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWi ndow( hWnd );
}

Shak.
"zhou" <zy****@sohu.co m> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
in Visual Basic ,I use
Appactivate(Aca dApp.caption);


Nov 16 '05 #8
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**@fakedomai n.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
This can be achieved by windows api's

Add the definitions inside your class

[DllImportAttrib ute( "User32.dll " )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttrib ute( "User32.dll " )]
private static extern int SetForegroundWi ndow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWi ndow( hWnd );
}

Shak.
"zhou" <zy****@sohu.co m> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
in Visual Basic ,I use
Appactivate(Aca dApp.caption);



Nov 16 '05 #9
Manish,

Multiple instances of same application will have same titiles. To over come
this, we have to get process ids, to identify which one we want to activate.

for example

Process [] apps = Process.GetProc essesByName("Te stAppName")

Now if we decide which one we want from this process list to be activated,
pass the handle to SetForegroundWi ndow() function to activate it.

example:

SetForegroundWi ndow(app[0].Handle.ToInt32 ()); //assuming that 1st process
id is the one we want to activate.

Shak.


"Manish Agarwal" <ma************ @mphasis.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
This is 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**@fakedomai n.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
This can be achieved by windows api's

Add the definitions inside your class

[DllImportAttrib ute( "User32.dll " )]
private static extern int FindWindow( String ClassName, String
WindowName );
[DllImportAttrib ute( "User32.dll " )]
private static extern int SetForegroundWi ndow( int hWnd );
//to activate an application
int hWnd = FindWindow( null, "This is my Application Title" );
if( hWnd > 0 )
{
SetForegroundWi ndow( hWnd );
}

Shak.
"zhou" <zy****@sohu.co m> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl...
in Visual Basic ,I use
Appactivate(Aca dApp.caption);



Nov 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3100
by: Milon | last post by:
Hi all, I am new to Python, and I just wrote a simple script to launch an application from the windows's start menu's run command. (see code as follow) There is an "OK" button on the new application I launched, but I can't get Python to click on it because the new window is not in focus and I read somewhere off the web that I need to activate the new window first before I can do anything on the new window. I couldn't find any useful...
1
466
by: LarsJ | last post by:
Hi, can please MS answer this question: Is there any way for an desktop application to make it the active application (= the application window is highlighted and in front)? Or is there any way for an application to make another application the active application? I'm developing a desktop app using VB.NET with Windows 2000 SP4 as runtime OS. There is a main app that starts a 2nd app in background and a socket communication line is...
4
5185
by: bughunter | last post by:
In version 7.x connect to db activate db db SQL1494W Activate database is successful, however, there is already a connection to the database. works fine - db activated. In 8.x - No! WHY??? :-(
1
11655
by: Bsiang Tan | last post by:
Is there any way to activate or bring the process to front ? For example, my application will run the windows calculator. After certain process, I will need to activate the calculator... I know how to runthe windows calculator.. is Process.Start("calc.exe") but when I wish to activate the it, I have no idea.. I know there is a function AppActivate( ) in VB.. is there any equivalent function in C# ?
5
2814
by: juststarter | last post by:
hi there here is my problem : there is a main form (frmMain) which calls a searchForm (frmSearch). Then i select an item (from the returned ones) and open a third form (frmData). Taking from there i can either : A. open a fourth form (frmComment) which is just a textbox and a button (and should return the text entered in the textbox into frmData) B. open a word document ,and paste its contents into a richtextbox in frmData The problem...
0
2195
by: venkat | last post by:
Hi, I have migrated application code to c#2.0 and when I build the solution I am getting the following warning. My application interacts with Excel. So I need to invoke different methods on Workbook class. At one line I am activating a workbook using workbook object. Activate(); Then I am getting the following error. Ambiguity between method '_Workbook.Activate()' and non-method 'WorkbookEvents_Event.Activate'. Using method group.
2
7884
by: Dave Booker | last post by:
I have a Windows form application that I generally run minimized. When a critical event occurs it instantiates another "Alert" form which I want to grab the user focus. In the Alert constructor I call both this.Show() and this.Activate(), but if the parent application is minimized then the Alert form will also stay minimized (and just flash). How can I cause the Alert form to show itself and grab focus?
0
1637
by: LostInMD | last post by:
Hi, I am loading word with vb2005 customized commandbars. During the load of the Word exe, the exe automatically opens a new document. I am having difficulty "activating" the open document within the word application after I close the dialogbox (that is loaded upon the user clicking one of the commandbar buttons). After I close my dialog box, I see the ibeam cursor in my word document, however it is not flashing, just a solid...
0
1376
by: =?Utf-8?B?Um9nw6lyaW8gRmVycmVpcmE=?= | last post by:
First of all, I'd like to say that it's not easy to figure out the behavior of ToolStripMenuItem Visible property. I have replaced my Windows Forms 1.1 MainMenus with the new MainMenuStrip when I've converted my application to .Net 2.0. Even after changing the Visible property usage to Activate I still have a layout problem. Just a simple example:
0
8238
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8174
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8624
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7164
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1485
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.