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