|
-
Oct 28th, 2009, 11:23 PM
#1
Thread Starter
Addicted Member
Kill Process
Hi!
i have written a software in vb6 with Sql server 2000 as database.
the software works fine but i have few problems which i could solve.
1) when i close the application i find that the process in the task manager is still running?
how to kill the process once i exit from the software.
please help me in this regard.
its very urgent.
with regards!
Sethuraman R
-
Oct 29th, 2009, 12:07 AM
#2
Re: Kill Process
may be u didn't close the recordset, try something like this..
Code:
If Not Rs Is Nothing Then
'first, check if the state is open, if yes then close it
If (Rs.State And adStateOpen) = adStateOpen Then
Rs.Close
End If
'set them to nothing
Set Rs = Nothing
End If
then unload all forms
Code:
Dim F As Form
For Each F In Forms
Unload F
Set F = Nothing 'clean up
Next
-
Oct 29th, 2009, 02:45 AM
#3
Re: Kill Process
With this little information, I cannot comment much... Can you show your project for a faster resolution?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 29th, 2009, 03:11 AM
#4
Re: Kill Process
Can you place a breakpoint on your code that checks if the rs is open and if so closes it? I dont believe you need to do a bitwise comparison on it. Just check if its adStateOpen and if so, close
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 
-
Oct 29th, 2009, 11:52 AM
#5
Re: Kill Process
You should use a bitwise comparison as seenu_1st showed, because the .State property of ADO objects can have multiple values at the same time - such as Open and Executing.
For an explanation (and example code) for how you should be closing a form/program, see the article How should I close my form/program/class? from our Classic VB FAQs (in the FAQ forum)
-
Oct 29th, 2009, 02:55 PM
#6
Re: Kill Process
Then I guess Microsoft is wrong...
Note the "GetState" procedure as well as the error handler:
http://msdn.microsoft.com/en-us/libr...60(VS.85).aspx
Code Examples 1-5:
http://msdn.microsoft.com/en-us/library/ms807027.aspx
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 
-
Oct 30th, 2009, 06:19 AM
#7
Re: Kill Process
As is often the case, Microsoft don't show every property/method to the full in their examples - and occasionally (like in this case) show things which are over simplified, and thus go against the documentation of those properties.
The actual documentation for State includes this:
The object's State property can have a combination of values. For example, if a statement is executing, this property will have a combined value of adStateOpen and adStateExecuting.
I've seen this happen myself (and it's been an issue on the forums before), so it seems that the example from Microsoft is not entirely safe - but their explanation is fine.
I guess they simplified the example so that they didn't have to explain bit masking.
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
|