| 1 | #include "Common.h" | 
|---|
| 2 |  | 
|---|
| 3 |  | 
|---|
| 4 | void ScreenToClient(HWND hwnd,RECT *pRect){ | 
|---|
| 5 | ScreenToClient(hwnd,(POINT *)pRect); | 
|---|
| 6 | ScreenToClient(hwnd,(POINT *)(((long)(void *)pRect)+sizeof(POINT))); | 
|---|
| 7 | } | 
|---|
| 8 | void ClientToScreen(HWND hwnd,RECT *pRect){ | 
|---|
| 9 | ClientToScreen(hwnd,(POINT *)pRect); | 
|---|
| 10 | ClientToScreen(hwnd,(POINT *)(((long)(void *)pRect)+sizeof(POINT))); | 
|---|
| 11 | } | 
|---|
| 12 |  | 
|---|
| 13 |  | 
|---|
| 14 | typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE hProcess,PBOOL Wow64Process); | 
|---|
| 15 | BOOL IsWow64(void){ | 
|---|
| 16 | /////////////////////////////////////////////////////////// | 
|---|
| 17 | // ProjectEditor.exeがWOW64技術で動作しているのかどうか | 
|---|
| 18 | /////////////////////////////////////////////////////////// | 
|---|
| 19 | BOOL bIsWow64 = FALSE; | 
|---|
| 20 | LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"),"IsWow64Process"); | 
|---|
| 21 |  | 
|---|
| 22 | if (NULL != fnIsWow64Process) | 
|---|
| 23 | { | 
|---|
| 24 | if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64)) | 
|---|
| 25 | { | 
|---|
| 26 | // handle error | 
|---|
| 27 | bIsWow64 = FALSE; | 
|---|
| 28 | } | 
|---|
| 29 | } | 
|---|
| 30 | return bIsWow64; | 
|---|
| 31 | } | 
|---|
| 32 |  | 
|---|
| 33 | void URLEncode(LPSTR pszSrc){ | 
|---|
| 34 | char *temp; | 
|---|
| 35 | temp=(char *)malloc(65535); | 
|---|
| 36 |  | 
|---|
| 37 | int i,i2; | 
|---|
| 38 | for (i = 0,i2=0; ; i++,i2++) | 
|---|
| 39 | { | 
|---|
| 40 | if(pszSrc[i]=='\0'){ | 
|---|
| 41 | temp[i2] = 0; | 
|---|
| 42 | break; | 
|---|
| 43 | } | 
|---|
| 44 |  | 
|---|
| 45 | // 英数字 _ . - は変換しないでそのまま | 
|---|
| 46 | if (isalnum((BYTE)pszSrc[i]) || pszSrc[i] == '_' || pszSrc[i] == '.' || pszSrc[i] == '-'){ | 
|---|
| 47 | temp[i2] = pszSrc[i]; | 
|---|
| 48 | } | 
|---|
| 49 | // それ以外は %3B のような形式に変換 | 
|---|
| 50 | else{ | 
|---|
| 51 | sprintf(temp+i2,"%%%02X", (BYTE)pszSrc[i]); | 
|---|
| 52 | i2+=lstrlen(temp+i2); | 
|---|
| 53 | i2--; | 
|---|
| 54 | } | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | lstrcpy(pszSrc,temp); | 
|---|
| 58 | free(temp); | 
|---|
| 59 | } | 
|---|
| 60 |  | 
|---|
| 61 | void Digit(int num,char *buffer){ | 
|---|
| 62 | char temporary[255]; | 
|---|
| 63 | int i,iPos; | 
|---|
| 64 |  | 
|---|
| 65 | sprintf(temporary,"%d",abs(num)); | 
|---|
| 66 |  | 
|---|
| 67 | //カンマが不要の場合は抜ける | 
|---|
| 68 | if(lstrlen(temporary)<=3){ | 
|---|
| 69 | wsprintf(buffer,"%d",num); | 
|---|
| 70 | return; | 
|---|
| 71 | } | 
|---|
| 72 |  | 
|---|
| 73 | //合計の文字数からバッファを確保 | 
|---|
| 74 | if(num<0){ | 
|---|
| 75 | buffer[0]='-'; | 
|---|
| 76 | iPos=1; | 
|---|
| 77 | } | 
|---|
| 78 | else{ | 
|---|
| 79 | buffer[0]=0; | 
|---|
| 80 | iPos=0; | 
|---|
| 81 | } | 
|---|
| 82 |  | 
|---|
| 83 | //3桁毎にカンマを加えながら文字列をコピーする | 
|---|
| 84 | int iFirst; | 
|---|
| 85 | iFirst=lstrlen(temporary)%3; | 
|---|
| 86 | if(iFirst==0) iFirst=3; | 
|---|
| 87 | memcpy(buffer+iPos,temporary,iFirst); | 
|---|
| 88 | iPos+=iFirst; | 
|---|
| 89 |  | 
|---|
| 90 | int i2; | 
|---|
| 91 | i2=(lstrlen(temporary)-4)/3; | 
|---|
| 92 |  | 
|---|
| 93 | for(i=0;i<=i2;i++){ | 
|---|
| 94 | buffer[iPos]=','; | 
|---|
| 95 | iPos++; | 
|---|
| 96 | memcpy(buffer+iPos,temporary+i*3+iFirst,3); | 
|---|
| 97 | iPos+=3; | 
|---|
| 98 | buffer[iPos]=0; | 
|---|
| 99 | } | 
|---|
| 100 | } | 
|---|
| 101 |  | 
|---|
| 102 | void RectNaturalFormat(RECT *ReadRect,RECT *CopyRect){ | 
|---|
| 103 | if(ReadRect->left > ReadRect->right){ | 
|---|
| 104 | CopyRect->left=ReadRect->right; | 
|---|
| 105 | CopyRect->right=ReadRect->left; | 
|---|
| 106 | } | 
|---|
| 107 | else{ | 
|---|
| 108 | CopyRect->left=ReadRect->left; | 
|---|
| 109 | CopyRect->right=ReadRect->right; | 
|---|
| 110 | } | 
|---|
| 111 | if(ReadRect->top > ReadRect->bottom){ | 
|---|
| 112 | CopyRect->top=ReadRect->bottom; | 
|---|
| 113 | CopyRect->bottom=ReadRect->top; | 
|---|
| 114 | } | 
|---|
| 115 | else{ | 
|---|
| 116 | CopyRect->top=ReadRect->top; | 
|---|
| 117 | CopyRect->bottom=ReadRect->bottom; | 
|---|
| 118 | } | 
|---|
| 119 | } | 
|---|
| 120 | void RectNaturalFormat(int *x1,int *y1,int *x2,int *y2){ | 
|---|
| 121 | int temp; | 
|---|
| 122 | if(*x1>*x2){ | 
|---|
| 123 | temp=*x1; | 
|---|
| 124 | *x1=*x2; | 
|---|
| 125 | *x2=temp; | 
|---|
| 126 | } | 
|---|
| 127 | if(*y1>*y2){ | 
|---|
| 128 | temp=*y1; | 
|---|
| 129 | *y1=*y2; | 
|---|
| 130 | *y2=temp; | 
|---|
| 131 | } | 
|---|
| 132 | } | 
|---|
| 133 | void KillSpaces(char *str1,char *str2){ | 
|---|
| 134 | int i,i2,IsStr; | 
|---|
| 135 | for(i=0,i2=0,IsStr=0;;i++,i2++){ | 
|---|
| 136 | while((str1[i]==' '||str1[i]=='\t')&&IsStr==0&&str1[i]!='\0') i++; | 
|---|
| 137 | if(str1[i]=='\"') IsStr^=1; | 
|---|
| 138 | str2[i2]=str1[i]; | 
|---|
| 139 | if(str1[i]=='\0') break; | 
|---|
| 140 | } | 
|---|
| 141 | } | 
|---|
| 142 | void RemoveStringQuotes(char *str){ | 
|---|
| 143 | int i; | 
|---|
| 144 | if(str[0]!='\"') return; | 
|---|
| 145 | for(i=0;;i++){ | 
|---|
| 146 | str[i]=str[i+1]; | 
|---|
| 147 | if(str[i]=='\"') break; | 
|---|
| 148 | } | 
|---|
| 149 | str[i]=0; | 
|---|
| 150 | } | 
|---|
| 151 | void SlideString(char *buffer, int slide){ | 
|---|
| 152 | char *temp; | 
|---|
| 153 | temp=(char *)malloc(lstrlen(buffer)+1); | 
|---|
| 154 | lstrcpy(temp,buffer); | 
|---|
| 155 | lstrcpy(buffer+slide,temp); | 
|---|
| 156 | free(temp); | 
|---|
| 157 | } | 
|---|
| 158 | void SlideBuffer(char *buffer,int length,int slide){ | 
|---|
| 159 | void *temp; | 
|---|
| 160 | temp=malloc(length+1); | 
|---|
| 161 | memcpy(temp,buffer,length); | 
|---|
| 162 | memcpy(buffer+slide,temp,length); | 
|---|
| 163 | free(temp); | 
|---|
| 164 | } | 
|---|
| 165 | BOOL IsVariableTopChar(char c){ | 
|---|
| 166 | if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||c=='_') return 1; | 
|---|
| 167 | return 0; | 
|---|
| 168 | } | 
|---|
| 169 | BOOL IsVariableChar(char c){ | 
|---|
| 170 | if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||(c>='0'&&c<='9')|| | 
|---|
| 171 | c=='_'||c=='.'||c=='$') return 1; | 
|---|
| 172 | return 0; | 
|---|
| 173 | } | 
|---|
| 174 |  | 
|---|
| 175 | BOOL IsCommandBackDelimitation(char *buffer,int pos){ | 
|---|
| 176 | if(buffer[pos]=='\n'||buffer[pos]==':') return 1; | 
|---|
| 177 | return 0; | 
|---|
| 178 | } | 
|---|
| 179 | BOOL IsCommandDelimitation(char *buffer,int p){ | 
|---|
| 180 | if(buffer[p]=='\r'&&buffer[p+1]=='\n') return 2; | 
|---|
| 181 | if(buffer[p]=='\n'||buffer[p]==':'||buffer[p]=='\0') return 1; | 
|---|
| 182 | return 0; | 
|---|
| 183 | } | 
|---|
| 184 |  | 
|---|
| 185 | char *ComparisonString(char *str1,char *str2,BOOL bBigSmall){ | 
|---|
| 186 | int i,i2,i3,len1,len2; | 
|---|
| 187 | len1=lstrlen(str1); | 
|---|
| 188 | len2=lstrlen(str2); | 
|---|
| 189 | for(i=0;i<len1-len2+1;i++){ | 
|---|
| 190 | for(i2=0,i3=i;i2<len2;i2++,i3++){ | 
|---|
| 191 | if(bBigSmall){ | 
|---|
| 192 | if(str1[i3]!=str2[i2]) break; | 
|---|
| 193 | } | 
|---|
| 194 | else{ | 
|---|
| 195 | if((char)CharUpper((LPTSTR)MAKELONG(str1[i3],0))!=(char)CharUpper((LPTSTR)MAKELONG(str2[i2],0))) break; | 
|---|
| 196 | } | 
|---|
| 197 | } | 
|---|
| 198 | if(IsDBCSLeadByte(str1[i])) i++; | 
|---|
| 199 | if(i2==len2) return str1+i3-i2; | 
|---|
| 200 | } | 
|---|
| 201 | return 0; | 
|---|
| 202 | } | 
|---|
| 203 | int GetOneParameter(char *Parameter,int pos,char *retAns){ | 
|---|
| 204 | int i,i2,IsStr,PareNum; | 
|---|
| 205 | for(i=pos,i2=0,IsStr=0,PareNum=0;;i++,i2++){ | 
|---|
| 206 | if(IsDBCSLeadByte(Parameter[i])){ | 
|---|
| 207 | retAns[i2]=Parameter[i]; | 
|---|
| 208 | retAns[++i2]=Parameter[++i]; | 
|---|
| 209 | continue; | 
|---|
| 210 | } | 
|---|
| 211 | if(Parameter[i]=='\"') IsStr^=1; | 
|---|
| 212 | if(Parameter[i]=='('&&IsStr==0) PareNum++; | 
|---|
| 213 | if(Parameter[i]==')'&&IsStr==0) PareNum--; | 
|---|
| 214 | if(Parameter[i]==','&&IsStr==0&&PareNum==0){ | 
|---|
| 215 | retAns[i2]=0; | 
|---|
| 216 | break; | 
|---|
| 217 | } | 
|---|
| 218 | retAns[i2]=Parameter[i]; | 
|---|
| 219 | if(Parameter[i]=='\0'||Parameter[i]=='\r'&&Parameter[i+1]=='\n'){ | 
|---|
| 220 | retAns[i2]=0; | 
|---|
| 221 | break; | 
|---|
| 222 | } | 
|---|
| 223 | } | 
|---|
| 224 | if(Parameter[i]==',') i++; | 
|---|
| 225 | return i; | 
|---|
| 226 | } | 
|---|
| 227 | int GetStringInPare(char *buffer,char *ReadBuffer){ | 
|---|
| 228 | int i,IsStr,PareNum; | 
|---|
| 229 | for(i=0,IsStr=0,PareNum=0;;i++){ | 
|---|
| 230 | buffer[i]=ReadBuffer[i]; | 
|---|
| 231 | if(ReadBuffer[i]=='\"') IsStr^=1; | 
|---|
| 232 | else if(ReadBuffer[i]=='('&&IsStr==0) PareNum++; | 
|---|
| 233 | else if(ReadBuffer[i]==')'&&IsStr==0){ | 
|---|
| 234 | PareNum--; | 
|---|
| 235 | if(PareNum==0){ | 
|---|
| 236 | i++; | 
|---|
| 237 | buffer[i]=0; | 
|---|
| 238 | break; | 
|---|
| 239 | } | 
|---|
| 240 | } | 
|---|
| 241 | else if(ReadBuffer[i]=='\0') return 0; | 
|---|
| 242 | } | 
|---|
| 243 | return i; | 
|---|
| 244 | } | 
|---|
| 245 | int GetStringInBracket(char *buffer,char *ReadBuffer){ | 
|---|
| 246 | int i,IsStr,PareNum; | 
|---|
| 247 | for(i=0,IsStr=0,PareNum=0;;i++){ | 
|---|
| 248 | buffer[i]=ReadBuffer[i]; | 
|---|
| 249 | if(IsDBCSLeadByte(ReadBuffer[i])){ | 
|---|
| 250 | i++; | 
|---|
| 251 | buffer[i]=ReadBuffer[i]; | 
|---|
| 252 | continue; | 
|---|
| 253 | } | 
|---|
| 254 | if(ReadBuffer[i]=='\"') IsStr^=1; | 
|---|
| 255 | else if(ReadBuffer[i]=='['&&IsStr==0) PareNum++; | 
|---|
| 256 | else if(ReadBuffer[i]==']'&&IsStr==0){ | 
|---|
| 257 | PareNum--; | 
|---|
| 258 | if(PareNum==0){ | 
|---|
| 259 | i++; | 
|---|
| 260 | buffer[i]=0; | 
|---|
| 261 | break; | 
|---|
| 262 | } | 
|---|
| 263 | } | 
|---|
| 264 | else if(ReadBuffer[i]=='\0') return 0; | 
|---|
| 265 | } | 
|---|
| 266 | return i; | 
|---|
| 267 | } | 
|---|
| 268 | void JumpBlank(char *pBuf,int *piPos){ | 
|---|
| 269 | int i; | 
|---|
| 270 | i=*piPos; | 
|---|
| 271 |  | 
|---|
| 272 | while(1){ | 
|---|
| 273 | while(pBuf[i]==' '||pBuf[i]=='\t') i++; | 
|---|
| 274 | if(pBuf[i]=='\0') break; | 
|---|
| 275 | if(pBuf[i]=='\''){ | 
|---|
| 276 | //注釈文(一行) | 
|---|
| 277 | for(i++;;i++){ | 
|---|
| 278 | if(pBuf[i]=='\0') break; | 
|---|
| 279 | if(pBuf[i]=='\r'&&pBuf[i+1]=='\n'){ | 
|---|
| 280 | i+=2; | 
|---|
| 281 | break; | 
|---|
| 282 | } | 
|---|
| 283 | } | 
|---|
| 284 | while(pBuf[i]==' '||pBuf[i]=='\t') i++; | 
|---|
| 285 | } | 
|---|
| 286 | if(pBuf[i]=='/'&&pBuf[i+1]=='*'){ | 
|---|
| 287 | //注釈文(複数行) | 
|---|
| 288 | i+=2; | 
|---|
| 289 | while(!(pBuf[i]=='*'&&pBuf[i+1]=='/')){ | 
|---|
| 290 | i++; | 
|---|
| 291 | if(pBuf[i]=='\0') break; | 
|---|
| 292 | } | 
|---|
| 293 | if(pBuf[i]){ | 
|---|
| 294 | i+=2; | 
|---|
| 295 | } | 
|---|
| 296 | } | 
|---|
| 297 | while(pBuf[i]=='\r'&&pBuf[i+1]=='\n') i+=2; | 
|---|
| 298 |  | 
|---|
| 299 | if(!( | 
|---|
| 300 | pBuf[i]==' '|| | 
|---|
| 301 | pBuf[i]=='\t'|| | 
|---|
| 302 | pBuf[i]=='\''|| | 
|---|
| 303 | (pBuf[i]=='/'&&pBuf[i+1]=='*') | 
|---|
| 304 | )) break; | 
|---|
| 305 | } | 
|---|
| 306 |  | 
|---|
| 307 | *piPos=i; | 
|---|
| 308 | } | 
|---|
| 309 |  | 
|---|
| 310 | BOOL CheckParenthesis(char *buffer){ | 
|---|
| 311 | int i,IsStr,PareNum,sw; | 
|---|
| 312 | _int8 bracket[1024]; | 
|---|
| 313 |  | 
|---|
| 314 | for(i=0,IsStr=0,PareNum=0,sw=0;;i++){ | 
|---|
| 315 | if(buffer[i]=='\"'){ | 
|---|
| 316 | IsStr^=1; | 
|---|
| 317 | continue; | 
|---|
| 318 | } | 
|---|
| 319 |  | 
|---|
| 320 | else if(buffer[i]=='('&&IsStr==0){ | 
|---|
| 321 | bracket[PareNum]=0; | 
|---|
| 322 | PareNum++; | 
|---|
| 323 | } | 
|---|
| 324 | else if(buffer[i]=='['&&IsStr==0){ | 
|---|
| 325 | bracket[PareNum]=1; | 
|---|
| 326 | PareNum++; | 
|---|
| 327 | } | 
|---|
| 328 |  | 
|---|
| 329 | else if(buffer[i]==')'&&IsStr==0){ | 
|---|
| 330 | PareNum--; | 
|---|
| 331 | if(bracket[PareNum]!=0||PareNum<0){ | 
|---|
| 332 | //"カッコ \'( )\'" | 
|---|
| 333 | return 0; | 
|---|
| 334 | } | 
|---|
| 335 | } | 
|---|
| 336 | else if(buffer[i]==']'&&IsStr==0){ | 
|---|
| 337 | PareNum--; | 
|---|
| 338 | if(bracket[PareNum]!=1||PareNum<0){ | 
|---|
| 339 | //"カッコ \'( )\'" | 
|---|
| 340 | return 0; | 
|---|
| 341 | } | 
|---|
| 342 | } | 
|---|
| 343 |  | 
|---|
| 344 | else if(buffer[i]=='\n'||buffer[i]=='\0'){ | 
|---|
| 345 |  | 
|---|
| 346 | //"カッコ \'( )\'" | 
|---|
| 347 | if(buffer[i]=='\0'){ | 
|---|
| 348 | if(PareNum!=0){ | 
|---|
| 349 | return 0; | 
|---|
| 350 | } | 
|---|
| 351 |  | 
|---|
| 352 | if(IsStr!=0){ | 
|---|
| 353 | return 0; | 
|---|
| 354 | } | 
|---|
| 355 | } | 
|---|
| 356 | if(buffer[i]=='\0') break; | 
|---|
| 357 |  | 
|---|
| 358 | sw=0; | 
|---|
| 359 | } | 
|---|
| 360 | } | 
|---|
| 361 | return 1; | 
|---|
| 362 | } | 
|---|
| 363 |  | 
|---|
| 364 | DWORD GetValue(char *value){ | 
|---|
| 365 | unsigned long ans; | 
|---|
| 366 | if(value[0]=='&'){ | 
|---|
| 367 | if(value[1]=='o'||value[1]=='O') sscanf(value+2,"%o",&ans); | 
|---|
| 368 | if(value[1]=='h'||value[1]=='H') sscanf(value+2,"%x",&ans); | 
|---|
| 369 | } | 
|---|
| 370 | else ans=atol(value); | 
|---|
| 371 | return ans; | 
|---|
| 372 | } | 
|---|
| 373 | BOOL IsManagementCommand(int ComNum){ | 
|---|
| 374 | switch(ComNum){ | 
|---|
| 375 | case -1: | 
|---|
| 376 | case COM_ABSTRACT: | 
|---|
| 377 | case COM_CLASS: | 
|---|
| 378 | case COM_CONST: | 
|---|
| 379 | case COM_DEBUG: | 
|---|
| 380 | case COM_DECLARE: | 
|---|
| 381 | case COM_DEF: | 
|---|
| 382 | case COM_DIM: | 
|---|
| 383 | case COM_DO: | 
|---|
| 384 | case COM_END: | 
|---|
| 385 | case COM_ENUM: | 
|---|
| 386 | case COM_FOR: | 
|---|
| 387 | case COM_FUNCTION: | 
|---|
| 388 | case COM_GOSUB: | 
|---|
| 389 | case COM_GOTO: | 
|---|
| 390 | case COM_IF: | 
|---|
| 391 | case COM_INHERITS: | 
|---|
| 392 | case COM_INTERFACE: | 
|---|
| 393 | case COM_LOOP: | 
|---|
| 394 | case COM_NEXT: | 
|---|
| 395 | case COM_PRIVATE: | 
|---|
| 396 | case COM_PROTECTED: | 
|---|
| 397 | case COM_PUBLIC: | 
|---|
| 398 | case COM_RETURN: | 
|---|
| 399 | case COM_SELECT: | 
|---|
| 400 | case COM_SUB: | 
|---|
| 401 | case COM_TYPE: | 
|---|
| 402 | case COM_TYPEDEF: | 
|---|
| 403 | case COM_VIRTUAL: | 
|---|
| 404 | case COM_OVERRIDE: | 
|---|
| 405 | case COM_WEND: | 
|---|
| 406 | case COM_WHILE: | 
|---|
| 407 | case COM_WITH: | 
|---|
| 408 | return 1; | 
|---|
| 409 | default: | 
|---|
| 410 | break; | 
|---|
| 411 | } | 
|---|
| 412 | return 0; | 
|---|
| 413 | } | 
|---|
| 414 | int IsBasicReservedWord(char *str){ | 
|---|
| 415 | if(str[0]=='a'||str[0]=='A'){ | 
|---|
| 416 | if(lstrcmpi(str,"Abstract")==0) return COM_ABSTRACT; | 
|---|
| 417 | if(lstrcmpi(str,"As")==0) return -1; | 
|---|
| 418 | } | 
|---|
| 419 | else if(str[0]=='b'||str[0]=='B'){ | 
|---|
| 420 | if(lstrcmpi(str,"Beep")==0) return COM_BEEP; | 
|---|
| 421 | if(lstrcmpi(str,"Boolean")==0) return -1; | 
|---|
| 422 | if(lstrcmpi(str,"Byte")==0) return -1; | 
|---|
| 423 | } | 
|---|
| 424 | else if(str[0]=='c'||str[0]=='C'){ | 
|---|
| 425 | if(lstrcmpi(str,"Case")==0) return -1; | 
|---|
| 426 | if(lstrcmpi(str,"Char")==0) return -1; | 
|---|
| 427 | if(lstrcmpi(str,"ChDir")==0) return COM_CHDIR; | 
|---|
| 428 | if(lstrcmpi(str,"Circle")==0) return COM_CIRCLE; | 
|---|
| 429 | if(lstrcmpi(str,"Class")==0) return COM_CLASS; | 
|---|
| 430 | if(lstrcmpi(str,"Close")==0) return COM_CLOSE; | 
|---|
| 431 | if(lstrcmpi(str,"Cls")==0) return COM_CLS; | 
|---|
| 432 | if(lstrcmpi(str,"Color")==0) return COM_COLOR; | 
|---|
| 433 | if(lstrcmpi(str,"Const")==0) return COM_CONST; | 
|---|
| 434 | if(lstrcmpi(str,"Continue")==0) return -1; | 
|---|
| 435 | } | 
|---|
| 436 | else if(str[0]=='d'||str[0]=='D'){ | 
|---|
| 437 | if(lstrcmpi(str,"Debug")==0) return COM_DEBUG; | 
|---|
| 438 | if(lstrcmpi(str,"Declare")==0) return COM_DECLARE; | 
|---|
| 439 | if(lstrcmpi(str,"Def")==0) return COM_DEF; | 
|---|
| 440 | if(lstrcmpi(str,"Delete")==0) return -1; | 
|---|
| 441 | if(lstrcmpi(str,"DelWnd")==0) return COM_DELWND; | 
|---|
| 442 | if(lstrcmpi(str,"Dim")==0) return COM_DIM; | 
|---|
| 443 | if(lstrcmpi(str,"Do")==0) return COM_DO; | 
|---|
| 444 | if(lstrcmpi(str,"Double")==0) return -1; | 
|---|
| 445 | if(lstrcmpi(str,"DWord")==0) return -1; | 
|---|
| 446 | } | 
|---|
| 447 | else if(str[0]=='e'||str[0]=='E'){ | 
|---|
| 448 | if(lstrcmpi(str,"Else")==0) return -1; | 
|---|
| 449 | if(lstrcmpi(str,"ElseIf")==0) return -1; | 
|---|
| 450 | if(lstrcmpi(str,"End")==0) return COM_END; | 
|---|
| 451 | if(lstrcmpi(str,"EndIf")==0) return -1; | 
|---|
| 452 | if(lstrcmpi(str,"EndFunction")==0) return -1; | 
|---|
| 453 | if(lstrcmpi(str,"EndSub")==0) return -1; | 
|---|
| 454 | if(lstrcmpi(str,"EndType")==0) return -1; | 
|---|
| 455 | if(lstrcmpi(str,"EndSelect")==0) return -1; | 
|---|
| 456 | if(lstrcmpi(str,"EndWith")==0) return -1; | 
|---|
| 457 | if(lstrcmpi(str,"Enum")==0) return COM_ENUM; | 
|---|
| 458 | if(lstrcmpi(str,"Exit")==0) return -1; | 
|---|
| 459 | if(lstrcmpi(str,"ExitDo")==0) return -1; | 
|---|
| 460 | if(lstrcmpi(str,"ExitFor")==0) return -1; | 
|---|
| 461 | if(lstrcmpi(str,"ExitFunction")==0) return -1; | 
|---|
| 462 | if(lstrcmpi(str,"ExitSub")==0) return -1; | 
|---|
| 463 | if(lstrcmpi(str,"ExitWhile")==0) return -1; | 
|---|
| 464 | } | 
|---|
| 465 | else if(str[0]=='f'||str[0]=='F'){ | 
|---|
| 466 | if(lstrcmp(str,"False")==0) return -1; | 
|---|
| 467 | if(lstrcmpi(str,"Field")==0) return COM_FIELD; | 
|---|
| 468 | if(lstrcmpi(str,"For")==0) return COM_FOR; | 
|---|
| 469 | if(lstrcmpi(str,"Function")==0) return COM_FUNCTION; | 
|---|
| 470 | } | 
|---|
| 471 | else if(str[0]=='g'||str[0]=='G'){ | 
|---|
| 472 | if(lstrcmpi(str,"Get")==0) return COM_GET; | 
|---|
| 473 | if(lstrcmpi(str,"GoSub")==0) return COM_GOSUB; | 
|---|
| 474 | if(lstrcmpi(str,"Goto")==0) return COM_GOTO; | 
|---|
| 475 | } | 
|---|
| 476 | else if(str[0]=='i'||str[0]=='I'){ | 
|---|
| 477 | if(lstrcmpi(str,"If")==0) return COM_IF; | 
|---|
| 478 | if(lstrcmpi(str,"Inherits")==0) return COM_INHERITS; | 
|---|
| 479 | if(lstrcmpi(str,"Input")==0) return COM_INPUT; | 
|---|
| 480 | if(lstrcmpi(str,"Int64")==0) return -1; | 
|---|
| 481 | if(lstrcmpi(str,"Integer")==0) return -1; | 
|---|
| 482 | if(lstrcmpi(str,"Interface")==0) return COM_INTERFACE; | 
|---|
| 483 | } | 
|---|
| 484 | else if(str[0]=='k'||str[0]=='K'){ | 
|---|
| 485 | if(lstrcmpi(str,"Kill")==0) return COM_KILL; | 
|---|
| 486 | } | 
|---|
| 487 | else if(str[0]=='l'||str[0]=='L'){ | 
|---|
| 488 | if(lstrcmpi(str,"Let")==0) return COM_LET; | 
|---|
| 489 | if(lstrcmpi(str,"Line")==0) return COM_LINE; | 
|---|
| 490 | if(lstrcmpi(str,"Locate")==0) return COM_LOCATE; | 
|---|
| 491 | if(lstrcmpi(str,"Long")==0) return -1; | 
|---|
| 492 | if(lstrcmpi(str,"Loop")==0) return COM_LOOP; | 
|---|
| 493 | } | 
|---|
| 494 | else if(str[0]=='m'||str[0]=='M'){ | 
|---|
| 495 | if(lstrcmpi(str,"MkDir")==0) return COM_MKDIR; | 
|---|
| 496 | if(lstrcmpi(str,"MsgBox")==0) return COM_MSGBOX; | 
|---|
| 497 | } | 
|---|
| 498 | else if(str[0]=='n'||str[0]=='N'){ | 
|---|
| 499 | if(lstrcmpi(str,"Next")==0) return COM_NEXT; | 
|---|
| 500 | if(lstrcmpi(str,"New")==0) return -1; | 
|---|
| 501 | } | 
|---|
| 502 | else if(str[0]=='o'||str[0]=='O'){ | 
|---|
| 503 | if(lstrcmpi(str,"Open")==0) return COM_OPEN; | 
|---|
| 504 | if(lstrcmpi(str,"Override")==0) return COM_OVERRIDE; | 
|---|
| 505 | } | 
|---|
| 506 | else if(str[0]=='p'||str[0]=='P'){ | 
|---|
| 507 | if(lstrcmpi(str,"Paint")==0) return COM_PAINT; | 
|---|
| 508 | if(lstrcmpi(str,"Print")==0) return COM_PRINT; | 
|---|
| 509 | if(lstrcmpi(str,"Private")==0) return COM_PRIVATE; | 
|---|
| 510 | if(lstrcmpi(str,"Protected")==0) return COM_PROTECTED; | 
|---|
| 511 | if(lstrcmpi(str,"PSet")==0) return COM_PSET; | 
|---|
| 512 | if(lstrcmpi(str,"Put")==0) return COM_PUT; | 
|---|
| 513 | if(lstrcmpi(str,"Public")==0) return COM_PUBLIC; | 
|---|
| 514 | } | 
|---|
| 515 | else if(str[0]=='q'||str[0]=='Q'){ | 
|---|
| 516 | if(lstrcmpi(str,"QWord")==0) return -1; | 
|---|
| 517 | } | 
|---|
| 518 | else if(str[0]=='r'||str[0]=='R'){ | 
|---|
| 519 | if(lstrcmpi(str,"Randomize")==0) return COM_RANDOMIZE; | 
|---|
| 520 | if(lstrcmpi(str,"Rem")==0) return COM_REM; | 
|---|
| 521 | if(lstrcmpi(str,"Return")==0) return COM_RETURN; | 
|---|
| 522 | } | 
|---|
| 523 | else if(str[0]=='s'||str[0]=='S'){ | 
|---|
| 524 | if(lstrcmpi(str,"Select")==0) return COM_SELECT; | 
|---|
| 525 | if(lstrcmpi(str,"SelectCase")==0) return COM_SELECT; | 
|---|
| 526 | if(lstrcmpi(str,"Single")==0) return -1; | 
|---|
| 527 | if(lstrcmpi(str,"Sleep")==0) return COM_SLEEP; | 
|---|
| 528 | if(lstrcmpi(str,"Static")==0) return -1; | 
|---|
| 529 | if(lstrcmpi(str,"Sub")==0) return COM_SUB; | 
|---|
| 530 | if(lstrcmpi(str,"Super")==0) return -1; | 
|---|
| 531 | } | 
|---|
| 532 | else if(str[0]=='t'||str[0]=='T'){ | 
|---|
| 533 | if(lstrcmpi(str,"Then")==0) return -1; | 
|---|
| 534 | if(lstrcmp(str,"True")==0) return -1; | 
|---|
| 535 | if(lstrcmpi(str,"Type")==0) return COM_TYPE; | 
|---|
| 536 | if(lstrcmpi(str,"TypeDef")==0) return COM_TYPEDEF; | 
|---|
| 537 | } | 
|---|
| 538 | else if(str[0]=='u'||str[0]=='U'){ | 
|---|
| 539 | if(lstrcmpi(str,"Until")==0) return -1; | 
|---|
| 540 | } | 
|---|
| 541 | else if(str[0]=='v'||str[0]=='V'){ | 
|---|
| 542 | if(lstrcmpi(str,"Virtual")==0) return COM_VIRTUAL; | 
|---|
| 543 | } | 
|---|
| 544 | else if(str[0]=='w'||str[0]=='W'){ | 
|---|
| 545 | if(lstrcmpi(str,"Wend")==0) return COM_WEND; | 
|---|
| 546 | if(lstrcmpi(str,"While")==0) return COM_WHILE; | 
|---|
| 547 | if(lstrcmpi(str,"Window")==0) return COM_WINDOW; | 
|---|
| 548 | if(lstrcmpi(str,"With")==0) return COM_WITH; | 
|---|
| 549 | if(lstrcmpi(str,"Word")==0) return -1; | 
|---|
| 550 | if(lstrcmpi(str,"Write")==0) return COM_WRITE; | 
|---|
| 551 | } | 
|---|
| 552 | else if(str[0]=='#'){ | 
|---|
| 553 | if(lstrcmpi(str,"#include")==0) return -1; | 
|---|
| 554 | if(lstrcmpi(str,"#strict")==0) return -1; | 
|---|
| 555 | if(lstrcmpi(str,"#console")==0) return -1; | 
|---|
| 556 | if(lstrcmpi(str,"#prompt")==0) return -1; | 
|---|
| 557 | if(lstrcmpi(str,"#N88BASIC")==0) return -1; | 
|---|
| 558 | if(lstrcmpi(str,"#define")==0) return -1; | 
|---|
| 559 | if(lstrcmpi(str,"#ifdef")==0) return -1; | 
|---|
| 560 | if(lstrcmpi(str,"#ifndef")==0) return -1; | 
|---|
| 561 | if(lstrcmpi(str,"#else")==0) return -1; | 
|---|
| 562 | if(lstrcmpi(str,"#endif")==0) return -1; | 
|---|
| 563 | } | 
|---|
| 564 | return 0; | 
|---|
| 565 | } | 
|---|
| 566 |  | 
|---|
| 567 | HBITMAP CreateGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2){ | 
|---|
| 568 | //グラデーションビットマップを生成 | 
|---|
| 569 |  | 
|---|
| 570 | BITMAPINFO BitmapInfo; | 
|---|
| 571 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER)); | 
|---|
| 572 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); | 
|---|
| 573 | BitmapInfo.bmiHeader.biWidth=pSize->cx; | 
|---|
| 574 | BitmapInfo.bmiHeader.biHeight=pSize->cy; | 
|---|
| 575 | BitmapInfo.bmiHeader.biPlanes=1; | 
|---|
| 576 | BitmapInfo.bmiHeader.biBitCount=24; | 
|---|
| 577 |  | 
|---|
| 578 | HDC hdc; | 
|---|
| 579 | hdc=GetDC(GetDesktopWindow()); | 
|---|
| 580 |  | 
|---|
| 581 | HBITMAP hBitmap; | 
|---|
| 582 | BYTE *pByte; | 
|---|
| 583 | hBitmap=CreateDIBSection(hdc,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0); | 
|---|
| 584 |  | 
|---|
| 585 | int i,i2,x,y; | 
|---|
| 586 | COLORREF rgb; | 
|---|
| 587 | i=BitmapInfo.bmiHeader.biWidth*3; | 
|---|
| 588 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG)); | 
|---|
| 589 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){ | 
|---|
| 590 | if(y<BitmapInfo.bmiHeader.biHeight/2-2) rgb=color2; | 
|---|
| 591 | else if(y>BitmapInfo.bmiHeader.biHeight/2+2) rgb=color1; | 
|---|
| 592 | else{ | 
|---|
| 593 | double ratio; | 
|---|
| 594 | ratio=((double)y-((double)BitmapInfo.bmiHeader.biHeight/(double)2-(double)2))/(double)4; | 
|---|
| 595 | //ratio=(double)y/(double)BitmapInfo.bmiHeader.biHeight; | 
|---|
| 596 | rgb=RGB( | 
|---|
| 597 | LOBYTE(LOWORD(color2))+(int)(double)(LOBYTE(LOWORD(color1))-LOBYTE(LOWORD(color2)))*(ratio),    //赤要素 | 
|---|
| 598 | HIBYTE(LOWORD(color2))+(int)(double)(HIBYTE(LOWORD(color1))-HIBYTE(LOWORD(color2)))*(ratio),    //緑要素 | 
|---|
| 599 | LOBYTE(HIWORD(color2))+(int)(double)(LOBYTE(HIWORD(color1))-LOBYTE(HIWORD(color2)))*(ratio)     //青要素 | 
|---|
| 600 | ); | 
|---|
| 601 | } | 
|---|
| 602 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){ | 
|---|
| 603 | i2=y*i+x*3; | 
|---|
| 604 | pByte[i2+2]=LOBYTE(LOWORD(rgb)); | 
|---|
| 605 | pByte[i2+1]=HIBYTE(LOWORD(rgb)); | 
|---|
| 606 | pByte[i2]=LOBYTE(HIWORD(rgb)); | 
|---|
| 607 | } | 
|---|
| 608 | } | 
|---|
| 609 |  | 
|---|
| 610 | DeleteDC(hdc); | 
|---|
| 611 |  | 
|---|
| 612 | return hBitmap; | 
|---|
| 613 | } | 
|---|
| 614 | HBITMAP CreateVertGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2){ | 
|---|
| 615 | //グラデーションビットマップを生成 | 
|---|
| 616 |  | 
|---|
| 617 | BITMAPINFO BitmapInfo; | 
|---|
| 618 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER)); | 
|---|
| 619 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); | 
|---|
| 620 | BitmapInfo.bmiHeader.biWidth=pSize->cx; | 
|---|
| 621 | BitmapInfo.bmiHeader.biHeight=pSize->cy; | 
|---|
| 622 | BitmapInfo.bmiHeader.biPlanes=1; | 
|---|
| 623 | BitmapInfo.bmiHeader.biBitCount=24; | 
|---|
| 624 |  | 
|---|
| 625 | HDC hdc; | 
|---|
| 626 | hdc=GetDC(GetDesktopWindow()); | 
|---|
| 627 |  | 
|---|
| 628 | HBITMAP hBitmap; | 
|---|
| 629 | BYTE *pByte; | 
|---|
| 630 | hBitmap=CreateDIBSection(hdc,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0); | 
|---|
| 631 |  | 
|---|
| 632 | int i,i2,x,y; | 
|---|
| 633 | COLORREF rgb; | 
|---|
| 634 | i=BitmapInfo.bmiHeader.biWidth*3; | 
|---|
| 635 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG)); | 
|---|
| 636 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){ | 
|---|
| 637 | if(y<BitmapInfo.bmiHeader.biHeight/2-2) rgb=color2; | 
|---|
| 638 | else if(y>BitmapInfo.bmiHeader.biHeight/2+2) rgb=color1; | 
|---|
| 639 | else{ | 
|---|
| 640 | double ratio; | 
|---|
| 641 | ratio=(double)y/(double)BitmapInfo.bmiHeader.biHeight; | 
|---|
| 642 | rgb=RGB( | 
|---|
| 643 | LOBYTE(LOWORD(color2))+(int)(double)(LOBYTE(LOWORD(color1))-LOBYTE(LOWORD(color2)))*(ratio),    //赤要素 | 
|---|
| 644 | HIBYTE(LOWORD(color2))+(int)(double)(HIBYTE(LOWORD(color1))-HIBYTE(LOWORD(color2)))*(ratio),    //緑要素 | 
|---|
| 645 | LOBYTE(HIWORD(color2))+(int)(double)(LOBYTE(HIWORD(color1))-LOBYTE(HIWORD(color2)))*(ratio)     //青要素 | 
|---|
| 646 | ); | 
|---|
| 647 | } | 
|---|
| 648 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){ | 
|---|
| 649 | i2=y*i+x*3; | 
|---|
| 650 | pByte[i2+2]=LOBYTE(LOWORD(rgb)); | 
|---|
| 651 | pByte[i2+1]=HIBYTE(LOWORD(rgb)); | 
|---|
| 652 | pByte[i2]=LOBYTE(HIWORD(rgb)); | 
|---|
| 653 | } | 
|---|
| 654 | } | 
|---|
| 655 |  | 
|---|
| 656 | DeleteDC(hdc); | 
|---|
| 657 |  | 
|---|
| 658 | return hBitmap; | 
|---|
| 659 | } | 
|---|
| 660 | HBITMAP CreateHorzGradationBitmap(SIZE *pSize,COLORREF color1,COLORREF color2){ | 
|---|
| 661 | //グラデーションビットマップを生成 | 
|---|
| 662 |  | 
|---|
| 663 | BITMAPINFO BitmapInfo; | 
|---|
| 664 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER)); | 
|---|
| 665 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); | 
|---|
| 666 | BitmapInfo.bmiHeader.biWidth=pSize->cx; | 
|---|
| 667 | BitmapInfo.bmiHeader.biHeight=pSize->cy; | 
|---|
| 668 | BitmapInfo.bmiHeader.biPlanes=1; | 
|---|
| 669 | BitmapInfo.bmiHeader.biBitCount=24; | 
|---|
| 670 |  | 
|---|
| 671 | HDC hdc; | 
|---|
| 672 | hdc=GetDC(GetDesktopWindow()); | 
|---|
| 673 |  | 
|---|
| 674 | HBITMAP hBitmap; | 
|---|
| 675 | BYTE *pByte; | 
|---|
| 676 | hBitmap=CreateDIBSection(hdc,&BitmapInfo,DIB_RGB_COLORS,(void **)&pByte,0,0); | 
|---|
| 677 |  | 
|---|
| 678 | int i,i2,x,y; | 
|---|
| 679 | COLORREF rgb; | 
|---|
| 680 | i=BitmapInfo.bmiHeader.biWidth*3; | 
|---|
| 681 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG)); | 
|---|
| 682 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){ | 
|---|
| 683 | double ratio; | 
|---|
| 684 | ratio=(double)x/(double)BitmapInfo.bmiHeader.biWidth; | 
|---|
| 685 | rgb=RGB( | 
|---|
| 686 | LOBYTE(LOWORD(color1))+(int)(double)(LOBYTE(LOWORD(color2))-LOBYTE(LOWORD(color1)))*(ratio),    //赤要素 | 
|---|
| 687 | HIBYTE(LOWORD(color1))+(int)(double)(HIBYTE(LOWORD(color2))-HIBYTE(LOWORD(color1)))*(ratio),    //緑要素 | 
|---|
| 688 | LOBYTE(HIWORD(color1))+(int)(double)(LOBYTE(HIWORD(color2))-LOBYTE(HIWORD(color1)))*(ratio)     //青要素 | 
|---|
| 689 | ); | 
|---|
| 690 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){ | 
|---|
| 691 | i2=y*i+x*3; | 
|---|
| 692 | pByte[i2+2]=LOBYTE(LOWORD(rgb)); | 
|---|
| 693 | pByte[i2+1]=HIBYTE(LOWORD(rgb)); | 
|---|
| 694 | pByte[i2]=LOBYTE(HIWORD(rgb)); | 
|---|
| 695 | } | 
|---|
| 696 | } | 
|---|
| 697 |  | 
|---|
| 698 | DeleteDC(hdc); | 
|---|
| 699 |  | 
|---|
| 700 | return hBitmap; | 
|---|
| 701 | } | 
|---|
| 702 | HICON CreateGrayIcon(HICON hBaseIcon){ | 
|---|
| 703 | //////////////////////// | 
|---|
| 704 | // 淡色アイコンを生成 | 
|---|
| 705 | //////////////////////// | 
|---|
| 706 |  | 
|---|
| 707 | HICON hGrayIcon; | 
|---|
| 708 |  | 
|---|
| 709 | ICONINFO IconInfo; | 
|---|
| 710 | GetIconInfo(hBaseIcon,&IconInfo); | 
|---|
| 711 |  | 
|---|
| 712 |  | 
|---|
| 713 | //ビットマップを加工 | 
|---|
| 714 | BITMAP Bitmap; | 
|---|
| 715 | GetObject(IconInfo.hbmColor,sizeof(Bitmap),&Bitmap); | 
|---|
| 716 |  | 
|---|
| 717 | BITMAPINFO BitmapInfo; | 
|---|
| 718 | memset(&BitmapInfo.bmiHeader,0,sizeof(BITMAPINFOHEADER)); | 
|---|
| 719 | BitmapInfo.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); | 
|---|
| 720 | BitmapInfo.bmiHeader.biWidth=Bitmap.bmWidth; | 
|---|
| 721 | BitmapInfo.bmiHeader.biHeight=Bitmap.bmHeight; | 
|---|
| 722 | BitmapInfo.bmiHeader.biPlanes=1; | 
|---|
| 723 | BitmapInfo.bmiHeader.biBitCount=24; | 
|---|
| 724 | BitmapInfo.bmiHeader.biCompression=BI_RGB; | 
|---|
| 725 |  | 
|---|
| 726 | HDC hdc; | 
|---|
| 727 | hdc=GetDC(GetDesktopWindow()); | 
|---|
| 728 |  | 
|---|
| 729 | BYTE *pByte; | 
|---|
| 730 | pByte=(BYTE *)HeapAlloc(hHeap,0,Bitmap.bmWidth*Bitmap.bmHeight*sizeof(COLORREF)); | 
|---|
| 731 | GetDIBits(hdc, | 
|---|
| 732 | IconInfo.hbmColor, | 
|---|
| 733 | 0, | 
|---|
| 734 | Bitmap.bmHeight, | 
|---|
| 735 | (void *)pByte, | 
|---|
| 736 | &BitmapInfo, | 
|---|
| 737 | DIB_RGB_COLORS); | 
|---|
| 738 |  | 
|---|
| 739 | int i,i2,x,y; | 
|---|
| 740 | i=BitmapInfo.bmiHeader.biWidth*3; | 
|---|
| 741 | if(i%sizeof(LONG)!=0) i+=sizeof(LONG)-(i%sizeof(LONG)); | 
|---|
| 742 | for(x=0;x<BitmapInfo.bmiHeader.biWidth;x++){ | 
|---|
| 743 | for(y=0;y<BitmapInfo.bmiHeader.biHeight;y++){ | 
|---|
| 744 | i2=y*i+x*3; | 
|---|
| 745 | if(pByte[i2+2]==0&&pByte[i2+1]==0&&pByte[i2]==0){ | 
|---|
| 746 | //透明色 | 
|---|
| 747 | //何もしない | 
|---|
| 748 | } | 
|---|
| 749 | else{ | 
|---|
| 750 | double ratio=0.5;   //明るさ | 
|---|
| 751 |  | 
|---|
| 752 | pByte[i2+2]+=(BYTE)((double)(255-pByte[i2+2])*ratio); | 
|---|
| 753 | pByte[i2+1]+=(BYTE)((double)(255-pByte[i2+1])*ratio); | 
|---|
| 754 | pByte[i2]+=(BYTE)((double)(255-pByte[i2])*ratio); | 
|---|
| 755 |  | 
|---|
| 756 | pByte[i2+2]=(BYTE)(((int)pByte[i2+2]+(int)pByte[i2+1]+(int)pByte[i2])/3); | 
|---|
| 757 | pByte[i2+1]=pByte[i2+2]; | 
|---|
| 758 | pByte[i2]=pByte[i2+2]; | 
|---|
| 759 | } | 
|---|
| 760 | } | 
|---|
| 761 | } | 
|---|
| 762 |  | 
|---|
| 763 | SetDIBits(hdc, | 
|---|
| 764 | IconInfo.hbmColor, | 
|---|
| 765 | 0, | 
|---|
| 766 | Bitmap.bmHeight, | 
|---|
| 767 | (void *)pByte, | 
|---|
| 768 | &BitmapInfo, | 
|---|
| 769 | DIB_RGB_COLORS); | 
|---|
| 770 |  | 
|---|
| 771 | HeapDefaultFree(pByte); | 
|---|
| 772 |  | 
|---|
| 773 | DeleteDC(hdc); | 
|---|
| 774 |  | 
|---|
| 775 |  | 
|---|
| 776 | hGrayIcon=CreateIconIndirect(&IconInfo); | 
|---|
| 777 |  | 
|---|
| 778 | //不要なビットマップを破棄 | 
|---|
| 779 | DeleteObject(IconInfo.hbmMask); | 
|---|
| 780 | DeleteObject(IconInfo.hbmColor); | 
|---|
| 781 |  | 
|---|
| 782 | return hGrayIcon; | 
|---|
| 783 | } | 
|---|
| 784 | void GetSize(SIZE *pSize,RECT *pRect){ | 
|---|
| 785 | pSize->cx=pRect->right-pRect->left; | 
|---|
| 786 | pSize->cy=pRect->bottom-pRect->top; | 
|---|
| 787 | } | 
|---|
| 788 | BOOL HitTest(RECT *pRect,POINT *pPos){ | 
|---|
| 789 | if(pRect->left<=pPos->x&&pPos->x<pRect->right&& | 
|---|
| 790 | pRect->top<=pPos->y&&pPos->y<pRect->bottom) return 1; | 
|---|
| 791 | return 0; | 
|---|
| 792 | } | 
|---|
| 793 | BOOL Rectangle(HDC hdc,RECT *pRect){ | 
|---|
| 794 | return Rectangle(hdc,pRect->left,pRect->top,pRect->right,pRect->bottom); | 
|---|
| 795 | } | 
|---|
| 796 |  | 
|---|
| 797 | void ComboBox_SetSelText(HWND hCombo,char *lpszText){ | 
|---|
| 798 | SendMessage(hCombo,CB_SETCURSEL, | 
|---|
| 799 | SendMessage(hCombo,CB_FINDSTRINGEXACT,0,(LPARAM)lpszText), | 
|---|
| 800 | 0); | 
|---|
| 801 | } | 
|---|
| 802 |  | 
|---|
| 803 | void SetCursorByState(int state){ | 
|---|
| 804 | if(state==FRAME_UPPER_LEFT||state==FRAME_LOWER_RIGHT) SetCursor(LoadCursor(0,IDC_SIZENWSE)); | 
|---|
| 805 | else if(state==FRAME_UPPER_RIGHT||state==FRAME_LOWER_LEFT) SetCursor(LoadCursor(0,IDC_SIZENESW)); | 
|---|
| 806 | else if(state==FRAME_LEFT||state==FRAME_RIGHT) SetCursor(LoadCursor(0,IDC_SIZEWE)); | 
|---|
| 807 | else if(state==FRAME_UPPER||state==FRAME_LOWER) SetCursor(LoadCursor(0,IDC_SIZENS)); | 
|---|
| 808 | else if(state==FRAME_INSIDE) SetCursor(LoadCursor(0,IDC_SIZEALL)); | 
|---|
| 809 | else SetCursor(LoadCursor(0,IDC_ARROW)); | 
|---|
| 810 | } | 
|---|
| 811 |  | 
|---|
| 812 | void SetTextEditColorDesign(TEXTEDIT_COLOR_INFO *pColorInfo,CTheme *pobj_Theme,BOOL bRedraw){ | 
|---|
| 813 | pColorInfo->rgbDefault=pobj_Theme->TextColorInfo.rgbDefault; | 
|---|
| 814 | pColorInfo->rgbComment=pobj_Theme->TextColorInfo.rgbComment; | 
|---|
| 815 | pColorInfo->rgbStatement=pobj_Theme->TextColorInfo.rgbStatement; | 
|---|
| 816 | pColorInfo->rgbString=pobj_Theme->TextColorInfo.rgbString; | 
|---|
| 817 | pColorInfo->rgbCursorBack=pobj_Theme->TextColorInfo.rgbCursorBack; | 
|---|
| 818 | pColorInfo->rgbBackground=pobj_Theme->TextColorInfo.rgbBackground; | 
|---|
| 819 |  | 
|---|
| 820 | //アクティブテーマにセット | 
|---|
| 821 | lstrcpy(pobj_nv->szActiveTheme,pobj_Theme->m_name); | 
|---|
| 822 |  | 
|---|
| 823 | //テーマ依存の描画リソースを取得 | 
|---|
| 824 | pobj_DBTheme->unlock(); | 
|---|
| 825 | pobj_DBTheme->lock(); | 
|---|
| 826 |  | 
|---|
| 827 | if(bRedraw){ | 
|---|
| 828 | //再描画 | 
|---|
| 829 | extern MDIINFO MdiInfo[MAX_WNDNUM]; | 
|---|
| 830 | int i; | 
|---|
| 831 | for(i=0;i<MAX_WNDNUM;i++){ | 
|---|
| 832 | if(MdiInfo[i].hwnd){ | 
|---|
| 833 | if(IS_DOCUMENT_TEXT(MdiInfo[i].DocType)){ | 
|---|
| 834 | SetTextEditWordColor(i); | 
|---|
| 835 | InvalidateRect(MdiInfo[i].pMdiTextEdit->hEdit,NULL,0); | 
|---|
| 836 | } | 
|---|
| 837 | } | 
|---|
| 838 | } | 
|---|
| 839 | } | 
|---|
| 840 | } | 
|---|
| 841 |  | 
|---|
| 842 | BOOL SetupProjectEditor(void){ | 
|---|
| 843 | extern HINSTANCE hInst; | 
|---|
| 844 | int i; | 
|---|
| 845 | char str[MAX_PATH],temporary[MAX_PATH]; | 
|---|
| 846 |  | 
|---|
| 847 |  | 
|---|
| 848 | //リソース用DLLをマッピング | 
|---|
| 849 | #if defined(JPN) | 
|---|
| 850 | //日本語リソース | 
|---|
| 851 | sprintf(temporary,"%sSubOperation\\res.dll",pj_editor_Dir); | 
|---|
| 852 | #else | 
|---|
| 853 | //英語リソース | 
|---|
| 854 | sprintf(temporary,"%sSubOperation\\res_e.dll",pj_editor_Dir); | 
|---|
| 855 | #endif | 
|---|
| 856 | hResInst=LoadLibrary(temporary); | 
|---|
| 857 |  | 
|---|
| 858 | //アイコンリソースDLLをマッピング | 
|---|
| 859 | sprintf(temporary,"%sSubOperation\\icon_res.dll",pj_editor_Dir); | 
|---|
| 860 | hIconResInst=LoadLibrary(temporary); | 
|---|
| 861 |  | 
|---|
| 862 | //LuxCtrl.dllをマッピング | 
|---|
| 863 | sprintf(temporary,"%sSubOperation\\LuxCtrl.dll",pj_editor_Dir); | 
|---|
| 864 | hLib_LuxCtrl=LoadLibrary(temporary); | 
|---|
| 865 | if(!hLib_LuxCtrl){ | 
|---|
| 866 | MessageBox(0,"LuxCtrl.dllの読み込みに失敗しました。",APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION); | 
|---|
| 867 | return 0; | 
|---|
| 868 | } | 
|---|
| 869 | LuxToolbar_CreateInstance= | 
|---|
| 870 | (PROC_LuxToolbar_CreateInstance)GetProcAddress(hLib_LuxCtrl,"LuxToolbar_CreateInstance"); | 
|---|
| 871 |  | 
|---|
| 872 |  | 
|---|
| 873 | //モジュールディレクトリを取得 | 
|---|
| 874 | GetModuleFileName(hInst,temporary,MAX_PATH); | 
|---|
| 875 | _splitpath(temporary,pj_editor_Dir,str,NULL,NULL); | 
|---|
| 876 | lstrcat(pj_editor_Dir,str); | 
|---|
| 877 |  | 
|---|
| 878 | //ヒープオブジェクトを作成 | 
|---|
| 879 | extern HANDLE hHeap; | 
|---|
| 880 | hHeap=HeapCreate(HEAP_GENERATE_EXCEPTIONS,0,0); | 
|---|
| 881 |  | 
|---|
| 882 |  | 
|---|
| 883 | //自動バックアップ用のディレクトリを生成 | 
|---|
| 884 | CreateBackupDir(); | 
|---|
| 885 |  | 
|---|
| 886 |  | 
|---|
| 887 | //COMを初期化 | 
|---|
| 888 | CoInitialize(0); | 
|---|
| 889 |  | 
|---|
| 890 | //スクリーンサイズを取得 | 
|---|
| 891 | ScreenX=GetSystemMetrics(SM_CXSCREEN); | 
|---|
| 892 | ScreenY=GetSystemMetrics(SM_CYSCREEN); | 
|---|
| 893 |  | 
|---|
| 894 | //コンパイラ名をセット(デフォルトはWin32) | 
|---|
| 895 | extern char *lpszCompilerName; | 
|---|
| 896 | lpszCompilerName=WIN32_COMPILER_NAME; | 
|---|
| 897 |  | 
|---|
| 898 | //不揮発性のデータを取得 | 
|---|
| 899 | pobj_nv=new CNonVolatile; | 
|---|
| 900 | pobj_nv->load(); | 
|---|
| 901 |  | 
|---|
| 902 |  | 
|---|
| 903 | //アルファブレンド用のAPIを取得 | 
|---|
| 904 | extern FWINLAYER SetLayeredWindowAttributes; | 
|---|
| 905 | extern HINSTANCE hUser32Lib; | 
|---|
| 906 | hUser32Lib=LoadLibrary("user32.dll"); | 
|---|
| 907 | SetLayeredWindowAttributes=(FWINLAYER)GetProcAddress(hUser32Lib,"SetLayeredWindowAttributes"); | 
|---|
| 908 |  | 
|---|
| 909 |  | 
|---|
| 910 |  | 
|---|
| 911 |  | 
|---|
| 912 | ///////////////////// | 
|---|
| 913 | // フォントを定義 | 
|---|
| 914 | ///////////////////// | 
|---|
| 915 |  | 
|---|
| 916 | //パラメータ ヒント フォント | 
|---|
| 917 | extern METHODCHECKINFO MethodCheckInfo; | 
|---|
| 918 | MethodCheckInfo.hFont=CreateFontIndirect(&MethodCheckInfo.LogFont); | 
|---|
| 919 | i=MethodCheckInfo.LogFont.lfWeight; | 
|---|
| 920 | MethodCheckInfo.LogFont.lfWeight=FW_BOLD; | 
|---|
| 921 | MethodCheckInfo.hBoldFont=CreateFontIndirect(&MethodCheckInfo.LogFont); | 
|---|
| 922 | MethodCheckInfo.LogFont.lfWeight=i; | 
|---|
| 923 |  | 
|---|
| 924 | //ステータスバー フォント | 
|---|
| 925 | LOGFONT LogFont; | 
|---|
| 926 | extern HFONT hStatusFont; | 
|---|
| 927 | LogFont.lfHeight=-12; | 
|---|
| 928 | LogFont.lfWidth=0; | 
|---|
| 929 | LogFont.lfEscapement=0; | 
|---|
| 930 | LogFont.lfOrientation=0; | 
|---|
| 931 | LogFont.lfWeight=FW_REGULAR; | 
|---|
| 932 | LogFont.lfItalic=NULL; | 
|---|
| 933 | LogFont.lfUnderline=NULL; | 
|---|
| 934 | LogFont.lfStrikeOut=NULL; | 
|---|
| 935 | LogFont.lfCharSet=SHIFTJIS_CHARSET; | 
|---|
| 936 | LogFont.lfOutPrecision=OUT_STRING_PRECIS; | 
|---|
| 937 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS; | 
|---|
| 938 | LogFont.lfQuality=DRAFT_QUALITY; | 
|---|
| 939 | LogFont.lfPitchAndFamily=VARIABLE_PITCH; | 
|---|
| 940 | sprintf(LogFont.lfFaceName,"MS Pゴシック"); | 
|---|
| 941 | hStatusFont=CreateFontIndirect(&LogFont); | 
|---|
| 942 |  | 
|---|
| 943 | //ハイパーリンク フォント | 
|---|
| 944 | extern HFONT hHyperLinkFont; | 
|---|
| 945 | LogFont.lfHeight=-12; | 
|---|
| 946 | LogFont.lfWidth=0; | 
|---|
| 947 | LogFont.lfEscapement=0; | 
|---|
| 948 | LogFont.lfOrientation=0; | 
|---|
| 949 | LogFont.lfWeight=FW_REGULAR; | 
|---|
| 950 | LogFont.lfItalic=NULL; | 
|---|
| 951 | LogFont.lfUnderline=TRUE; | 
|---|
| 952 | LogFont.lfStrikeOut=NULL; | 
|---|
| 953 | LogFont.lfCharSet=SHIFTJIS_CHARSET; | 
|---|
| 954 | LogFont.lfOutPrecision=OUT_STRING_PRECIS; | 
|---|
| 955 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS; | 
|---|
| 956 | LogFont.lfQuality=DRAFT_QUALITY; | 
|---|
| 957 | LogFont.lfPitchAndFamily=VARIABLE_PITCH; | 
|---|
| 958 | sprintf(LogFont.lfFaceName,"MS Pゴシック"); | 
|---|
| 959 | hHyperLinkFont=CreateFontIndirect(&LogFont); | 
|---|
| 960 |  | 
|---|
| 961 | //ルーラー フォント | 
|---|
| 962 | extern HFONT hRulerFont; | 
|---|
| 963 | LogFont.lfHeight=-10; | 
|---|
| 964 | LogFont.lfWidth=0; | 
|---|
| 965 | LogFont.lfEscapement=0; | 
|---|
| 966 | LogFont.lfOrientation=0; | 
|---|
| 967 | LogFont.lfWeight=FW_REGULAR; | 
|---|
| 968 | LogFont.lfItalic=NULL; | 
|---|
| 969 | LogFont.lfUnderline=0; | 
|---|
| 970 | LogFont.lfStrikeOut=NULL; | 
|---|
| 971 | LogFont.lfCharSet=SHIFTJIS_CHARSET; | 
|---|
| 972 | LogFont.lfOutPrecision=OUT_STRING_PRECIS; | 
|---|
| 973 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS; | 
|---|
| 974 | LogFont.lfQuality=DRAFT_QUALITY; | 
|---|
| 975 | LogFont.lfPitchAndFamily=VARIABLE_PITCH; | 
|---|
| 976 | sprintf(LogFont.lfFaceName,"MS ゴシック"); | 
|---|
| 977 | hRulerFont=CreateFontIndirect(&LogFont); | 
|---|
| 978 |  | 
|---|
| 979 | //行番号の描画用 | 
|---|
| 980 | extern HFONT hFont_LineNumber; | 
|---|
| 981 | LogFont.lfHeight=-11; | 
|---|
| 982 | LogFont.lfWidth=0; | 
|---|
| 983 | LogFont.lfEscapement=0; | 
|---|
| 984 | LogFont.lfOrientation=0; | 
|---|
| 985 | LogFont.lfWeight=FW_BOLD; | 
|---|
| 986 | LogFont.lfItalic=NULL; | 
|---|
| 987 | LogFont.lfUnderline=NULL; | 
|---|
| 988 | LogFont.lfStrikeOut=NULL; | 
|---|
| 989 | LogFont.lfCharSet=ANSI_CHARSET; | 
|---|
| 990 | LogFont.lfOutPrecision=OUT_STRING_PRECIS; | 
|---|
| 991 | LogFont.lfClipPrecision=CLIP_STROKE_PRECIS; | 
|---|
| 992 | LogFont.lfQuality=DRAFT_QUALITY; | 
|---|
| 993 | LogFont.lfPitchAndFamily=VARIABLE_PITCH; | 
|---|
| 994 | sprintf(LogFont.lfFaceName,"Courier New"); | 
|---|
| 995 | hFont_LineNumber=CreateFontIndirect(&LogFont); | 
|---|
| 996 |  | 
|---|
| 997 | //メニューフォント | 
|---|
| 998 | NONCLIENTMETRICS NCMetrics; | 
|---|
| 999 | NCMetrics.cbSize = sizeof( NONCLIENTMETRICS ); | 
|---|
| 1000 | SystemParametersInfo( SPI_GETNONCLIENTMETRICS, sizeof( NONCLIENTMETRICS ), &NCMetrics, 0 ); | 
|---|
| 1001 | hMenuFont=CreateFontIndirect(&NCMetrics.lfMenuFont); | 
|---|
| 1002 |  | 
|---|
| 1003 |  | 
|---|
| 1004 |  | 
|---|
| 1005 | //背景ブラシ | 
|---|
| 1006 | extern HBRUSH h3DFaceBackBrush; | 
|---|
| 1007 | h3DFaceBackBrush=CreateSolidBrush(GetSysColor(COLOR_3DFACE)); | 
|---|
| 1008 |  | 
|---|
| 1009 | //アイコン | 
|---|
| 1010 | extern HICON hOwnerIcon,hBasicProgramIcon,hTextDocumentIcon,hWindowDocumentIcon; | 
|---|
| 1011 | hOwnerIcon=(HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_MAIN),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); | 
|---|
| 1012 | hBasicProgramIcon=(HICON)LoadImage(hResInst,MAKEINTRESOURCE(IDI_BASICPROGRAM),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); | 
|---|
| 1013 | hTextDocumentIcon=(HICON)LoadImage(hResInst,MAKEINTRESOURCE(IDI_TEXTDOCUMENT),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); | 
|---|
| 1014 | hWindowDocumentIcon=(HICON)LoadImage(hResInst,MAKEINTRESOURCE(IDI_WINDOW),IMAGE_ICON,16,16,LR_DEFAULTCOLOR); | 
|---|
| 1015 |  | 
|---|
| 1016 |  | 
|---|
| 1017 |  | 
|---|
| 1018 |  | 
|---|
| 1019 | //メインメニュー | 
|---|
| 1020 | pobj_MainMenu=new CMenuEx(LoadMenu(hResInst,MAKEINTRESOURCE(IDR_MAINMENU))); | 
|---|
| 1021 |  | 
|---|
| 1022 | pobj_MainMenu->InitOwnerDraw(1);            //オーナー描画の初期化 | 
|---|
| 1023 |  | 
|---|
| 1024 | CSubMenuEx *pobj_FileMenu; | 
|---|
| 1025 | pobj_FileMenu=pobj_MainMenu->ppobj_MenuItemData[0]->pobj_SubMenu; | 
|---|
| 1026 |  | 
|---|
| 1027 | //未完成 | 
|---|
| 1028 | extern HMENU hFirstMainMenu; | 
|---|
| 1029 | hFirstMainMenu=0; | 
|---|
| 1030 |  | 
|---|
| 1031 | //「最近使ったファイル」サブメニューを取得(と同時にも正規のメニュー文字列を指定) | 
|---|
| 1032 | for(i=0;i<pobj_FileMenu->iMenuItemNum;i++){ | 
|---|
| 1033 | if(pobj_FileMenu->ppobj_MenuItemData[i]->str){ | 
|---|
| 1034 | if(lstrcmp(pobj_FileMenu->ppobj_MenuItemData[i]->str,"FileHistory")==0){ | 
|---|
| 1035 | pobj_FileMenu->RenameMenuItem(i,"最近使ったファイル(&F)"); | 
|---|
| 1036 |  | 
|---|
| 1037 | extern CSubMenuEx *pobj_FileHistoryMenu; | 
|---|
| 1038 | pobj_FileHistoryMenu=pobj_FileMenu->ppobj_MenuItemData[i]->pobj_SubMenu; | 
|---|
| 1039 | } | 
|---|
| 1040 |  | 
|---|
| 1041 | #ifndef THETEXT | 
|---|
| 1042 | //「最近使ったプロジェクト」サブメニューを取得(と同時にも正規のメニュー文字列を指定) | 
|---|
| 1043 | //※ProjectEditorのみ | 
|---|
| 1044 | if(lstrcmp(pobj_FileMenu->ppobj_MenuItemData[i]->str,"ProjectHistory")==0){ | 
|---|
| 1045 | pobj_FileMenu->RenameMenuItem(i,"最近使ったプロジェクト(&J)"); | 
|---|
| 1046 |  | 
|---|
| 1047 | extern CSubMenuEx *pobj_ProjectHistoryMenu; | 
|---|
| 1048 | pobj_ProjectHistoryMenu=pobj_FileMenu->ppobj_MenuItemData[i]->pobj_SubMenu; | 
|---|
| 1049 | } | 
|---|
| 1050 | #endif | 
|---|
| 1051 | } | 
|---|
| 1052 | } | 
|---|
| 1053 |  | 
|---|
| 1054 | #define ICONSET(itemID,iconID) pobj_MainMenu->SetIcon(itemID,(HICON)LoadImage(hIconResInst,MAKEINTRESOURCE(iconID),IMAGE_ICON,16,16,0)); | 
|---|
| 1055 | //メニューアイコンをセット | 
|---|
| 1056 |  | 
|---|
| 1057 | //ファイル | 
|---|
| 1058 | ICONSET(IDM_NEW,IDI_NEW); | 
|---|
| 1059 | ICONSET(IDM_OPEN,IDI_OPEN); | 
|---|
| 1060 | ICONSET(IDM_SAVE,IDI_SAVE); | 
|---|
| 1061 | ICONSET(IDM_ALLSAVE,IDI_ALLSAVE); | 
|---|
| 1062 | ICONSET(IDM_PREVIEW,IDI_PREVIEW); | 
|---|
| 1063 | ICONSET(IDM_PRINTOUT,IDI_PRINT); | 
|---|
| 1064 |  | 
|---|
| 1065 | //編集 | 
|---|
| 1066 | ICONSET(IDM_CUT,IDI_CUT); | 
|---|
| 1067 | ICONSET(IDM_COPY,IDI_COPY); | 
|---|
| 1068 | ICONSET(IDM_PASTE,IDI_PASTE); | 
|---|
| 1069 | ICONSET(IDM_UNDO,IDI_UNDO); | 
|---|
| 1070 | ICONSET(IDM_REDO,IDI_REDO); | 
|---|
| 1071 | ICONSET(IDM_FIND,IDI_FIND); | 
|---|
| 1072 |  | 
|---|
| 1073 | //表示 | 
|---|
| 1074 | ICONSET(IDM_SET,IDI_OPTION); | 
|---|
| 1075 |  | 
|---|
| 1076 | //変換 | 
|---|
| 1077 | ICONSET(IDM_CONV_ALPHA_SMALL,IDI_CONV_ALPHA_SMALL); | 
|---|
| 1078 | ICONSET(IDM_CONV_ALPHA_BIG,IDI_CONV_ALPHA_BIG); | 
|---|
| 1079 | ICONSET(IDM_CONV_HALF,IDI_CONV_HALF); | 
|---|
| 1080 | ICONSET(IDM_CONV_MULTI,IDI_CONV_MULTI); | 
|---|
| 1081 | ICONSET(IDM_CONV_KATAKANA,IDI_CONV_KATAKANA); | 
|---|
| 1082 | ICONSET(IDM_CONV_HIRAGANA,IDI_CONV_HIRAGANA); | 
|---|
| 1083 |  | 
|---|
| 1084 | //ヘルプ | 
|---|
| 1085 | ICONSET(IDM_TOPIC,IDI_HELP); | 
|---|
| 1086 |  | 
|---|
| 1087 | #ifdef THETEXT | 
|---|
| 1088 | //TheTextのみの機能 | 
|---|
| 1089 | ICONSET(IDM_STRING_COUNT,IDI_STRINGCOUNT); | 
|---|
| 1090 | #else | 
|---|
| 1091 | //ProjectEditorのみの機能 | 
|---|
| 1092 |  | 
|---|
| 1093 | //リリース | 
|---|
| 1094 | ICONSET(IDM_RELEASECOMPILE,IDI_RELEASECOMPILE); | 
|---|
| 1095 | ICONSET(IDM_RELEASERUN,IDI_RELEASERUN); | 
|---|
| 1096 |  | 
|---|
| 1097 | //デバッグ | 
|---|
| 1098 | ICONSET(IDM_ATTACH,IDI_ATTACH); | 
|---|
| 1099 | ICONSET(IDM_DEBUGCOMPILE,IDI_DEBUGCOMPILE); | 
|---|
| 1100 | ICONSET(IDM_DEBUG,IDI_DEBUGRUN); | 
|---|
| 1101 | ICONSET(IDM_BREAKPOINT,IDI_BREAKPOINT); | 
|---|
| 1102 | ICONSET(IDM_STEP_IN,IDI_STEPIN); | 
|---|
| 1103 | ICONSET(IDM_STEP_OVER,IDI_STEPOVER); | 
|---|
| 1104 | ICONSET(IDM_STEP_CURSOR,IDI_STEPTOCURSOR); | 
|---|
| 1105 | ICONSET(IDM_DEBUG_PAUSE,IDI_DEBUGPAUSE); | 
|---|
| 1106 | ICONSET(IDM_DEBUG_STOP,IDI_DEBUGSTOP); | 
|---|
| 1107 |  | 
|---|
| 1108 | //コミュニティ | 
|---|
| 1109 | ICONSET(IDM_COMMUNITY,IDI_COMMUNITY_MAIN); | 
|---|
| 1110 | ICONSET(IDM_COMMU_SEARCH,IDI_COMMUNITY_FIND); | 
|---|
| 1111 | ICONSET(IDM_COMMU_PM,IDI_COMMUNITY_PRIVATEMSG); | 
|---|
| 1112 | ICONSET(ID_COMMU_FORUM1,IDI_COMMUNITY_FORUM); | 
|---|
| 1113 | ICONSET(ID_COMMU_FORUM2,IDI_COMMUNITY_FORUM); | 
|---|
| 1114 | ICONSET(ID_COMMU_FORUM3,IDI_COMMUNITY_FORUM); | 
|---|
| 1115 | ICONSET(ID_COMMU_FORUM4,IDI_COMMUNITY_FORUM); | 
|---|
| 1116 | ICONSET(ID_COMMU_FORUM5,IDI_COMMUNITY_FORUM); | 
|---|
| 1117 | ICONSET(ID_COMMU_FORUM6,IDI_COMMUNITY_FORUM_SECRET); | 
|---|
| 1118 | ICONSET(ID_COMMU_FORUM7,IDI_COMMUNITY_FORUM); | 
|---|
| 1119 | ICONSET(ID_COMMU_FORUM8,IDI_COMMUNITY_FORUM); | 
|---|
| 1120 | #endif | 
|---|
| 1121 |  | 
|---|
| 1122 | #undef ICONSET | 
|---|
| 1123 |  | 
|---|
| 1124 |  | 
|---|
| 1125 |  | 
|---|
| 1126 |  | 
|---|
| 1127 | extern HMENU hEditMenuBase,hEditMenu; | 
|---|
| 1128 | hEditMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_EDITMENU)); | 
|---|
| 1129 | hEditMenu=GetSubMenu(hEditMenuBase,0); | 
|---|
| 1130 |  | 
|---|
| 1131 | extern HMENU hRebarMenuBase,hRebarMenu; | 
|---|
| 1132 | hRebarMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_REBARMENU)); | 
|---|
| 1133 | hRebarMenu=GetSubMenu(hRebarMenuBase,0); | 
|---|
| 1134 |  | 
|---|
| 1135 | extern HMENU hTabMenuBase,hTabMenu,hTabColorMenu; | 
|---|
| 1136 | hTabMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_TABMENU)); | 
|---|
| 1137 | hTabMenu=GetSubMenu(hTabMenuBase,0); | 
|---|
| 1138 | hTabColorMenu=GetSubMenu(hTabMenu,0); | 
|---|
| 1139 |  | 
|---|
| 1140 | extern HMENU hFileTreeMenuBase; | 
|---|
| 1141 | hFileTreeMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_PROJECTVIEW_FILETREEMENU)); | 
|---|
| 1142 |  | 
|---|
| 1143 | extern HMENU hProcedureTreeMenuBase; | 
|---|
| 1144 | hProcedureTreeMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_PROJECTVIEW_PROCEDURETREEMENU)); | 
|---|
| 1145 |  | 
|---|
| 1146 | extern HMENU hMaterialTreeMenuBase; | 
|---|
| 1147 | hMaterialTreeMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_PROJECTVIEW_MATERIALTREEMENU)); | 
|---|
| 1148 |  | 
|---|
| 1149 | extern HMENU hRadMenuBase; | 
|---|
| 1150 | hRadMenuBase=LoadMenu(hResInst,MAKEINTRESOURCE(IDR_RADCONTEXTMENU)); | 
|---|
| 1151 |  | 
|---|
| 1152 | //クリップボードのデータ形式(RAD用)を新規登録 | 
|---|
| 1153 | extern DWORD dwRadClipboardID; | 
|---|
| 1154 | dwRadClipboardID=RegisterClipboardFormat("ProjectEditor-RAD"); | 
|---|
| 1155 |  | 
|---|
| 1156 | //256色の標準パレットを読み込む | 
|---|
| 1157 | extern RGBQUAD DefaultColorTable256[256]; | 
|---|
| 1158 | HANDLE hFile; | 
|---|
| 1159 | DWORD dw; | 
|---|
| 1160 | sprintf(temporary,"%sSubOperation\\8bit.plt",pj_editor_Dir); | 
|---|
| 1161 | hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); | 
|---|
| 1162 | if(hFile==INVALID_HANDLE_VALUE){ | 
|---|
| 1163 | //"\"%s\" ファイルの読み込みに失敗しました。" | 
|---|
| 1164 | sprintf(str,STRING_ERROR_CANT_FILEOPEN,temporary); | 
|---|
| 1165 | MessageBox(NULL,str,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION); | 
|---|
| 1166 | return 0; | 
|---|
| 1167 | } | 
|---|
| 1168 | ReadFile(hFile,DefaultColorTable256,sizeof(RGBQUAD)*256,&dw,NULL); | 
|---|
| 1169 | CloseHandle(hFile); | 
|---|
| 1170 |  | 
|---|
| 1171 |  | 
|---|
| 1172 |  | 
|---|
| 1173 | //デザインテーマオブジェクトを生成 | 
|---|
| 1174 | pobj_DBTheme=new CDBTheme(); | 
|---|
| 1175 |  | 
|---|
| 1176 |  | 
|---|
| 1177 | ///////////////////////// | 
|---|
| 1178 | // カラーデザインを設定 | 
|---|
| 1179 | CTheme *pobj_Theme; | 
|---|
| 1180 | pobj_Theme=pobj_DBTheme->GetActiveTheme(); | 
|---|
| 1181 | if(!pobj_Theme) pobj_Theme=pobj_DBTheme->ppobj_Theme[0]; | 
|---|
| 1182 |  | 
|---|
| 1183 | SetTextEditColorDesign(&tci,pobj_Theme,0); | 
|---|
| 1184 |  | 
|---|
| 1185 |  | 
|---|
| 1186 | #ifndef THETEXT | 
|---|
| 1187 | ///////////////////////////////////////////////////// | 
|---|
| 1188 | // ProjectEditorのみ | 
|---|
| 1189 | ///////////////////////////////////////////////////// | 
|---|
| 1190 |  | 
|---|
| 1191 |  | 
|---|
| 1192 | //クラスビュー管理オブジェクトを生成 | 
|---|
| 1193 | pobj_ClassTreeView=new CClassTreeView(); | 
|---|
| 1194 |  | 
|---|
| 1195 |  | 
|---|
| 1196 | ///////////////////////// | 
|---|
| 1197 | // basic.sbpの内容を取得 | 
|---|
| 1198 | ///////////////////////// | 
|---|
| 1199 |  | 
|---|
| 1200 | extern char *pHeaderBuf; | 
|---|
| 1201 | sprintf(temporary,"%sInclude\\basic.sbp",pj_editor_Dir); | 
|---|
| 1202 | pHeaderBuf=ReadBuffer(temporary); | 
|---|
| 1203 |  | 
|---|
| 1204 | //ファイルをインクルード | 
|---|
| 1205 | pHeaderBuf=IncludeFiles(pHeaderBuf); | 
|---|
| 1206 |  | 
|---|
| 1207 |  | 
|---|
| 1208 | //デバッガ管理オブジェクトを生成 | 
|---|
| 1209 | pobj_Debugger=new CDebugger(); | 
|---|
| 1210 |  | 
|---|
| 1211 |  | 
|---|
| 1212 | //ブレークポイント管理オブジェクトを生成 | 
|---|
| 1213 | extern CDBBreakPoint *pobj_DBBreakPoint; | 
|---|
| 1214 | pobj_DBBreakPoint=new CDBBreakPoint(); | 
|---|
| 1215 | #endif | 
|---|
| 1216 |  | 
|---|
| 1217 |  | 
|---|
| 1218 | return 1; | 
|---|
| 1219 | } | 
|---|
| 1220 | void EndProjectEditor(void){ | 
|---|
| 1221 |  | 
|---|
| 1222 | #ifndef THETEXT | 
|---|
| 1223 | ///////////////////////////////////////////////////// | 
|---|
| 1224 | // ProjectEditorのみ | 
|---|
| 1225 | ///////////////////////////////////////////////////// | 
|---|
| 1226 |  | 
|---|
| 1227 |  | 
|---|
| 1228 | //クラスビュー管理オブジェクトを破棄 | 
|---|
| 1229 | delete pobj_ClassTreeView; | 
|---|
| 1230 | pobj_ClassTreeView=0; | 
|---|
| 1231 |  | 
|---|
| 1232 | //basic.sbpのソースコードバッファを解放 | 
|---|
| 1233 | extern char *pHeaderBuf; | 
|---|
| 1234 | HeapDefaultFree(pHeaderBuf); | 
|---|
| 1235 |  | 
|---|
| 1236 | //デバッガ管理オブジェクトを破棄 | 
|---|
| 1237 | delete pobj_Debugger; | 
|---|
| 1238 |  | 
|---|
| 1239 | //ブレークポイント管理オブジェクトを破棄 | 
|---|
| 1240 | extern CDBBreakPoint *pobj_DBBreakPoint; | 
|---|
| 1241 | delete pobj_DBBreakPoint; | 
|---|
| 1242 | #endif | 
|---|
| 1243 |  | 
|---|
| 1244 | //デザインテーマオブジェクトを破棄 | 
|---|
| 1245 | delete pobj_DBTheme; | 
|---|
| 1246 |  | 
|---|
| 1247 | //不揮発性のデータを保存 | 
|---|
| 1248 | pobj_nv->save(); | 
|---|
| 1249 | delete pobj_nv; | 
|---|
| 1250 | pobj_nv=0; | 
|---|
| 1251 |  | 
|---|
| 1252 | //メインメニューオブジェクトを破棄 | 
|---|
| 1253 | delete pobj_MainMenu; | 
|---|
| 1254 | pobj_MainMenu=0; | 
|---|
| 1255 |  | 
|---|
| 1256 | extern HFONT hStatusFont; | 
|---|
| 1257 | DeleteObject(hStatusFont); | 
|---|
| 1258 | extern HFONT hHyperLinkFont; | 
|---|
| 1259 | DeleteObject(hHyperLinkFont); | 
|---|
| 1260 | extern HFONT hRulerFont; | 
|---|
| 1261 | DeleteObject(hRulerFont); | 
|---|
| 1262 | extern HFONT hFont_LineNumber; | 
|---|
| 1263 | DeleteObject(hFont_LineNumber); | 
|---|
| 1264 | extern METHODCHECKINFO MethodCheckInfo; | 
|---|
| 1265 | DeleteObject(MethodCheckInfo.hFont); | 
|---|
| 1266 | DeleteObject(MethodCheckInfo.hBoldFont); | 
|---|
| 1267 | extern HICON hOwnerIcon,hBasicProgramIcon,hTextDocumentIcon,hWindowDocumentIcon; | 
|---|
| 1268 | DestroyIcon(hOwnerIcon); | 
|---|
| 1269 | DestroyIcon(hBasicProgramIcon); | 
|---|
| 1270 | DestroyIcon(hTextDocumentIcon); | 
|---|
| 1271 | DestroyIcon(hWindowDocumentIcon); | 
|---|
| 1272 | extern HMENU hEditMenuBase,hRebarMenuBase,hTabMenuBase; | 
|---|
| 1273 | DestroyMenu(hEditMenuBase); | 
|---|
| 1274 | DestroyMenu(hRebarMenuBase); | 
|---|
| 1275 | DestroyMenu(hTabMenuBase); | 
|---|
| 1276 | extern HMENU hFileTreeMenuBase; | 
|---|
| 1277 | DestroyMenu(hFileTreeMenuBase); | 
|---|
| 1278 | extern HMENU hProcedureTreeMenuBase; | 
|---|
| 1279 | DestroyMenu(hProcedureTreeMenuBase); | 
|---|
| 1280 | extern HMENU hMaterialTreeMenuBase; | 
|---|
| 1281 | DestroyMenu(hMaterialTreeMenuBase); | 
|---|
| 1282 | extern HMENU hRadMenuBase; | 
|---|
| 1283 | DestroyMenu(hRadMenuBase); | 
|---|
| 1284 |  | 
|---|
| 1285 | //背景ブラシ | 
|---|
| 1286 | extern HBRUSH h3DFaceBackBrush; | 
|---|
| 1287 | DeleteObject(h3DFaceBackBrush); | 
|---|
| 1288 |  | 
|---|
| 1289 | //スタンダードツールバーを破棄 | 
|---|
| 1290 | if(pobj_StandardToolbar){ | 
|---|
| 1291 | pobj_StandardToolbar->Release(); | 
|---|
| 1292 | pobj_StandardToolbar=0; | 
|---|
| 1293 | } | 
|---|
| 1294 |  | 
|---|
| 1295 | //ビルドツールバーを破棄 | 
|---|
| 1296 | if(pobj_ReleaseToolbar){ | 
|---|
| 1297 | pobj_ReleaseToolbar->Release(); | 
|---|
| 1298 | pobj_ReleaseToolbar=0; | 
|---|
| 1299 | } | 
|---|
| 1300 |  | 
|---|
| 1301 | //デバッガ用ツールバーを破棄 | 
|---|
| 1302 | if(pobj_DebuggerToolbar){ | 
|---|
| 1303 | pobj_DebuggerToolbar->Release(); | 
|---|
| 1304 | pobj_DebuggerToolbar=0; | 
|---|
| 1305 | } | 
|---|
| 1306 |  | 
|---|
| 1307 | //ヒープオブジェクトを解放 | 
|---|
| 1308 | extern HANDLE hHeap; | 
|---|
| 1309 | HeapDestroy(hHeap); | 
|---|
| 1310 |  | 
|---|
| 1311 | //DLLを解放 | 
|---|
| 1312 | FreeLibrary(hResInst); | 
|---|
| 1313 | FreeLibrary(hIconResInst); | 
|---|
| 1314 | FreeLibrary(hLib_LuxCtrl); | 
|---|
| 1315 |  | 
|---|
| 1316 | //アルファブレンド用のAPIを解放 | 
|---|
| 1317 | extern HINSTANCE hUser32Lib; | 
|---|
| 1318 | FreeLibrary(hUser32Lib); | 
|---|
| 1319 |  | 
|---|
| 1320 |  | 
|---|
| 1321 |  | 
|---|
| 1322 |  | 
|---|
| 1323 | ////////////////////////////////////// | 
|---|
| 1324 | // バックアップ用ファイルを削除 | 
|---|
| 1325 | ////////////////////////////////////// | 
|---|
| 1326 | extern char szBackupDirPath[MAX_PATH]; | 
|---|
| 1327 | RemoveDirectoryStrong(szBackupDirPath); | 
|---|
| 1328 |  | 
|---|
| 1329 | } | 
|---|
| 1330 |  | 
|---|
| 1331 | //各ウィンドウ生成 | 
|---|
| 1332 | void SetupWindow(HWND hwnd){ | 
|---|
| 1333 | extern HINSTANCE hInst; | 
|---|
| 1334 | extern HMENU hFirstMainMenu; | 
|---|
| 1335 | RECT rect; | 
|---|
| 1336 | CLIENTCREATESTRUCT ccs; | 
|---|
| 1337 |  | 
|---|
| 1338 | INITCOMMONCONTROLSEX InitCommCtrl; | 
|---|
| 1339 | InitCommCtrl.dwSize=sizeof(INITCOMMONCONTROLSEX); | 
|---|
| 1340 | InitCommCtrl.dwICC=ICC_COOL_CLASSES|ICC_PAGESCROLLER_CLASS|ICC_WIN95_CLASSES|ICC_TAB_CLASSES; | 
|---|
| 1341 | InitCommonControlsEx(&InitCommCtrl); | 
|---|
| 1342 |  | 
|---|
| 1343 | //タブウィンドウ | 
|---|
| 1344 | pobj_MainTab=new CMainTab(hwnd); | 
|---|
| 1345 |  | 
|---|
| 1346 | //MDIの親ウィンドウ(クライアントウィンドウ)を作成 | 
|---|
| 1347 | ccs.hWindowMenu=hFirstMainMenu; | 
|---|
| 1348 | ccs.idFirstChild=ID_FIRSTCHILD; | 
|---|
| 1349 | GetClientRect(hwnd,&rect); | 
|---|
| 1350 | hClient=CreateWindowEx(WS_EX_CLIENTEDGE,"MDICLIENT",NULL, | 
|---|
| 1351 | WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_VISIBLE, | 
|---|
| 1352 | 0,0,0,0, | 
|---|
| 1353 | hwnd,(HMENU)1,hInst,(LPSTR)&ccs); | 
|---|
| 1354 |  | 
|---|
| 1355 | //レバーオブジェクトを生成 | 
|---|
| 1356 | pobj_Rebar=new CMainRebar(hwnd); | 
|---|
| 1357 |  | 
|---|
| 1358 | //ステータスバー | 
|---|
| 1359 | extern HWND hStatusBar; | 
|---|
| 1360 | extern HFONT hStatusFont; | 
|---|
| 1361 | hStatusBar=CreateStatusWindow( | 
|---|
| 1362 | WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBARS_SIZEGRIP|CCS_BOTTOM, | 
|---|
| 1363 | NULL,hwnd,NULL); | 
|---|
| 1364 | SendMessage(hStatusBar,WM_SETFONT,(long)hStatusFont,0); | 
|---|
| 1365 |  | 
|---|
| 1366 | //プロジェクト ビュー | 
|---|
| 1367 | extern HWND hProjectView; | 
|---|
| 1368 | extern HWND hProjectView_ToolWindow; | 
|---|
| 1369 | RECT *prc; | 
|---|
| 1370 | prc=&pobj_nv->rectProjectView; | 
|---|
| 1371 | hProjectView_ToolWindow=CreateWindowEx(WS_EX_TOOLWINDOW,"ProjectView_ToolWindow","ProjectView", | 
|---|
| 1372 | WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_CLIPCHILDREN, | 
|---|
| 1373 | prc->left,prc->top,prc->right-prc->left,prc->bottom-prc->top, | 
|---|
| 1374 | hwnd,0,hInst,0); | 
|---|
| 1375 | hProjectView=CreateWindowEx(WS_EX_STATICEDGE,"ProjectView","ProjectView", | 
|---|
| 1376 | WS_CHILD|WS_CLIPCHILDREN, | 
|---|
| 1377 | 0,0,0,0, | 
|---|
| 1378 | hwnd,0,hInst,0); | 
|---|
| 1379 | if(pobj_nv->bClipProjectView==0){ | 
|---|
| 1380 | SetWindowLong(hProjectView,GWL_EXSTYLE,0); | 
|---|
| 1381 | SetParent(hProjectView,hProjectView_ToolWindow); | 
|---|
| 1382 | ResizeProjectView_ToolWindow(); | 
|---|
| 1383 | } | 
|---|
| 1384 |  | 
|---|
| 1385 | //メニュー状態を設定 | 
|---|
| 1386 | ResetState_DocMenu(); | 
|---|
| 1387 |  | 
|---|
| 1388 |  | 
|---|
| 1389 | //SideWebを生成 | 
|---|
| 1390 | pobj_SideWeb=new CSideWeb(hwnd); | 
|---|
| 1391 | } | 
|---|
| 1392 |  | 
|---|
| 1393 | //実行コマンド | 
|---|
| 1394 | BOOL SetRunning(HWND hChild){ | 
|---|
| 1395 | extern MDIINFO MdiInfo[MAX_WNDNUM]; | 
|---|
| 1396 | extern LPSTR DefFileFilter; | 
|---|
| 1397 | int WndNum; | 
|---|
| 1398 | char temporary[MAX_PATH],temp2[MAX_PATH]; | 
|---|
| 1399 | HANDLE hFind; | 
|---|
| 1400 | WIN32_FIND_DATA wfd; | 
|---|
| 1401 |  | 
|---|
| 1402 | extern char *lpszCompilerName; | 
|---|
| 1403 | sprintf(temporary,"%s%s",pj_editor_Dir,lpszCompilerName); | 
|---|
| 1404 | hFind=FindFirstFile(temporary,&wfd); | 
|---|
| 1405 | if(hFind==INVALID_HANDLE_VALUE){ | 
|---|
| 1406 | //"BasicCompiler.exe が見つかりません" | 
|---|
| 1407 | MessageBox(hOwner,STRING_ERROR_NOBASICCOMPILER,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION); | 
|---|
| 1408 | return FALSE; | 
|---|
| 1409 | } | 
|---|
| 1410 | FindClose(hFind); | 
|---|
| 1411 |  | 
|---|
| 1412 | WndNum=GetWndNum(hChild); | 
|---|
| 1413 | if(IS_DOCUMENT_TEXT(MdiInfo[WndNum].DocType)){ | 
|---|
| 1414 | if(MdiInfo[WndNum].path[0]=='\0'){ | 
|---|
| 1415 | //"保存先のファイルを指定してください" | 
|---|
| 1416 | if(!GetFilePathDialog(hOwner,temp2,DefFileFilter,STRING_FILESAVETITLE_DEFAULT,0)) return FALSE; | 
|---|
| 1417 |  | 
|---|
| 1418 | if(!SaveDocument(hChild,temp2)) return 0; | 
|---|
| 1419 | } | 
|---|
| 1420 | else{ | 
|---|
| 1421 | if( MdiInfo[WndNum].pMdiTextEdit->IsModified() ){ | 
|---|
| 1422 | if(!SaveDocument(hChild,NULL)) return 0; | 
|---|
| 1423 | } | 
|---|
| 1424 | else{ | 
|---|
| 1425 | if(hFind=FindFirstFile(MdiInfo[WndNum].path,&wfd)){ | 
|---|
| 1426 | if(hFind==INVALID_HANDLE_VALUE){ | 
|---|
| 1427 | if(!SaveDocument(hChild,NULL)) return 0; | 
|---|
| 1428 | } | 
|---|
| 1429 | else FindClose(hFind); | 
|---|
| 1430 | } | 
|---|
| 1431 | } | 
|---|
| 1432 | } | 
|---|
| 1433 | } | 
|---|
| 1434 | return 1; | 
|---|
| 1435 | } | 
|---|
| 1436 |  | 
|---|
| 1437 | BOOL IsNeedCompile(char *FileName,BOOL bDebug){ | 
|---|
| 1438 | char temporary[MAX_PATH],temp2[MAX_PATH],temp3[MAX_PATH]; | 
|---|
| 1439 | HANDLE hFind,hFile; | 
|---|
| 1440 | WIN32_FIND_DATA wfd; | 
|---|
| 1441 | FILETIME SourceTime,ExeTime; | 
|---|
| 1442 |  | 
|---|
| 1443 | _splitpath(FileName,temporary,temp2,temp3,NULL); | 
|---|
| 1444 | lstrcat(temporary,temp2); | 
|---|
| 1445 | lstrcat(temporary,temp3); | 
|---|
| 1446 | if(bDebug) lstrcat(temporary,"_debug.exe"); | 
|---|
| 1447 | else lstrcat(temporary,".exe"); | 
|---|
| 1448 |  | 
|---|
| 1449 | hFind=FindFirstFile(temporary,&wfd); | 
|---|
| 1450 | if(hFind==INVALID_HANDLE_VALUE) return 1; | 
|---|
| 1451 | FindClose(hFind); | 
|---|
| 1452 |  | 
|---|
| 1453 | hFile=CreateFile(FileName,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); | 
|---|
| 1454 | GetFileTime(hFile,NULL,NULL,&SourceTime); | 
|---|
| 1455 | CloseHandle(hFile); | 
|---|
| 1456 |  | 
|---|
| 1457 | hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); | 
|---|
| 1458 | GetFileTime(hFile,NULL,NULL,&ExeTime); | 
|---|
| 1459 | CloseHandle(hFile); | 
|---|
| 1460 |  | 
|---|
| 1461 | if(SourceTime.dwHighDateTime<ExeTime.dwHighDateTime) return 0; | 
|---|
| 1462 | else if(SourceTime.dwHighDateTime==ExeTime.dwHighDateTime&& | 
|---|
| 1463 | SourceTime.dwLowDateTime<=ExeTime.dwLowDateTime) return 0; | 
|---|
| 1464 | return 1; | 
|---|
| 1465 | } | 
|---|