示例#1
0
// -----------------------------------------------------------------------
// Change the icon associated with the project
void SetProjectIcon(void)
{
    CStr LdFile;
    CStr OpFilters;
    CStr IconDir;

    OpFilters = "Icon files (*.ico)|*.ico";
    LdFile = ComDlgGetOpenFileName(FRMPrjPropshWnd, OpFilters, LastPrjIconDir, 0, CurrentDir);
    if(LdFile.Len() == 0) return;
    IconDir = FileGetDirectory(LdFile);
    if(strcmp(IconDir.Right(1).Get_String(), "\\") == 0) IconDir = IconDir.Left(IconDir.Len() - 1);
    LastPrjIconDir = IconDir;
    NewIconFile = LdFile;
    PictureBoxChangeIcon(FRMPrjPropsIcon, (HICON) LoadImage(0, LdFile.Get_String(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE));
}
示例#2
0
void
CIniFile::Parse( LPCTSTR cont )
{
	CStr content = cont;
	CStr sectionName, key, value;
    CMapStrToString *section = NULL;
	BOOL hasEmptySection = FALSE;

	Sections.RemoveAll();

	while ( content.GetLength() > 0 )
	{
		CStr line;
		int pos = content.Find( _T("\n") );
		if ( pos != -1 )
		{
			line    = content.Left( pos );
			content = content.Mid( pos+1 );
		}
		else
		{
			line = content;
			content = _T("");
		}
		line.TrimLeft(); line.TrimRight();

		if ( line.GetLength() > 0 && line.GetAt(0) != '#' && line.GetAt(0) != ';' )
		{
			if ( line.GetAt(0) == '[' && line.Right(1) == L"]" )
			{
				sectionName = line.Mid( 1, line.GetLength()-2 );
                sectionName.MakeLower();
                section = new CMapStrToString();
                Sections.SetAt( sectionName, section );
			}
			else
			{
				int eqPos = line.Find( '=' );
				if ( eqPos != -1 )
				{
					key   = line.Left( eqPos );
					key.TrimLeft(); key.TrimRight();
					value = line.Mid( eqPos+1 );
					value.TrimLeft(); value.TrimRight();
					if ( value.Left(1) == L"\"" && value.Right(1) == L"\"" )
					{
						value = value.Mid( 1, value.GetLength()-2 );
					}
					key.MakeLower();
					if ( section == NULL && hasEmptySection == FALSE )
					{
						section = new CMapStrToString();
						Sections.SetAt( L"", section );
						hasEmptySection = TRUE;
					}
					section->SetAt( key, value );
				}
			}
		}
	}
}
示例#3
0
// -----------------------------------------------------------------------
// Display an API function
// (for API name displaying purposes)
CStr DisplayAPI(long dx, long dy)
{
    CStr ReturnValue;
    CStr StArgs;
    CStr FirstSplit;
    CStr SecondSplit;
    int i = 0;
    int j = 0;
    long FoundLibLen = 0;
    CStr BufString;

    APIX = 0;
    APIY = 0;
    APIDescription = GetApiDescription(APIFile.Get_String(), APIFnc.Get_String());
    if(APIDescription != 0)
    {
        FoundLibLen = strlen(APIDescription);
        APIFuckStr = APIFuckStr.String(FoundLibLen + 1, 1);
        RtlCopyMemory(APIFuckStr.Get_String(), (void *) APIDescription, FoundLibLen);
        APIBlock = StringSplit(APIFuckStr, "^^");
        APIFound = 0;
        if(StringGetSplitUBound(APIBlock) != -1)
        {
            for(i = 0; i <= StringGetSplitUBound(APIBlock); i++)
            {
                FirstSplit = StringGetSplitElement(APIFuckStr, APIBlock, i);
                APIInfos = StringSplit(FirstSplit, "|");
                if(_strcmpi(APIFnc.Get_String(), StringGetSplitElement(FirstSplit, APIInfos, 0).Upper_Case().Get_String()) == 0)
                {
                    APIFound = 1;
                    break;
                }
                // Not found: release it
                StringReleaseSplit(APIInfos);
                APIInfos = 0;
            }
            StringReleaseSplit(APIBlock);
            if(APIFound == 1)
            {
                // Firstsplit = last found entry
                SecondSplit = StringGetSplitElement(FirstSplit, APIInfos, 3);
                APIArgs = StringSplit(SecondSplit, ",");
                if(StringGetSplitUBound(APIArgs) == 0) if(strcmp(StringGetSplitElement(SecondSplit, APIArgs, 0).Get_String(), "-") == 0) goto NoArgs;
                for(i = 0; i <= StringGetSplitUBound(APIArgs); i++)
                {
                    if(i == 2) break;
                    StArgs = StArgs + (CStr) StringGetSplitElement(SecondSplit, APIArgs, i).Get_String() + (CStr) ",";
                }
                StArgs = StArgs + "\r\n";
                while(i <= StringGetSplitUBound(APIArgs))
                {
                    for(j = 0; j <= StringGetSplitUBound(APIArgs); j++)
                    {
                        if(j == 2) break;
                        if((i + j) > StringGetSplitUBound(APIArgs)) break;
                        StArgs = StArgs + StringGetSplitElement(SecondSplit, APIArgs, i + j).Get_String() + (CStr) ",";
                    }
                    i = j + i;
                    StArgs = StArgs + "\r\n";
                }
                if(strcmp(StArgs.Right(3).Get_String(), ",\r\n") == 0) StArgs = StArgs.Left(StArgs.Len() - 3).Get_String() + (CStr) "\r\n";
NoArgs:         
                APIString = "Function: " + (CStr) StringGetSplitElement(FirstSplit, APIInfos, 0).Get_String() + (CStr) "\r\n";
                APIString = APIString + "Import lib: " + (CStr) StringGetSplitElement(FirstSplit, APIInfos, 1).Get_String() + (CStr) "\r\n";
                APIString = APIString + "Return: " + (CStr) StringGetSplitElement(FirstSplit, APIInfos, 2).Get_String() + (CStr) "\r\n";
                if(StringGetSplitUBound(APIArgs) == 0) if(strcmp(StringGetSplitElement(SecondSplit, APIArgs, 0).Get_String(), "-") == 0) goto NoStoreArgs;
                APIString = APIString + "Arguments (" + (CStr) (StringGetSplitUBound(APIArgs) + 1) + (CStr) ") : \r\n" + (CStr) StArgs + (CStr) "\r\n";
                goto StoreArgs;
NoStoreArgs:    APIString = APIString + "-\r\n\r\n";
StoreArgs:      MaxAPIArgs = StringGetSplitUBound(APIArgs);
                StringReleaseSplit(APIArgs);
                APIString = APIString + "Note: " + (CStr) StringGetSplitElement(FirstSplit, APIInfos, 4).Get_String() + (CStr) "\r\n";
                APIString = APIString + "WinNT: " + (CStr) StringGetSplitElement(FirstSplit, APIInfos, 5).Get_String() + (CStr) "\r\n";
                APIString = APIString + "Win95: " + (CStr) StringGetSplitElement(FirstSplit, APIInfos, 6).Get_String() + (CStr) "\r\n";
                APIString = APIString + "Win32s: " + (CStr) StringGetSplitElement(FirstSplit, APIInfos, 7).Get_String();
                if(APIhText == 0)
                {
                    ChildStruct = LoadStructure(CurrentForm);
                    CreateSplashDialog(dx, dy, 1, 1, "", ChildStruct->hChildCodeMax, 0, 0, &FRMAPIInitProc, &FRMAPIWinHook, 0, WS_DISABLED, SW_HIDE);
                }
                if(APIhText != 0)
                {
                    APIArrParse = StringSplit(APIString, "\r\n");
                    if(APIhFont != 0) DeleteObject(APIhFont);
                    APIhFont = GDIObtainFont(CurFontName, CurFontSize, hMDIform.hWnd, 0, 0);
                    if(APIhFontBold == 0) DeleteObject(APIhFontBold);
                    APIhFontBold = GDIObtainFont(CurFontName, CurFontSize, hMDIform.hWnd, 1, 0);
                    ControlVisible(APIhText, 1);
                    SendMessage(APIhText, WM_PAINT, 0, 0);
                }
                // Save API name
                BufString = StringGetSplitElement(FirstSplit, APIInfos, 0);
            }
            if(APIInfosLib != 0) StringReleaseSplit(APIInfos);
        }
        FreeMem((long) APIDescription);
    }
    ReturnValue = BufString;
    return(ReturnValue);
}