AnsweredAssumed Answered

vrf Closing MATLAB (in task bar) and re-opening after

Question asked by VRFuser on Jul 30, 2004
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=iso-8859-1"><META content="MSHTML 6.00.2800.1400" name=GENERATOR><STYLE></STYLE></HEAD><BODY bgColor=#ffffff><DIV><FONT face=Arial size=2>Hello all</FONT></DIV><DIV><FONT face=Arial size=2></FONT> </DIV><FONT face=Arial size=2><DIV><FONT face=Arial size=2>We wanted to prevent the user from closing the MATLAB Server task bar item as this causes errors when an already-open VEE program tries to re-initialise the server.</FONT></DIV><DIV> </DIV><DIV>I've found a simple solution to this.  </FONT></DIV><DIV><FONT face=Arial size=2></FONT> </DIV><DIV><FONT face=Arial size=2>For anyone who's interested, the solution is to hide the window (which hides task bar item):</FONT></DIV><DIV><FONT face=Arial size=2></FONT> </DIV><DIV><FONT face=Arial size=2>API call to 'FindWindow(0 as long, "MATLAB Server")' to get the window handle.</FONT></DIV><DIV><FONT face=Arial size=2>API call to 'ShowWindow(wndHandle,0)' to hide the window.</FONT></DIV><DIV><FONT face=Arial size=2></FONT> </DIV><DIV><FONT face=Arial size=2>When using this I am unable to show the window (task bar item) again, not sure why and it doesn't matter.  The hidden window still closes when VEE exists.  This is what happens currently anyway.</FONT></DIV><DIV><FONT face=Arial size=2></FONT> </DIV><DIV><FONT face=Arial size=2>Cheers</FONT></DIV><DIV><FONT face=Arial size=2></FONT> </DIV><DIV><FONT face=Arial size=2>Andrew Fudge</FONT></DIV><DIV><FONT face=Arial size=2>Genesys IBS</FONT></DIV><DIV><FONT face=Arial size=2>Wales, UK</FONT></DIV><DIV><FONT face=Arial size=2></FONT> </DIV><BLOCKQUOTE style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>  <DIV   style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>   <A title=AndrewF@genesysibs.com href="mailto:AndrewF@genesysibs.com">Andrew   Fudge</A> </DIV>  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=vrf@agilent.com   href="mailto:vrf@agilent.com">VRF</A> </DIV>  <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, July 30, 2004 2:19 PM</DIV>  <DIV style="FONT: 10pt arial"><B>Subject:</B> [vrf] Re: Closing MATLAB (in   task bar) and re-opening after</DIV>  <DIV><BR></DIV>  <DIV><FONT face=Arial size=2>Thanks for your reply.  I didn't mention   that we want to keep VEE open.  I'm still looking into this.    </FONT></DIV>  <DIV><FONT face=Arial size=2></FONT> </DIV>  <DIV><FONT face=Arial size=2>I wonder if there is a way to prevent MATLAB   closing.</FONT></DIV>  <DIV><FONT face=Arial size=2></FONT> </DIV>  <DIV><FONT face=Arial size=2>Cheers</FONT></DIV>  <DIV><FONT face=Arial size=2></FONT> </DIV>  <DIV><FONT face=Arial size=2>Andrew Fudge</FONT></DIV>  <DIV><FONT face=Arial size=2>Genesys IBS</FONT></DIV>  <DIV><FONT face=Arial size=2>Wales, UK</FONT></DIV>  <BLOCKQUOTE dir=ltr   style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>    <DIV     style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>     <A title=MStrutt@tycoelectronics.com     href="mailto:MStrutt@tycoelectronics.com">Strutt, Michael</A> </DIV>    <DIV style="FONT: 10pt arial"><B>To:</B> <A title=AndrewF@genesysibs.com     href="mailto:AndrewF@genesysibs.com">'Andrew Fudge'</A> </DIV>    <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, July 30, 2004 12:47     PM</DIV>    <DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [vrf] Closing MATLAB (in     task bar) and re-opening after</DIV>    <DIV><BR></DIV>    <DIV><SPAN class=432394511-30072004><FONT face=Arial color=#0000ff size=2>Hi     Andrew</FONT></SPAN></DIV>    <DIV><SPAN class=432394511-30072004><FONT face=Arial color=#0000ff size=2>we     had a similar problem.</FONT></SPAN></DIV>    <DIV><SPAN class=432394511-30072004><FONT face=Arial color=#0000ff size=2>So     we use a script </FONT></SPAN></DIV>    <DIV><SPAN class=432394511-30072004><FONT face=Arial color=#0000ff     size=2>close('all')</FONT></SPAN></DIV>    <DIV><SPAN class=432394511-30072004><FONT face=Arial color=#0000ff     size=2>Then when VEE exits it seems to release the     server?</FONT></SPAN></DIV>    <DIV><SPAN class=432394511-30072004><FONT face=Arial color=#0000ff     size=2>Hope that helps Mike</FONT></SPAN></DIV>    <BLOCKQUOTE>      <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma       size=2>-----Original Message-----<BR><B>From:</B> Andrew Fudge       [mailto:AndrewF@genesysibs.com]<BR><B>Sent:</B> 30 July 2004       12:37<BR><B>To:</B> VRF<BR><B>Subject:</B> [vrf] Closing MATLAB (in task       bar) and re-opening after<BR><BR></FONT></DIV>      <DIV><FONT face=Arial size=2>Hello all</FONT></DIV>      <DIV><FONT face=Arial size=2></FONT> </DIV>      <DIV><FONT face=Arial size=2>We have been using MATLab for a while and       when MATLab is first used from VEE an item (MATLAB Server) is added to the       Task Bar (bottom of screen with start menu).</FONT></DIV>      <DIV><FONT face=Arial size=2></FONT> </DIV>      <DIV><FONT face=Arial size=2>Our problem is if a user closes this, VEE is       unable to restart the server again.  Ideally we would like to close       the server when we are finished with it and restart it when       required.  We are able to start and close the server, but subsequent       attempts to re-initialise/start the server causes the error "Workspace       initialisation failed".</FONT></DIV>      <DIV><FONT face=Arial size=2></FONT> </DIV>      <DIV><FONT face=Arial size=2>We are not using the server as an ActiveX       DLL.  We experimented with this but we are unable to close the       server.</FONT></DIV>      <DIV><FONT face=Arial size=2></FONT> </DIV>      <DIV><FONT face=Arial size=2>We have tried using MATLAB in an imported       library and deleting the library but this has similar       problems.</FONT></DIV>      <DIV><FONT face=Arial size=2></FONT><FONT face=Arial       size=2></FONT> </DIV>      <DIV>      <DIV><FONT face=Arial size=2>Has anyone encountered this problem and found       a solution?</FONT></DIV>      <DIV><FONT face=Arial size=2></FONT> </DIV>      <DIV><FONT face=Arial size=2>Many thanks in advance</FONT></DIV>      <DIV><FONT face=Arial size=2></FONT> </DIV>      <DIV><FONT face=Arial size=2>Andrew Fudge</FONT></DIV>      <DIV><FONT face=Arial size=2>Genesys IBS</FONT></DIV>      <DIV><FONT face=Arial size=2>Wales, UK</FONT></DIV></DIV>---<BR>You are       currently subscribed to vrf as: MStrutt@tycoelectronics.com<BR>To       subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".<BR>To       unsubscribe send a blank email to       "leave-vrf@it.lists.it.agilent.com".<BR>To send messages to this mailing       list, email "vrf@agilent.com". <BR>If you need help with the mailing list       send a message to "owner-vrf@it.lists.it.agilent.com".   </BLOCKQUOTE></BLOCKQUOTE>---<BR>You are currently subscribed to vrf as:   AndrewF@genesysibs.com<BR>To subscribe send a blank email to   "join-vrf@it.lists.it.agilent.com".<BR>To unsubscribe send a blank email to   "leave-vrf@it.lists.it.agilent.com".<BR>To send messages to this mailing list,   email "vrf@agilent.com". <BR>If you need help with the mailing list send a   message to "owner-vrf@it.lists.it.agilent.com". </BLOCKQUOTE>---<BR>You are currently subscribed to vrf as: rsb@soco.agilent.com<BR>To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".<BR>To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".<BR>To send messages to this mailing list,  email "vrf@agilent.com".  <BR>If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".</BODY></HTML>  

Outcomes