wmcopydata.c

Go to the documentation of this file.
00001 /* Allan CORNET 2004 INRIA */
00002 #include "wmcopydata.h"
00003 
00004 #include "Messages.h"
00005 #include "Warnings.h"
00006 #include "Errors.h"
00007 
00008 
00009 static char LineFromAnotherScilab[MAX_PATH];
00010 static BOOL ReceiveDatafromAnotherScilab=FALSE;
00011 static char TitleScilabSend[MAX_PATH];
00012 
00013 /*-----------------------------------------------------------------------------------*/
00014 BOOL GetCommandFromAnotherScilab(char *TitleWindowSend,char *CommandLine)
00015 {
00016         BOOL Retour=FALSE;
00017 
00018         if (ReceiveDatafromAnotherScilab)
00019         {
00020                 if (wsprintf(CommandLine,"%s",LineFromAnotherScilab) <= 0) return FALSE;
00021                 wsprintf(TitleWindowSend,"%s",TitleScilabSend);
00022 
00023                 ReceiveDatafromAnotherScilab=FALSE;
00024                 Retour=TRUE;
00025         }
00026         else
00027         {
00028                 Retour=FALSE;
00029         }
00030 
00031         return Retour;
00032 }
00033 /*-----------------------------------------------------------------------------------*/
00034 BOOL SendCommandToAnotherScilab(char *ScilabWindowNameSource,char *ScilabWindowNameDestination,char *CommandLine)
00035 {
00036    COPYDATASTRUCT MyCDS;
00037    MYREC MyRec;
00038    HWND hWndSource=NULL;
00039    HWND hWndDestination=NULL;
00040  
00041 
00042    if (wsprintf(MyRec.CommandFromAnotherScilab,"%s",CommandLine) <= 0) return FALSE;
00043   
00044 
00045    MyCDS.dwData = 0; 
00046    MyCDS.cbData = sizeof( MyRec );
00047    MyCDS.lpData = &MyRec;
00048    
00049    hWndSource=FindWindow(NULL,ScilabWindowNameSource);
00050    hWndDestination=FindWindow(NULL, ScilabWindowNameDestination);
00051 
00052    if ( (hWndDestination != NULL) )
00053    {
00054              SendMessage( hWndDestination,
00055                                           WM_COPYDATA,
00056                                           (WPARAM)(HWND) hWndDestination,
00057                                           (LPARAM) (LPVOID) &MyCDS );
00058    }
00059    else return FALSE;
00060 
00061    return TRUE;
00062 }
00063 /*-----------------------------------------------------------------------------------*/
00064 BOOL ReceiveFromAnotherScilab(HWND hWndSend,PCOPYDATASTRUCT MyCopyDataStruct)
00065 {
00066    BOOL Retour=FALSE;
00067  
00068    if (wsprintf(LineFromAnotherScilab,"%s",(LPSTR) ((MYREC *)(MyCopyDataStruct->lpData))->CommandFromAnotherScilab)  <= 0) return FALSE;
00069    
00070    GetWindowText(hWndSend,TitleScilabSend,MAX_PATH);
00071    ReceiveDatafromAnotherScilab=TRUE;
00072    Retour=TRUE;
00073 
00074    return Retour;
00075 }
00076 /*-----------------------------------------------------------------------------------*/

Generated on Sun Mar 4 15:03:54 2007 for Scilab [trunk] by  doxygen 1.5.1