Ask Question Forum:
C
O
M
P
U
T
E
R
2
8
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Y-position of the mouse cursor
Attachment:===
Kill accumulate un-used IE process in VBA

Question-1 I see some people use createobject("internetExplorer.Application" ) to
create IE object but sometimes I see some people is using this, createprocess(sNull, "C:program filesinternet Exploreriexplore.exe", ByVal 0&, ByVal 0&, 1&, NORMAL_PRIORITY_CLASS, ByVal 0&, sNull, sInfo, pInfo). What is different besides
one is object and the other is process.
Question-2 COuld you provide some simple code to kill the IE process by processid everytime I run my code before quit my program that will help to make sure the process is gone completely ?
I have search one website, http://en.allexperts.com/q/Visual-Basic-1048/Kill-Process-VB-its-2.htm, describle these, but it is hard to follow up, in which we have seen a lot of Kernel32
and user32 lib usage such as follows , Why they are using ? Could you explain it whether
it is good way to kill a process
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long
Private Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
Private Declare Function LookupPrivilegeValue Lib "advapi32.dll" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLuid As LUID) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Question-3, If quesion-2 is no answer, how about Alternatvie way to solve this out,
could use Shell command in VBA and run cmd tasklist to record
the pid when I create IE and then use the same pid to kill the process by taskkill /F /pid ?
Killing the accumulate un-used IE process that will help also to not be infected by virus
And I don't want kill the process in Task manage because we don't know when/what time we shoud do it. Programming including the kill process part is better.
Please advise
Duncan
Sub IEconnect()Set myIE = NothingSet myIE = CreateObject("InternetExplorer.Application")Set myIE = New InternetExplorerWith myIE .Visible = True.navigate "www.example.com" doevents.quitEnd WithEnd Sub
1:2:3:4:5:6:7:8:9:10:11:
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan
Dear eql1044,
it works as your last email said.
the memory is stoped to increase
and keep same memory usage
for such process of IE. Proabably
.quit is working as we expect
What is wrong with the sentence
set myIE= New Internetexplorer
Most programmer is believing the
word "New" is re-start new IE
COuld explain it a little more about
"new" before we close this case
THanks, anyway, care about these
because my VBA code will run
the whole week without stopping
to collect data and without virus
interrupt. So now I am foucing
virus and security issue will stop
my VBA code running
THanks
Duncan