Changeset 500 in dev for trunk/ab5.0/abdev/abdev/src
- Timestamp:
- Apr 23, 2008, 1:57:14 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/abdev/src/MainFrame.cpp
r499 r500 746 746 DlgOptionSetting( m_hWnd ); 747 747 } 748 749 void CreateProcessWithStdHandle( const std::string &appPath, const std::string &cmdLine) 750 { 751 std::string argsStr = (std::string)"\"" + appPath + "\" " + cmdLine; 752 STARTUPINFO si; 753 PROCESS_INFORMATION pi; 754 memset(&si,0,sizeof(STARTUPINFO)); 755 si.cb=sizeof(STARTUPINFO); 756 si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; 757 si.wShowWindow = SW_HIDE; 758 si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); 759 si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); 760 si.hStdError = GetStdHandle(STD_ERROR_HANDLE); 761 762 char args[8192]; 763 lstrcpy( args, argsStr.c_str() ); 764 765 CreateProcess( NULL, args, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi ); 766 } 767 768 void MainFrame::OnCmdDebug( UINT uNotifyCode, int nID, CWindow wndCtl ) 769 { 770 char temporary[1024], temp2[1024], temp3[1024]; 771 if(pobj_Debugger->IsDebugging()){ 772 pobj_Debugger->DebugContinue(); 773 return; 774 } 775 776 HWND hChild = ::GetWindow(hClient,GW_CHILD); 777 if(ProjectInfo.name[0]){ 778 //プロジェクトが開かれている場合 779 if(!SetProjectToRun()) return; 780 781 //デバッグ用のコマンドライン及び実行可能ファイル(DLLのみ) 782 sprintf(temporary,"%s\r\n%s",ProjectInfo.szExePath,ProjectInfo.szCmdLine); 783 sprintf(temp2,"%spgm.tmp",pj_editor_Dir); 784 HANDLE hFile=CreateFile(temp2,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_TEMPORARY,NULL); 785 DWORD dwAccessBytes; 786 WriteFile(hFile,temporary,lstrlen(temporary),&dwAccessBytes,NULL); 787 CloseHandle(hFile); 788 789 //ソースファイル名をtemp2へ 790 ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2); 791 792 //出力ファイル名をtemp3へ 793 lstrcpy(temp3,ProjectInfo.lpszOutput_Debug); 794 GetFullPath(temp3,ProjectInfo.dir); 795 796 if(IsNeedCompileForProject(1)) 797 sprintf(temporary,"\"%s\" \"%s\" /debug /run /wnd:%08x",temp2,temp3,m_hWnd); 798 else 799 sprintf(temporary,"\"%s\" \"%s\" /run /wnd:%08x",temp2,temp3,m_hWnd); 800 801 //DLLオプション 802 if(ProjectInfo.dwModuleType==MT_DLL) lstrcat(temporary," /dll"); 803 804 //Unicodeオプション 805 if(ProjectInfo.dwOption & PJ_OP_UNICODE) lstrcat(temporary," /unicode"); 806 807 //ブレークポイントをセーブ 808 ProjectInfo.pobj_DBBreakPoint->SaveToTempFile(); 809 } 810 else{ 811 //単独ソースコード 812 if(!SetRunning(hChild)) return; 813 if(IsNeedCompile(MdiInfo[GetWndNum(hChild)].path,1)) 814 sprintf(temporary,"\"%s\" /debug /run /wnd:%08x",MdiInfo[GetWndNum(hChild)].path,m_hWnd); 815 else 816 sprintf(temporary,"\"%s\" /run /wnd:%08x",MdiInfo[GetWndNum(hChild)].path,m_hWnd); 817 818 //ブレークポイントをセーブ 819 extern CDBBreakPoint *pobj_DBBreakPoint; 820 pobj_DBBreakPoint->SaveToTempFile(); 821 } 822 823 //コンパイルビューをクリップするかどうか 824 extern BOOL bClipCompileView; 825 if(bClipCompileView){ 826 lstrcat(temporary," /clip_compile_view"); 827 828 //コンパイラビューを閉じる 829 extern HWND hCompileView; 830 if(hCompileView==(HWND)-1) return; 831 if(hCompileView){ 832 hChild=hCompileView; 833 hCompileView=(HWND)-1; 834 SendMessage(hChild,WM_COMMAND,IDCANCEL,0); 835 } 836 837 //重複起動防止のため 838 hCompileView=(HWND)-1; 839 } 840 841 //インクルードディレクトリ 842 sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); 843 lstrcat(temporary,temp2); 844 845 extern ActiveBasic::Common::Platform::EnumType selectingPlatform; 846 CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( selectingPlatform ), temporary ); 847 } 848 849 void MainFrame::OnCmdDebugCompile( UINT uNotifyCode, int nID, CWindow wndCtl ) 850 { 851 char temporary[1024], temp2[1024], temp3[1024]; 852 853 HWND hChild=::GetWindow(hClient,GW_CHILD); 854 if(ProjectInfo.name[0]){ 855 //プロジェクトが開かれている場合 856 if(!SetProjectToRun()) return; 857 858 //ソースファイル名をtemp2へ 859 ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2); 860 861 //出力ファイル名をtemp3へ 862 lstrcpy(temp3,ProjectInfo.lpszOutput_Debug); 863 GetFullPath(temp3,ProjectInfo.dir); 864 865 sprintf(temporary,"\"%s\" \"%s\" /debug /wnd:%08x",temp2,temp3,m_hWnd); 866 867 //DLLオプション 868 if(ProjectInfo.dwModuleType==MT_DLL) lstrcat(temporary," /dll"); 869 870 //Unicodeオプション 871 if(ProjectInfo.dwOption & PJ_OP_UNICODE) lstrcat(temporary," /unicode"); 872 } 873 else{ 874 //単独ソースコード 875 if(!SetRunning(hChild)) return; 876 sprintf(temporary,"\"%s\" /debug /wnd:%08x",MdiInfo[GetWndNum(hChild)].path,m_hWnd); 877 } 878 879 //コンパイルビューをクリップするかどうか 880 extern BOOL bClipCompileView; 881 if(bClipCompileView){ 882 lstrcat(temporary," /clip_compile_view"); 883 884 //コンパイラビューを閉じる 885 extern HWND hCompileView; 886 if(hCompileView==(HWND)-1) return; 887 if(hCompileView){ 888 hChild=hCompileView; 889 hCompileView=(HWND)-1; 890 SendMessage(hChild,WM_COMMAND,IDCANCEL,0); 891 } 892 893 //重複起動防止のため 894 hCompileView=(HWND)-1; 895 } 896 897 //インクルードディレクトリ 898 sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); 899 lstrcat(temporary,temp2); 900 901 extern ActiveBasic::Common::Platform::EnumType selectingPlatform; 902 CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( selectingPlatform ), temporary ); 903 904 } 905 906 void MainFrame::OnCmdAttach( UINT uNotifyCode, int nID, CWindow wndCtl ) 907 { 908 char temporary[1024], temp2[1024]; 909 910 int idProcess; 911 DWORD dwPlatform; 912 idProcess=DialogBoxParam(hResInst,MAKEINTRESOURCE(IDD_ATTACH),m_hWnd,(DLGPROC)DlgAttach,(LPARAM)&dwPlatform); 913 if(idProcess==0) return; 914 915 sprintf(temporary,"/attach:%08x /wnd:%08x",idProcess,m_hWnd); 916 917 //コンパイルビューをクリップするかどうか 918 extern BOOL bClipCompileView; 919 if(bClipCompileView){ 920 lstrcat(temporary," /clip_compile_view"); 921 922 //コンパイラビューを閉じる 923 extern HWND hCompileView; 924 if(hCompileView==(HWND)-1) return; 925 if(hCompileView){ 926 HWND hChild=hCompileView; 927 hCompileView=(HWND)-1; 928 SendMessage(hChild,WM_COMMAND,IDCANCEL,0); 929 } 930 931 //重複起動防止のため 932 hCompileView=(HWND)-1; 933 } 934 935 //インクルードディレクトリ 936 sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); 937 lstrcat(temporary,temp2); 938 939 ActiveBasic::Common::Platform::EnumType platform; 940 if(dwPlatform==IMAGE_FILE_MACHINE_I386) 941 { 942 platform = ActiveBasic::Common::Platform::X86; 943 } 944 else if(dwPlatform==IMAGE_FILE_MACHINE_AMD64) 945 { 946 platform = ActiveBasic::Common::Platform::X64; 947 } 948 else 949 { 950 throw; 951 } 952 953 extern ActiveBasic::Common::Platform::EnumType selectingPlatform; 954 CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( platform ), temporary ); 955 } 956 957 void MainFrame::OnCmdReleaseCompile( UINT uNotifyCode, int nID, CWindow wndCtl ) 958 { 959 char temporary[1024], temp2[1024], temp3[1024]; 960 961 HWND hChild=::GetWindow(hClient,GW_CHILD); 962 if(ProjectInfo.name[0]){ 963 //プロジェクトが開かれている場合 964 if(!SetProjectToRun()) return; 965 966 //ソースファイル名をtemp2へ 967 ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2); 968 969 //出力ファイル名をtemp3へ 970 lstrcpy(temp3,ProjectInfo.lpszOutput_Release); 971 GetFullPath(temp3,ProjectInfo.dir); 972 973 sprintf(temporary,"\"%s\" \"%s\" /wnd:%08x",temp2,temp3,m_hWnd); 974 975 //DLLオプション 976 if(ProjectInfo.dwModuleType==MT_DLL) lstrcat(temporary," /dll"); 977 978 //Unicodeオプション 979 if(ProjectInfo.dwOption & PJ_OP_UNICODE) lstrcat(temporary," /unicode"); 980 } 981 else{ 982 //単独ソースコード 983 if(!SetRunning(hChild)) return; 984 sprintf(temporary,"\"%s\" /wnd:%08x",MdiInfo[GetWndNum(hChild)].path,m_hWnd); 985 } 986 987 //コンパイルビューをクリップするかどうか 988 extern BOOL bClipCompileView; 989 if(bClipCompileView){ 990 lstrcat(temporary," /clip_compile_view"); 991 992 //コンパイラビューを閉じる 993 extern HWND hCompileView; 994 if(hCompileView==(HWND)-1) return; 995 if(hCompileView){ 996 hChild=hCompileView; 997 hCompileView=(HWND)-1; 998 SendMessage(hChild,WM_COMMAND,IDCANCEL,0); 999 } 1000 1001 //重複起動防止のため 1002 hCompileView=(HWND)-1; 1003 } 1004 1005 //インクルードディレクトリ 1006 sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); 1007 lstrcat(temporary,temp2); 1008 1009 extern ActiveBasic::Common::Platform::EnumType selectingPlatform; 1010 CreateProcessWithStdHandle( ActiveBasic::Common::Environment::GetCompilerExePath( selectingPlatform ), temporary ); 1011 } 1012 1013 void MainFrame::OnCmdReleaseRun( UINT uNotifyCode, int nID, CWindow wndCtl ) 1014 { 1015 char temporary[1024], temp2[1024], temp3[1024]; 1016 1017 HWND hChild=::GetWindow(hClient,GW_CHILD); 1018 if(ProjectInfo.name[0]){ 1019 /* //プロジェクトが開かれている場合 1020 if(!SetProjectToRun()) return; 1021 1022 //必要であればリリースコンパイル 1023 if(IsNeedCompileForProject(0)) 1024 SendMessage(WM_COMMAND,IDM_RELEASECOMPILE,0);*/ 1025 1026 if(ProjectInfo.dwModuleType==MT_DLL){ 1027 lstrcpy(temporary,ProjectInfo.szExePath); 1028 } 1029 else{ 1030 lstrcpy(temporary,ProjectInfo.lpszOutput_Debug); 1031 GetFullPath(temporary,ProjectInfo.dir); 1032 } 1033 } 1034 else{ 1035 /* //必要であればリリースコンパイル 1036 if(!SetRunning(hChild)) return; 1037 1038 if(IsNeedCompile(MdiInfo[GetWndNum(hChild)].path,0)) 1039 SendMessage(WM_COMMAND,IDM_RELEASECOMPILE,0);*/ 1040 1041 //単独ソースコード 1042 _splitpath(MdiInfo[GetWndNum(hChild)].path,temporary,temp2,temp3,NULL); 1043 lstrcat(temporary,temp2); 1044 lstrcat(temporary,temp3); 1045 lstrcat(temporary,".exe"); 1046 } 1047 1048 //インクルードディレクトリ 1049 sprintf(temp2," /include_dir:\"%s\"",pobj_nv->GetIncludeDirFullPath().c_str()); 1050 lstrcat(temporary,temp2); 1051 1052 ShellExecute(m_hWnd,"open",temporary,NULL,NULL,SW_SHOWNORMAL); 1053 }
Note:
See TracChangeset
for help on using the changeset viewer.