473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

MSComm obj.

AA
Hi
I am developing an app in which I have used a MSComm object. I have opened
the
port, performed the transactions, and then closed the port.
But when I check in the task mamager, the memory being held by the MSComm is
not being released. I am using the SetPortOpen method.
Is there any way of releasing this memory explicitly.
Regards.
Nov 17 '05 #1
4 3437
I have read somewhere about MSComm control creating an extra copy of data
when GetInput(...) is invoked, and that can be solved by using Attach method
of COleVariant.

COleVariant var = MSComm1.GetInput();
This makes an extra copy of the data and leaves it lying around.
Instead use this...
COleVariant var;
var.Attach (MSComm1.GetInput());

Then you can access the data using SafeArrayAccessData. Don't forget to use
SafeArrayUnaccessData for unlocking...

Cheers
Jagadeesh

"AA" <no*@noreply.com> wrote in message
news:u6**************@TK2MSFTNGP10.phx.gbl...
Hi
I am developing an app in which I have used a MSComm object. I have opened
the
port, performed the transactions, and then closed the port.
But when I check in the task mamager, the memory being held by the MSComm is not being released. I am using the SetPortOpen method.
Is there any way of releasing this memory explicitly.
Regards.

Nov 17 '05 #2
Thanks for your immediate help Jagadeesh.
However, please look at my issue below : This code is from MSDN :
MSComm mlComm;

mlComm.SetCommPort(1);

mlComm.SetInBufferSize(1024);

mlComm.SetOutBufferSize(512);

mlComm.SetSettings("9600,n,8,1");

mlComm.SetInputMode(1);

mlComm.SetRThreshold(0);

mlComm.SetSThreshold(0);

// try catch loop

try

{

m_ctlComm.SetPortOpen(TRUE);

}

catch(CException* e)

{

AfxMessageBox("Open already. Please check!!. ",MB_ICONSTOP);

return FALSE;

}

It is taking around 3.5 MB space, which is not released even after I return
to the main app after closing the port.

Please suggest.
"Jagadeesh VN" <ja*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have read somewhere about MSComm control creating an extra copy of data
when GetInput(...) is invoked, and that can be solved by using Attach method of COleVariant.

COleVariant var = MSComm1.GetInput();
This makes an extra copy of the data and leaves it lying around.
Instead use this...
COleVariant var;
var.Attach (MSComm1.GetInput());

Then you can access the data using SafeArrayAccessData. Don't forget to use SafeArrayUnaccessData for unlocking...

Cheers
Jagadeesh

"AA" <no*@noreply.com> wrote in message
news:u6**************@TK2MSFTNGP10.phx.gbl...
Hi
I am developing an app in which I have used a MSComm object. I have opened the
port, performed the transactions, and then closed the port.
But when I check in the task mamager, the memory being held by the
MSComm is
not being released. I am using the SetPortOpen method.
Is there any way of releasing this memory explicitly.
Regards.


Nov 17 '05 #3
I think, its taking some memory for the initialization. Even if you create
another instance of MSComm, then the memory usage wont go up. It happens
only for the first time.
"AAg." <no*@noreply.com> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
Thanks for your immediate help Jagadeesh.
However, please look at my issue below : This code is from MSDN :
MSComm mlComm;

mlComm.SetCommPort(1);

mlComm.SetInBufferSize(1024);

mlComm.SetOutBufferSize(512);

mlComm.SetSettings("9600,n,8,1");

mlComm.SetInputMode(1);

mlComm.SetRThreshold(0);

mlComm.SetSThreshold(0);

// try catch loop

try

{

m_ctlComm.SetPortOpen(TRUE);

}

catch(CException* e)

{

AfxMessageBox("Open already. Please check!!. ",MB_ICONSTOP);

return FALSE;

}

It is taking around 3.5 MB space, which is not released even after I return to the main app after closing the port.

Please suggest.
"Jagadeesh VN" <ja*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have read somewhere about MSComm control creating an extra copy of data
when GetInput(...) is invoked, and that can be solved by using Attach

method
of COleVariant.

COleVariant var = MSComm1.GetInput();
This makes an extra copy of the data and leaves it lying around.
Instead use this...
COleVariant var;
var.Attach (MSComm1.GetInput());

Then you can access the data using SafeArrayAccessData. Don't forget to

use
SafeArrayUnaccessData for unlocking...

Cheers
Jagadeesh

"AA" <no*@noreply.com> wrote in message
news:u6**************@TK2MSFTNGP10.phx.gbl...
Hi
I am developing an app in which I have used a MSComm object. I have

opened the
port, performed the transactions, and then closed the port.
But when I check in the task mamager, the memory being held by the

MSComm
is
not being released. I am using the SetPortOpen method.
Is there any way of releasing this memory explicitly.
Regards.



Nov 17 '05 #4
Hi Jagadeesh
Without the MSComm GetInput also, it is giving the same memory usage.
Can there be any other API or method to explicitly clear this memory?
Regards.
"Jagadeesh VN" <ja*********@hotmail.com> wrote in message
news:u6**************@TK2MSFTNGP11.phx.gbl...
I think, its taking some memory for the initialization. Even if you create
another instance of MSComm, then the memory usage wont go up. It happens
only for the first time.
"AAg." <no*@noreply.com> wrote in message
news:uM**************@tk2msftngp13.phx.gbl...
Thanks for your immediate help Jagadeesh.
However, please look at my issue below : This code is from MSDN :
MSComm mlComm;

mlComm.SetCommPort(1);

mlComm.SetInBufferSize(1024);

mlComm.SetOutBufferSize(512);

mlComm.SetSettings("9600,n,8,1");

mlComm.SetInputMode(1);

mlComm.SetRThreshold(0);

mlComm.SetSThreshold(0);

// try catch loop

try

{

m_ctlComm.SetPortOpen(TRUE);

}

catch(CException* e)

{

AfxMessageBox("Open already. Please check!!. ",MB_ICONSTOP);

return FALSE;

}

It is taking around 3.5 MB space, which is not released even after I

return
to the main app after closing the port.

Please suggest.
"Jagadeesh VN" <ja*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have read somewhere about MSComm control creating an extra copy of data when GetInput(...) is invoked, and that can be solved by using Attach

method
of COleVariant.

COleVariant var = MSComm1.GetInput();
This makes an extra copy of the data and leaves it lying around.
Instead use this...
COleVariant var;
var.Attach (MSComm1.GetInput());

Then you can access the data using SafeArrayAccessData. Don't forget
to use
SafeArrayUnaccessData for unlocking...

Cheers
Jagadeesh

"AA" <no*@noreply.com> wrote in message
news:u6**************@TK2MSFTNGP10.phx.gbl...
> Hi
> I am developing an app in which I have used a MSComm object. I have

opened
> the
> port, performed the transactions, and then closed the port.
> But when I check in the task mamager, the memory being held by the

MSComm
is
> not being released. I am using the SetPortOpen method.
> Is there any way of releasing this memory explicitly.
> Regards.
>
>



Nov 17 '05 #5

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

Similar topics

1
by: jinoy | last post by:
how can i detect an incoming caller's telephone keystroke using modem, using mscomm or other? how can i detect an outgoing call using mscomm? how can i get a caller id using mscomm?
1
by: Peter Krikelis | last post by:
Hi, I am trying to develope a User Control Library that features MScomm control. I test my user control in a test application. When I run the application I receive the following: An...
0
by: morgal | last post by:
That is one reason I quit using MS custom controls, you have to buy the license. In VB 6 they give you a try it license and then you develop a huge application or small one and find out you don't...
6
by: Barry Martin | last post by:
I am using an activex control mscomm to control a serial port in VB.NET. I place the control on the main form and set its port, baud rate, etc. properties. After creating a code module that needs...
1
by: Barry | last post by:
I am using the mscomm activex control in vb.net. I can add the control to the toolbar which will allow me to drop it onto a form. As long as I am in the code space for that form it works fine....
9
by: Carl Gilbert | last post by:
Hi I'm trying to open a vb6 project in vb.net which uses the mscomm component. When running the vb upgrade wizard in vb.net, an error is raised: Upgrade failed, unable to load reerenced...
0
by: swati2106 | last post by:
HI, I have develop a apllication , To store the GPS data in database, for that , to read GPS data I have used the Mscomm port, In which I create the object of class RS232 n open that port,...
0
by: cmdolcet69 | last post by:
I get the following error message when I output to the mscomm: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in COM.exe Additional information: Exception...
0
by: daveman | last post by:
Hello, I'm encountering a "Blue Screen of Death" when I try to send data to a bluetooth sensor via a serial port, using the MSCOMM ActiveX object. I was wondering if anyone has any ideas how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.