-
May 30th, 2006, 09:00 AM
#1
Closing application
Hi ,
I want to close an application with postmessage. For word it is working fine. But the Software I am using is ultraedit is opening text with the new tab only. In this i am facing problem getting the handle by its caption.
Because the application may contain any number text documents.
Can some body help me
-
May 30th, 2006, 09:14 AM
#2
Re: Closing application
post the code u are using to close apps...
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
May 30th, 2006, 09:21 AM
#3
Re: Closing application
extention1 ="UltraEdit-32 - [" & "C:\test1.txt"
hWindow = FindWindow(vbNullString, extention1)
lngReturnValue = PostMessage(hWindow, WM_CLOSE, vbNull, vbNull)
The problem here is that if the user changes the tab in the application window I am not abled to get the window handle.
Is is there any method to find the instance of an application and close it
-
May 30th, 2006, 09:30 AM
#4
Re: Closing application
Using SPY++ find the class name of the Applicationa and then use the classname rather than the windowtext to get the window handle.
Spy ++ can be found under Start/Programs/Microsoft Visual Studio 6.0/Microsoft Visual Studio 6.0 tools.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
May 30th, 2006, 09:31 AM
#5
Re: Closing application
Please Explain me, I could not able to get u
-
May 30th, 2006, 09:37 AM
#6
Re: Closing application
FindWindow API accepts two parameters.
1. The classname
2. The text in the caption of the window.
Now if you are not sure about the caption (you are saying that it might change) so you will be better of using the ClassName. To get the classname of the specified window read my previous post.
Your code for Findwindow will change to this after you know the classname
VB Code:
hWindow = FindWindow(className, vbNullString)
Use [code] source code here[/code] tags when you post source code.
My Articles
-
May 30th, 2006, 09:43 AM
#7
Re: Closing application
hmm.. well I just tried a bunch of ways.. didnt work.. sorry.
I will keep trying
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
May 30th, 2006, 09:44 AM
#8
-
May 31st, 2006, 02:15 AM
#9
Re: Closing application
Originally Posted by danasegarane
Can y post me the link
Link to what?
Have you tried what I suggested?
Use [code] source code here[/code] tags when you post source code.
My Articles
-
May 31st, 2006, 02:26 AM
#10
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|