This program has performed an illegal operation and will be shut down??

Posted on 2003-03-26
Medium Priority
Last Modified: 2012-05-04
Hi, I'm buiding an application to get data from a device. this device using auto comm mode (send data everytime). I could open the port, and get the data properly good. but when i closed the port(through close icon on right top form), sometimes but almost appear this error "an error occured that said the progam has performed an illegal operation and will be shut down".
but if i closed through command button (just unload me code inside it) it never get the same error.
I'm using an activeX Exe program to communicate with device.
I create an instance to the activeX Exe and kill it when unload form.

this below is the detail of error cause :
DRGABCOMM caused an invalid page fault in
module KERNEL32.DLL at 017f:bff7b9a6.
EAX=00000000 CS=017f EIP=bff7b9a6 EFLGS=00000246
EBX=004164d0 SS=0187 ESP=0063fb60 EBP=0063fb7c
ECX=0041624c DS=0187 ESI=004164d0 FS=5d57
EDX=0107003c ES=0187 EDI=00000000 GS=0000
Bytes at CS:EIP:
ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24
Stack dump:
0041624c 21c193a3 004164d0 00000000 0041624c 00000001 0041624c 0063fba0 21c1963c 0063fb94 0063fbb8 00008c28 0063fc04 00000000 0000002d 00000000

please help me to solve this prob..
thank you

Liung 012
Question by:liung012
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

n_narayanan earned 150 total points
ID: 8218018
Whatever you have written to unload the code (in the command button event) put the same in the following two events,


also put the same in

form_terminate() event



Author Comment

ID: 8237449
hi, Narayanan..
I found it. i've already did same as your suggestion
This's your points.


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question