#include "EndUser4glwinx.h" #include #include #include "c:\EndUser4gl\opc\c\bin\h\sysdict.h" extern void EU_ListView_OnSize(HWND ,HWND ,int ,int ,int ,int ); extern int printfEU(const char * , ...) ; extern OPCt_dictHwnd *racineHwnd ; extern void OPCF_str_dict_initHwnd(void) ; /* init arbre */ extern OPCt_dictHwnd * OPCF_str_dict_ins_inserHwnd(HWND hwnd ); extern OPCt_dictHwnd * OPCF_str_dict_ins_relHwnd(HWND hwnd,OPCt_dictHwnd *arbreHwnd ); extern OPCt_dictHwnd * OPCF_str_dict_lectHwnd (HWND hwnd) ; extern OPCt_dictHwnd * OPCF_str_dict_lec_relHwnd(HWND hwnd,OPCt_dictHwnd *arbreHwnd); static OPCt_dictGlobalInt * GDictTransInit; static OPCt_dictLocalInt * LDictTransInit; //extern int EU_Display_Win_Info(HWND hWnd,HWND HwndLocal); extern UINT G_wMessage,G_wMessageMenu, G_wMessagePaint ; extern HWND HwndTLVEndUser4gl,HwndTGDEndUser4gl ; extern HWND HwndTLVdisplayEndUser4gl ; extern HWND HwndTGDdisplayEndUser4gl ; extern int CreateWinDisplay( ) ; extern HWND G_EndUser4glhwndBS_OWNERDRAW,GhwndDialog ;/* tres important */ extern unsigned short int GlobalReturnActif; extern BOOL PopFileRead (HWND hwndEdit, LPSTR lpstrFileName); extern unsigned short int Global_Bloc; VOID CALLBACK TimerProc (HWND hwnd, UINT iMsg, UINT iTimerID, DWORD dwTime); static MENUITEMINFO G_mii; // accelerateurs extern UINT g_MenuItemID ; //WM_COMMAND extern HMENU g_Hmenu ; //WM_MENUSELECT extern BOOL gWM_SETCURSOR, g_LBUTTONDOWN; extern HWND G_IsBMPushButtonHWND ; BOOL gWM_CHAR =FALSE; HWND G_IsOnInputDataHWND; HCURSOR g_CurrentCursorWait =NULL ; int GpassageButtonDraw = FALSE; int OPC_Update_TableSymboleGetWinTxt(char *nom, int NumDial, int NumWin,int longeur); extern void OPC_Aliment_Table_Returning(char *) ; void EU_Close_Dialogue(void); extern int PASCAL WinMainAviEndUser4gl(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpszCmdParam,int nCmdShow); char g_char[10]; static char G_Name_transaction_Encours[C_CMP_TAILLE_NOM_DICT]= "\0"; /* inclure les codes éxécution de votre langage*/ #define MAXITERTRS 6 extern long OPCExecute_WinObjectScreen(long OPCcodeExe) { char zone1[C_CMP_TAILLE_NOM_DICT] = "\0"; char zone2[C_CMP_TAILLE_NOM_DICT]= "\0"; LPSTR pvaleur = NULL ; char valeur1 [MAXBUFLENSTRING] = "\0"; char valeur2 [MAXBUFLENSTRING] = "\0" ; int NumDialog=0,NumDialog2=0,a,b,c,d ,i=0; int ReturnOpc ; int Ival=0,Ival1=0,Ival2=0 ;//,d,x = 0,nbcar ; HANDLE hCur=NULL; OPCt_dictHwnd *dictHwnd ; char *szPathCursor; short int vasizeof=0,nbelem=0,longueur=0,offsetdebut=0,offsetfin=0,dec=0; RECT rc; HDC hdc; long Lval = 0 ,Li ; MSG msg; int Gincr=0; switch(OPCcodeExe) { case CodexeBeginDialog : OPC_Depile_All(); G_Win_Style=0; if(GDictTransInit) { if( GDictTransInit->InitializeDialog ==MAXITERTRS) return 400 ; /* l'interpreteur ne relit par les instructions Dialog sinon supprime la ligne*/ } else if(LDictTransInit) { if( LDictTransInit->InitializeDialog ==MAXITERTRS) return 400 ; /* l'interpreteur ne relit par les instructions Dialog sinon supprime la ligne*/ } /* Rappel 400: tjours ds la meme regle */ break ; case CodexeEndDialog : OPC_Depile_All(); break; case CodeExeShowSplash : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_LONG, (void *)&Lval ) ; NumDialog = OPC_Return_NumDialog(zone1); OPC_Depile_All() ; ShowWindow (Dialog[NumDialog].HwndDialog, SW_SHOWNORMAL) ; UpdateWindow (Dialog[NumDialog].HwndDialog) ; ::Sleep(Lval); break; case CodeExeShowDialog : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); ShowWindow (Dialog[NumDialog].HwndDialog, SW_SHOWNORMAL) ; UpdateWindow (Dialog[NumDialog].HwndDialog) ; GhwndDialog=Dialog[NumDialog].HwndDialog; OPC_Depile_All() ; break; case CodeExeOpenDialog : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); GhwndDialog=Dialog[NumDialog].HwndDialog; OPC_Depile_All(); while(GetMessage(&msg,0,0,0) ) //HwndTLVEndUser4gl { TranslateMessage(&msg); // eu.hwnd = msg.hwnd; eu.wParam = msg.wParam; eu.message = msg.message; eu.pt.x = msg.pt.x ; eu.pt.y = msg.pt.y ; DispatchMessage(&msg) ; // printf("LV : GETMESSAGE Message BEFORE : hwnd : %X Wparam : %d Message : %d souri : %d %d",\ //msg.hwnd,msg.wParam,msg.message,msg.pt.x ,msg.pt.y ); /* wm_char */ if( ((msg.message >= 256 ) && (msg.message <= 258 ) ) || ((msg.message >= 160 ) && (msg.message <= 161 ) ) ) break; if ((msg.message == 513) || /* equivaut à mouse gauche */ (msg.message == 516) ){ /* equivaut à mouse droite */ G_IsBMPushButtonHWND = msg.hwnd; g_LBUTTONDOWN= TRUE ; //TRACEEU("GetMessage %d %X ",msg.message, msg.hwnd ); break; } if (gWM_SETCURSOR == TRUE) break; // if (i > 100)break; i++;// gif animed + //if (gWM_SETCURSOR == TRUE)break; if ((msg.message ==1024 ) && (msg.wParam == 0)) break; /*c'est le plus important*/ } if (gWM_SETCURSOR == TRUE )// {/* tres important : mouse sur la Window : Ex: Button Draw */ if (eu.hwnd > 0) // eu.hwnd alimenté par WM_SETCURSOR dictHwnd = OPCF_str_dict_lectHwnd(eu.hwnd); if(dictHwnd) { if( g_CurrentCursorWait == NULL) { szPathCursor= strdup( dictHwnd ->Cursor); a = GetSystemMetrics(SM_CXCURSOR); b = GetSystemMetrics(SM_CYCURSOR); hCur= (HCURSOR)LoadImage(hInstance,szPathCursor,\ (int) IMAGE_CURSOR ,\ a,b , (int) LR_LOADFROMFILE ); if (hCur){ SetCursor((HCURSOR) hCur ); ShowCursor(TRUE); } } } } break ; case CodeExeForeGroundDialog : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); ShowWindow (Dialog[NumDialog].HwndDialog, SW_SHOWNORMAL) ; UpdateWindow (Dialog[NumDialog].HwndDialog) ; SetForegroundWindow(Dialog[NumDialog].HwndDialog) ; OPC_Depile_All() ; break ; case CodeExeBeginTransaction : OPCF_Pile_Depile( P_NAMEVAR, (void *)G_Name_transaction_Encours ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); // printfEU("Begin Global_Bloc %d",Global_Bloc); GDictTransInit = OPCF_str_dict_lectGlobalInt(G_Name_transaction_Encours); if(GDictTransInit) { GDictTransInit->GlobalBlocTrs = Global_Bloc; if(GDictTransInit->InitializeDialog !=MAXITERTRS) GDictTransInit->InitializeDialog++; } else LDictTransInit= OPCF_str_dict_lectLocalInt(G_Name_transaction_Encours); if(LDictTransInit) { LDictTransInit->GlobalBlocTrs = Global_Bloc; if(LDictTransInit->InitializeDialog !=MAXITERTRS) LDictTransInit->InitializeDialog++; } while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg); break; case CodeExeEndTransaction : OPC_Depile_All() ; while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg); break; case CEReturnTransaction : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); GDictTransInit = OPCF_str_dict_lectGlobalInt(zone1); if(GDictTransInit) { Global_Bloc = GDictTransInit->GlobalBlocTrs; Global_Bloc--; return 300; } else LDictTransInit= OPCF_str_dict_lectLocalInt(zone1); if(LDictTransInit) { Global_Bloc = LDictTransInit->GlobalBlocTrs;Global_Bloc--; return 300; } while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessage(&msg); break; case CodeExeBeginInitialize : OPC_Depile_All() ; if(GDictTransInit) {if (GDictTransInit->Initialize == TRUE) // aller à fin de End Initialize return 400 ; } else if(LDictTransInit) { if (LDictTransInit->Initialize == TRUE) // aller à fin de End Initialize return 400 ; } else break ; case CodeExeEndInitialize : OPC_Depile_All() ; if(GDictTransInit) GDictTransInit->Initialize = TRUE ; else if(LDictTransInit) LDictTransInit->Initialize = TRUE ; break ; case CodeExeBeginMessageDialog : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone2 ); OPCF_Pile_Depile( P_LONG, (void *)&Lval ) ; OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); OPC_Depile_All() ; GetMessage(&msg,NULL,0,0); TranslateMessage(&msg); eu.hwnd = msg.hwnd; eu.wParam = msg.wParam; eu.message = msg.message; eu.pt.x = msg.pt.x ; eu.pt.y = msg.pt.y ; DispatchMessage (&msg) ; if( G_wMessageMenu== (int)Lval) // (int) WM_MENUSELECT ) { GetMenuItemInfo(g_Hmenu ,g_MenuItemID ,FALSE,&G_mii); if(G_mii.wID >0){ //printfEU("G_mii.wID %d %d %d",G_mii.wID,G_wMessageMenu,(int)WM_MENUSELECT); g_MenuItemID=G_mii.wID;G_wMessageMenu=0; return 0; } } //printfEU("WM_QUIT %ld 1 CodeExeBeginMessageDialog eu.message %d G_wMessage %d Lval %d",\ WM_QUIT, eu.message,(int)G_wMessage,(int) Lval); //if((int)WM_CHAR == (int)Lval)eu.message++; // attn WM_COMMAND : simultané avec les autre message donc écrase le précédent //if( ( (int)WM_LBUTTONDOWN == (int)Lval) && ( (eu.wParam) == (int) MK_LBUTTON) ) if((g_LBUTTONDOWN) && ( (int)WM_LBUTTONDOWN == (int)Lval+1)) { // printfEU(" 2 CodeExeBeginMessageDialog:WM_LBUTTONDOWN %d eu.message %d G_wMessage %d Lval %d",\ // (int)WM_LBUTTONDOWN,eu.message,(int)G_wMessage,(int) Lval); return 0; } else if(G_wMessage == (int)WM_LBUTTONDOWN )return 100; else if(eu.message == (int)Lval)return 0; else if(G_wMessage == (int)Lval) return 0; else if(G_wMessagePaint == (int)Lval){ G_wMessagePaint =0;return 0;} return 100; // go to end bloc :CodeExeEndMessageDialog voir if case CodeExeIsOnInputData : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); NumDialog = OPC_Return_NumDialog(zone1); // printfEU("CodeExeIsOnSetCursor G_IsOnSetCursor %X %X",G_IsOnSetCursorHWND,Dialog[ NumDialog].TabCoordWin[Ival].hWnd); if (G_IsOnInputDataHWND == Dialog[ NumDialog].TabCoordWin[Ival].hWnd)/* voir exewinob.c : message 512 */ GlobalDoubleValResult = 1; else GlobalDoubleValResult = 0; break ; case CodeExeBeginMessageInputData : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; OPC_Depile_All(); if( gWM_CHAR ==TRUE ) { gWM_CHAR=FALSE; if( ( isalnum(g_char[0])) || (ispunct(g_char[0])) || (isspace(g_char[0])) ) { strcpy(valeur1,(char *)g_char); ReturnOpc = OPC_Update_TableSymboleString(zone1,valeur1) ; OPC_Update_TableSymboleStringEditWin(zone1) ; } return 0; } else return 100; break; case CodeExeBeginMessageOnClickDialog : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); NumDialog = OPC_Return_NumDialog(zone1); GetMessage(&msg,NULL,0,0); TranslateMessage(&msg); eu.hwnd = msg.hwnd; eu.wParam = msg.wParam; eu.message = msg.message; eu.pt.x = msg.pt.x ; eu.pt.y = msg.pt.y ; DispatchMessage (&msg) ; if((Dialog[NumDialog].HwndDialog == msg.hwnd ) || (Dialog[NumDialog].HwndDialog == GetParent(msg.hwnd )) || (Dialog[NumDialog].HwndDialog == GetParent(G_IsBMPushButtonHWND )) ) { //printfEU(" OnClickDialog %d eu.message %d WM_LBUTTON %d BN_Clik %d",\ g_LBUTTONDOWN,eu.message,(int)WM_LBUTTONDOWN,BN_CLICKED); if( (g_LBUTTONDOWN==TRUE ) )//|| ( (int)WM_LBUTTONDOWN == (int)eu.message+1)) { //printfEU("CodeExeBeginMessageOnClickDialog %d",g_LBUTTONDOWN); g_LBUTTONDOWN=FALSE; if(G_IsBMPushButtonHWND ==NULL) G_IsBMPushButtonHWND =msg.hwnd; return 0; } else return 100; } return 100; case CodeExeBeginMessageOnMenuSelect : OPC_Depile_All() ; // GetMenuItemInfo(g_Hmenu ,g_MenuItemID ,FALSE,&G_mii); // if(G_mii.wID >0){ // g_MenuItemID=G_mii.wID;G_wMessageMenu=0; // return 0; // } // else return 100; if(G_wMessageMenu == WM_MENUSELECT) { G_wMessageMenu=0; return 0;} else return 100; case CodeExeBeginMessageOnMoveCursor : OPC_Depile_All() ; // GetMessage(&msg,NULL,0,0); // TranslateMessage(&msg); // eu.hwnd = msg.hwnd; // eu.wParam = msg.wParam; // eu.message = msg.message; // eu.pt.x = msg.pt.x ; // eu.pt.y = msg.pt.y ; // DispatchMessage (&msg) ; //printfEU("CodeExeBeginMessageOnMoveCursor---gWM_SETCURSOR %d",gWM_SETCURSOR); //if(G_IsOnSetCursorHWND == eu.hwnd) // aucun mouvement sur la Windowd //return 100; //else if( gWM_SETCURSOR ==TRUE) { //printfEU(" CodeExeBeginMessageOnMoveCursor :( gWM_SETCURSOR ==TRUE)"); gWM_SETCURSOR = FALSE; return 0;//= accelateur WM_CURSOR } else if(msg.message == (int)WM_SETCURSOR )return 0;//= WM_CURSOR else if(G_wMessage == (int)WM_SETCURSOR )return 0;//= WM_CURSOR else return 100; case CodeExeEndMessageDialog : break; case CodeExeSetNewParentWin : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone2 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival2 ) ; NumDialog2 = OPC_Return_NumDialog(zone2); OPC_Depile_All(); SetParent(Dialog[NumDialog2].TabCoordWin[Ival2].hWnd, Dialog[NumDialog].TabCoordWin[Ival].hWnd);// child,new parent break; case CodeExeSetNewParentDialog : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone2 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival2 ) ; NumDialog2 = OPC_Return_NumDialog(zone2); OPC_Depile_All(); SetParent(Dialog[NumDialog2].HwndDialog,Dialog[NumDialog].HwndDialog);// child,new parent break; case CodeExeinputData : OPC_Depile_All() ; msg.message = 256; while( ( (msg.message >= 256 ) && (msg.message <= 258 ) ) || ((msg.message >= 160 ) && (msg.message <= 161 ) ) ) { GetMessage(&msg,NULL,0,0); TranslateMessage(&msg); eu.hwnd = msg.hwnd; eu.wParam = msg.wParam; eu.message = msg.message; eu.pt.x = msg.pt.x ; eu.pt.y = msg.pt.y ; DispatchMessage (&msg) ; g_char[0] = (char)msg.wParam; if( ( isalnum(g_char[0])) || (ispunct(g_char[0])) || (isspace(g_char[0])) ) { gWM_CHAR =TRUE; G_IsOnInputDataHWND = msg.hwnd ; // printfEU("1 msg.wParam %c g_char %c",msg.wParam,g_char); break; } } break; case CodeExeSETWinTxt : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); if(( pvaleur = Function_SearchValueString(zone1)) ==NULL) /* voir if.c */ { OPC_Depile_All(); return 0;} OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); OPC_Depile_All(); // printfEU("1 CodeExeSETWinTxt zone1 %s NumDialog %d %s",zone1,NumDialog ,pvaleur); i=strlen( pvaleur); SendMessage (Dialog[NumDialog].TabCoordWin[Ival].hWnd, \ EM_EXLIMITTEXT , 0l, (LPARAM)i+255) ; SetWindowText(Dialog[NumDialog].TabCoordWin[Ival].hWnd , pvaleur); // printfEU("2 %d CodeExeSETWinTxt zone1 %s NumDialog %d %s ",i,zone1,NumDialog,pvaleur );STOP(); free(pvaleur); OPC_Depile_All(); break ; case CodeExeSETWinTxtString : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 );//***NULL OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); OPC_Depile_All(); // printfEU(" CodeExeSETWinTxtString zone1 %s NumDialog %d Ival %d pvaleur %s ",\ // zone1,NumDialog,Ival, valeur1); i=strlen(valeur1); SendMessage (Dialog[NumDialog].TabCoordWin[Ival].hWnd, \ EM_EXLIMITTEXT , 0l, (LPARAM)i+1) ; SetWindowText(Dialog[NumDialog].TabCoordWin[Ival].hWnd , valeur1); OPC_Depile_All(); break ; case CodexeWinStyleIntrep : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_LONG,(void *)&Lval); G_Win_Style |= Lval; //printfEU("CodexeWinStyle G_Win_Style %ld Lval %ld %s", G_Win_Style,(long)Lval,zone1); OPC_Depile_All(); break; case CodeExeSETWinTxtFile : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); //printfEU("CodeExeSETWinTxtFilezone1 valeur %s ", valeur1);STOP(); PopFileRead ( Dialog[NumDialog].TabCoordWin[Ival].hWnd, valeur1); OPC_Depile_All(); break ; case CodeExeGetwinTxt : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone2 ); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); OPC_Depile_All(); // see you after :CodeExeMoveStringInstructionSql longueur= GetWindowTextLength(Dialog[NumDialog].TabCoordWin[Ival].hWnd); //printfEU("AVANT longueur %d hwnd %X",longueur,Dialog[NumDialog].TabCoordWin[Ival].hWnd); if(longueur > 0) { OPC_Update_TableSymboleGetWinTxt( zone2, NumDialog, Ival, longueur); //printfEU("i........:%d",i); //printfEU("APRES longueur %d GlobalNomVariable %s valeur: %s",longueur,GlobalNomVariable,PGlobalValeur1String); } break; case CodeExeSetCurrentDir : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; SetCurrentDirectory(valeur1); (int) GlobalDoubleValResult == GetLastError();// t_returning if(GlobalDoubleValResult==3) TRACEEU("Path not Find,chemin non trouvé"); OPC_Depile_All(); break; case CodeExeGetCurrentDir : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; GetCurrentDirectory(512,valeur1); ReturnOpc = OPC_Update_TableSymboleString(zone1, valeur1) ; OPC_Depile_All(); break; case CodeExeGetLastError : GlobalDoubleValResult = GetLastError(); // t_returning OPC_Depile_All(); break; case CodeExeWindowsDir : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; OPC_Depile_All(); GetWindowsDirectory ((LPSTR) valeur1 , 255); ReturnOpc = OPC_Update_TableSymboleString(zone1, valeur1) ; break ; case CodeExeSysWindowsDir : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; OPC_Depile_All(); GetSystemDirectory ((LPSTR) valeur1 , 255); ReturnOpc = OPC_Update_TableSymboleString(zone1, valeur1) ; break ; case CodeExeWinhelp : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); WinHelp(Dialog[NumDialog].HwndDialog ,valeur1, HELP_FINDER, 0 ); OPC_Depile_All(); case CodeExeBeep : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; MessageBeep(Ival); OPC_Depile_All(); break; case CodeExePlayMovieAvi : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; WinMainAviEndUser4gl(hInstance,hPrevInstance, valeur1 , nCmdShow); OPC_Depile_All(); break; case CodeExePlaySound : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; GlobalDoubleValResult = PlaySound (valeur1, NULL, SND_FILENAME | SND_ASYNC) ; OPC_Depile_All(); break; case CodeExeSetHourglassCursor : g_CurrentCursorWait= SetCursor((LoadCursor(NULL, IDC_WAIT) ) ); // printfEU("g_CurrentCursor %X",g_CurrentCursor); ShowCursor(TRUE); break; case CodeExeSetArrowCursor : SetCursor( LoadCursor(NULL, IDC_ARROW) ); ShowCursor(TRUE); g_CurrentCursorWait = NULL; break ; case CodeExeSetCursorPosition : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&a ) ; OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&b ) ; SetCursorPos(b,a); ShowCursor(TRUE); OPC_Depile_All(); break; // SendMessage(GetParent(Dialog[ NumDialog].TabCoordWin[Ival].hWnd),\ WM_MOUSEMOVE,b,a); // SetCapture(GetParent( Dialog[ NumDialog].TabCoordWin[Ival].hWnd )); // GetWindowRect(Dialog[ NumDialog].TabCoordWin[Ival].hWnd,&rc); // ClipCursor(&rc); case CodeExeCloseDialog : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; SendMessage((HWND)Dialog[Ival].HwndDialog,WM_CLOSE,0L,0L ) ; OPC_Depile_All(); break ; case CodeExeRefreshDialog : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); InvalidateRect((HWND)Dialog[Ival].HwndDialog, NULL, TRUE) ; break; case CodeExeRefreshWindow : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); NumDialog = OPC_Return_NumDialog(zone1); InvalidateRect((HWND)Dialog[ NumDialog].TabCoordWin[Ival].hWnd,NULL, TRUE) ; break; case CodeExeSetStatusDialog : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_LONG, (void *)&Lval ) ; OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); ShowWindow((HWND)Dialog[Ival].HwndDialog ,(int)Lval) ; break; case CodeExeSetStatusWindow : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_LONG, (void *)&a ) ; OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); OPC_Depile_All(); ShowWindow((HWND)Dialog[NumDialog].TabCoordWin[Ival].hWnd ,(int)a) ; break; case CodeExeDestroyAnimateGif: OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); OPC_Depile_All(); Dialog [NumDialog].TabCoordWinImage[Ival].m_bExitThread = TRUE; SetEvent(Dialog [NumDialog].TabCoordWinImage[Ival].m_hExitEvent); if (Dialog [NumDialog].TabCoordWinImage[Ival].m_hThread) { // we'll wait for 5 seconds then continue execution // I hate hangups :P WaitForSingleObject(Dialog [NumDialog].TabCoordWinImage[Ival].m_hThread,5000); CloseHandle(Dialog [NumDialog].TabCoordWinImage[Ival].m_hThread); Dialog [NumDialog].TabCoordWinImage[Ival].m_hThread = NULL; } // printfEU("%X hdc %X",Dialog [NumDialog].TabCoordWinImage[Ival].hWnd, //Dialog [NumDialog].TabCoordWinImage[Ival].m_hMemDC); // make it possible to Draw() again Dialog [NumDialog].TabCoordWinImage[Ival].m_bExitThread = FALSE; SelectObject(Dialog [NumDialog].TabCoordWinImage[Ival].m_hMemDC,\ Dialog [NumDialog].TabCoordWinImage[Ival].m_hOldBitmap); ::DeleteDC(Dialog [NumDialog].TabCoordWinImage[Ival].m_hMemDC); ::DeleteObject(Dialog [NumDialog].TabCoordWinImage[Ival].m_hBitmap); ::DeleteObject(Dialog [NumDialog].TabCoordWinImage[Ival].m_hOldBitmap); Dialog [NumDialog].TabCoordWinImage[Ival].m_hMemDC = NULL; Dialog [NumDialog].TabCoordWinImage[Ival].m_hBitmap = NULL; DestroyWindow((HWND)Dialog [NumDialog].TabCoordWinImage[Ival].hWnd ) ; break; case CodeExeDestroyDialog: OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); Dialog[Ival].dispo=1; // DestroyWindow((HWND)Dialog[Ival].HwndDialog ) ; SendMessage((HWND)Dialog[Ival].HwndDialog,WM_CLOSE,0L,0L ) ; Dialog[Ival].HwndDialog=NULL; break; case CodeExeDestroyWindow : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); NumDialog = OPC_Return_NumDialog(zone1); // DestroyWindow((HWND)Dialog[ NumDialog].TabCoordWin[Ival].hWnd ) ; SendMessage((HWND)Dialog[NumDialog].TabCoordWin[Ival].hWnd,WM_CLOSE,0L,0L ) ; Dialog[ NumDialog].TabCoordWin[Ival].hWnd=NULL; break; case CodeExeCloseWindow : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; NumDialog = OPC_Return_NumDialog(zone1); SendMessage((HWND)Dialog[NumDialog].TabCoordWin[Ival].hWnd,WM_CLOSE,0L,0L ) ; OPC_Depile_All(); break ; case CodexeTtoolbarInterprete : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1); OPCF_Pile_Depile( P_INTEGER,(void *)&Ival); OPCF_Pile_Depile( P_INTEGER,(void *)&Ival); OPCF_Pile_Depile( P_INTEGER,(void *)&Ival); OPCF_Pile_Depile( P_INTEGER,(void *)&Ival); OPCF_Pile_Depile( P_INTEGER,(void *)&Ival); // GNumDialog = Ival ; SetWindowText((HWND)Dialog[Ival].HwndDialog,""); Lval = SetWindowLong((HWND)Dialog[Ival].HwndDialog, GWL_STYLE ,\ WS_DLGFRAME ); //WS_THICKFRAME);//DS_MODALFRAME );// WS_DLGFRAME ); // printf(" CodexeToolbarInterprete : zone1 :%s Ival : %d %X %ld GCL_STYLE %d " ,\ // zone1 , Ival,HwndTDialog[Ival],Lval,GCL_STYLE); OPC_Depile_All(); break; case CodexINFOButtonBmp : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1); OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); OPC_ReturnValuesTabSymbole(P_INTEGER,GContexteLocal, zone1 ,&vasizeof, &nbelem,\ &offsetdebut,&offsetfin,&dec, &longueur,&Ival ); NumDialog = OPC_Return_NumDialog(zone1); //if((Ival== 0 ) || (NumDialog == 0))printf("Blue PROBLEM.............."); dictHwnd = OPCF_str_dict_lectHwnd(Dialog[NumDialog].TabCoordWin[Ival].hWnd); //printf("1 CodexINFO :dictHwnd %X %X Ival %d NumDialog %d", dictHwnd,Dialog[NumDialog].TabCoordWin[Ival].hWnd ,\ // Ival,NumDialog); if(!dictHwnd) { dictHwnd = OPCF_str_dict_ins_inserHwnd(Dialog[NumDialog].TabCoordWin[Ival].hWnd ); //printf("2 CodexINFO :dictHwnd %X", dictHwnd ); if(!dictHwnd) { TRACEEU("Msg G03 INFO Pb insertion Hwnd deja existant :NumDialog :%d Ival %d %X %s",\ NumDialog,Ival, Dialog[NumDialog].TabCoordWin[Ival].hWnd ,zone1);STOP(); return EUError; } else { dictHwnd->type = P_INTEGER; dictHwnd ->nom = strdup(zone2); dictHwnd ->Info = strdup(valeur1); dictHwnd ->Label = dictHwnd ->Cursor = '\0'; //TRACEEU("3 CodexINFO : %s %s",GzoneEditWin,valeur1); } } else {dictHwnd ->Info = strdup(valeur1); // TRACEEU("4 CodexINFO : %s %s ",GzoneEditWin,dictHwnd ->Info); } break; case CodeExeSETInfo : /* toolBar */ OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPCF_Pile_Depile( P_STRING, (void *)valeur1 ) ; NumDialog = OPC_Return_NumDialog(zone1); Ival= SetWindowLong(Dialog[NumDialog].TabCoordWin[Ival ].hWnd,\ GWL_ID , (long) 996); SetWindowText(Dialog[NumDialog].TabCoordWin[Ival].hWnd ,valeur1); //printfEU("CodeExeSETInfo %s",valeur1); OPC_Depile_All(); break ; case CodeExeSETDialogPos : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER,(void *)&a); OPCF_Pile_Depile( P_INTEGER,(void *)&b); OPCF_Pile_Depile( P_INTEGER,(void *)&c); OPCF_Pile_Depile( P_INTEGER,(void *)&d); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); NumDialog = OPC_Return_NumDialog(zone1); SetWindowPos(Dialog[NumDialog].HwndDialog, (HWND) NULL, d, c, b,a,\ SWP_NOZORDER | SWP_DRAWFRAME ); OPC_Depile_All(); //TRACEEU(" CodeExeSETDialogPos : %s Ival:%d %X a %d b %d c %d d %d",\ // zone1,Ival, Dialog[NumDialog].TabCoordWin[Ival].hWnd, a,b,c,d); break; case CodeExeSETWinPos : OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_NAMEVAR, (void *)zone1 ); OPCF_Pile_Depile( P_INTEGER,(void *)&a); OPCF_Pile_Depile( P_INTEGER,(void *)&b); OPCF_Pile_Depile( P_INTEGER,(void *)&c); OPCF_Pile_Depile( P_INTEGER,(void *)&d); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); NumDialog = OPC_Return_NumDialog(zone1); SetWindowPos(Dialog[NumDialog].TabCoordWin[Ival].hWnd, (HWND) NULL, d, c, b,a,\ SWP_NOZORDER | SWP_DRAWFRAME ); //TRACEEU(" CodeExeSETWinPos : %s Ival:%d %X a %d b %d c %d d %d",\ // zone1,Ival, Dialog[NumDialog].TabCoordWin[Ival].hWnd, a,b,c,d); OPC_Depile_All(); break; case CodeExeSETDisplayPos : OPCF_Pile_Depile( P_INTEGER,(void *)&a); OPCF_Pile_Depile( P_INTEGER,(void *)&b); OPCF_Pile_Depile( P_INTEGER,(void *)&c); OPCF_Pile_Depile( P_INTEGER,(void *)&d); OPCF_Pile_Depile( P_INTEGER, (void *)&Ival ) ; OPC_Depile_All(); if(!HwndTGDEndUser4gl ) { CreateWinDisplay( ); printfGD("\0", 0); } SetWindowPos(HwndTGDEndUser4gl, (HWND) NULL, d, c, b,a,\ SWP_NOZORDER | SWP_DRAWFRAME ); // printfEU(" CodeExeSETDisplayPos : %X a %d b %d c %d d %d",\ HwndTGDEndUser4gl, a,b,c,d); OPC_Depile_All(); break; case CodeExeGetMessage : while( GetMessage( &msg, NULL, 0, 0) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); eu.hwnd = msg.hwnd; eu.wParam = msg.wParam; eu.message = msg.message; eu.pt.x = msg.pt.x ; eu.pt.y = msg.pt.y ; // // printfEU("GETMESSAGE Message BEFORE : hwnd : %d Wparam : %d Message : %d souri : %d %d",\ msg.hwnd,msg.wParam,msg.message,msg.pt.x ,msg.pt.y ); } return 0; default : return EUError;//return EU_Error_Code_Exe(OPCcodeExe); /* execute.c */ } OPC_Depile_All(); return 0; } EU_Windows_Style(HWND hWnd) { long Lval; Lval = SetWindowLong(hWnd, GWL_STYLE ,(long) WS_CHILD | WS_VISIBLE | WS_TABSTOP); } int OPC_Update_TableSymboleGetWinTxt(char *nom, int NumDial, int NumWin,int x) { int i, ReturnLocal =0 ; OPCt_dictGlobalChar *GdictChar = 0 ; OPCt_dictLocalChar *LdictChar = 0 ; OPC_Depile_All() ; LdictChar = OPCF_str_dict_lectLocalChar(nom); if(LdictChar) { if(LdictChar->typeconst ==1)return EUError; if(LdictChar->DCalloc == FALSE) { LdictChar->ValAlphNum =(LPSTR FAR ) calloc( LdictChar->longueur +1 ,sizeof(char *)) ; LdictChar->DCalloc = TRUE ; //printfEU("TRUE ok %s %d",nom,LdictChar->longueur ); } memcpy(LdictChar->ValAlphNum,"\0",LdictChar->longueur+1); if( x > LdictChar->longueur) x=LdictChar->longueur; GetWindowText( Dialog[NumDial].TabCoordWin[NumWin].hWnd,\ (PSTR ) GdictChar->ValAlphNum, x+1); if(GlobalReturnActif) OPC_Aliment_Table_Returning(nom) ; return 0 ; } else { // printfEU("nom %s ",nom ); GdictChar = OPCF_str_dict_lectGlobalChar(nom); if(GdictChar) { if(GdictChar->typeconst ==1)return EUError; extern VOID *MyCalloc(INT cbAlloc); if(GdictChar->DCalloc == FALSE) { GdictChar->ValAlphNum = (LPSTR FAR )calloc((GdictChar->longueur +1 ),sizeof(char)) ; GdictChar->DCalloc = TRUE ; } memcpy(GdictChar->ValAlphNum,"\0",GdictChar->longueur+1); if( x > GdictChar->longueur) x=GdictChar->longueur; i =strlen(GdictChar->ValAlphNum); i= GetWindowText( Dialog[NumDial].TabCoordWin[NumWin].hWnd,\ (PSTR ) GdictChar->ValAlphNum, x+1); // printfEU("i %d x %d Nouvelle Valeur: nom %s valeur : %s ",i,x,nom, GdictChar->ValAlphNum); if(GlobalReturnActif) OPC_Aliment_Table_Returning(nom) ; return 0 ; } return EUError ; } return EUError ; }; void DrawRectangle2 (HWND hwnd,int cxClient,int cyClient ) { HBRUSH hBrush ; HDC hdc ; RECT rect ; if (cxClient == 0 || cyClient == 0) return ; SetRect (&rect, rand () % cxClient, rand () % cyClient, rand () % cxClient, rand () % cyClient) ; hBrush = CreateSolidBrush (RGB (rand () % 256, rand () % 256, rand () % 256)) ; hdc = GetDC (hwnd) ; FillRect (hdc, &rect, hBrush) ; ReleaseDC (hwnd, hdc) ; DeleteObject (hBrush) ; } VOID CALLBACK TimerProc (HWND hwnd, UINT iMsg, UINT iTimerID, DWORD dwTime) { static BOOL fFlipFlop = FALSE ; HBRUSH hBrush ; HDC hdc ; RECT rc ; MessageBeep (0) ; fFlipFlop = !fFlipFlop ; GetClientRect (hwnd, &rc) ; hdc = GetDC (hwnd) ; hBrush = CreateSolidBrush (fFlipFlop ? RGB(255,0,0) : RGB(0,0,255)) ; FillRect (hdc, &rc, hBrush) ; ReleaseDC (hwnd, hdc) ; DeleteObject (hBrush) ; }