// -----------------------------------------------------------------------
// Create a memory block for sub listbox entries
long AllocSubListBox(CStr StringToStore)
{
    long ReturnValue = 0;

    ReturnValue = (long) calloc(StringToStore.Len() + 1, 1);
    RtlCopyMemory((void *) ReturnValue, StringToStore.Get_String(), StringToStore.Len());
    return(ReturnValue);
}
示例#2
0
// -----------------------------------------------------------------------
// Search an addin in the list
long CheckAddInIniList(CStr FileName)
{
    int i = 0;
    long ReturnValue = -1;
    CStr AddInName;

    for(i = 0; i <= 999; i++)
    {
        AddInName = IniReadKey("AddIns", "File" + (CStr) StringNumberComplement(i, 3).Get_String(), MainIniFile);
        if(AddInName.Len() == 0) break;
        if(_strcmpi(AddInName.Get_String(), FileName.Get_String()) == 0)
        {
            ReturnValue = i;
            break;
        }
    }
    return(ReturnValue);
}
示例#3
0
// -----------------------------------------------------------------------
// Retrieve the library import of a API function
// (for linker errors report purposes)
CStr RetrieveAPI(void)
{
    CStr ReturnValue;
    CStr FirstSplit;
    int i = 0;
    long FoundLib = 0;
    long FoundLibLen = 0;
    CStr BufString;

    APIInfosLib = 0;
    APiLib = GetApiDescription(APIFile.Get_String(), LibToFind.Get_String());
    if(APiLib != 0)
    {
        FoundLibLen = strlen(APiLib);
        APIFuckStrLib = APIFuckStrLib.String(FoundLibLen + 1, 1);
        RtlCopyMemory(APIFuckStrLib.Get_String(), (void *) APiLib, FoundLibLen);
        APIBlockLib = StringSplit(APIFuckStrLib, "^^");
        if(StringGetSplitUBound(APIBlockLib) != -1)
        {
            FoundLib = 0;
            for(i = 0; i <= StringGetSplitUBound(APIBlockLib); i++)
            {
                FirstSplit = StringGetSplitElement(APIFuckStrLib, APIBlockLib, i);
                APIInfosLib = StringSplit(FirstSplit, "|");
                if(_strcmpi(LibToFind.Get_String(), StringGetSplitElement(FirstSplit, APIInfosLib, 0).Get_String()) == 0)
                {
                    FoundLib = 1;
                    break;
                }
                // Not found: release it
                StringReleaseSplit(APIInfosLib);
                APIInfosLib = 0;
            }
            if(FoundLib == 1) BufString = StringGetSplitElement(FirstSplit, APIInfosLib, 1);
        }
        if(APIInfosLib != 0) StringReleaseSplit(APIInfosLib);
        StringReleaseSplit(APIBlockLib);
        StringReleaseSplit((long *) APiLib);
    }
    ReturnValue = BufString;
    return(ReturnValue);
}
示例#4
0
// -----------------------------------------------------------------------
// Display API functions/constants listbox
void DisplayAPIWindow(long dx, long dy, HWND hWnd, CStr APIFncN)
{
    CStr ReturnValue;
    long EntryIndex = 0;
    long MaxName = 0;
    long MaxName2 = 0;

    if((UseDbFnc == 0) && (UseDbConst == 0)) return;
    // Retrieve all names
    ChildStruct = LoadStructure(CurrentForm);
    APIListWidth = 0;
    APIListHeight = 1;
    CreateSplashDialog(dx, dy, APIListWidth, APIListHeight, "", ChildStruct->hChildCodeMax, NULL, NULL, &FRMAPIListInitProc, &FRMAPIListWinHook, 0, 0, SW_HIDE);
    ListBoxReset(APIhListBox);
    if(FncBase != 0) if(UseDbFnc == 1) MaxName = FillAPIListBox(APIhListBox, FncBase);
    if(ConstBase != 0) if(UseDbConst == 1) MaxName2 = FillAPIListBox(APIhListBox, ConstBase);
    if(MaxName2 > MaxName) MaxName = MaxName2;
    if(MaxName != 0)
    {
        // Set sizes
        APIListWidth = (GDIGetFontWidth(FRMAPIListhWnd, APIListhFont) * MaxName) + 2 + 1 + GetSystemMetrics(SM_CXVSCROLL);
        APIListHeight = (GDIGetTextHeight(FRMAPIListhWnd, APIListhFont, "hg") * DbLinesNumbers) + 2 + 1;
        if(dx < 0) dx = 0;
        if(dy < 0) dy = 0;
        if((dx + APIListWidth) > GetSystemMetrics(SM_CXFULLSCREEN)) dx = GetSystemMetrics(SM_CXFULLSCREEN) - APIListWidth;
        if((dy + APIListHeight) > GetSystemMetrics(SM_CYFULLSCREEN)) dy = GetSystemMetrics(SM_CYFULLSCREEN) - APIListHeight;
        // Resize and display API list now
        ControlResize(FRMAPIListhWnd, dx, dy, APIListWidth, APIListHeight);
        ControlResize(APIhListBox, 1, 1, APIListWidth - 2, APIListHeight - 2);
        APIXDim = APIListWidth;
        APIYDim = APIListHeight;
        // Modify index of the listbox if necessary
        if(APIFncN.Len() != 0)
        {
            EntryIndex = SendMessage(APIhListBox, LB_FINDSTRING, -1, (long) APIFncN.Get_String());
            ListBoxSetIndex(APIhListBox, EntryIndex);
            ListBoxSetTopIndex(APIhListBox, EntryIndex);
        }
        else
        {
            ListBoxSetIndex(APIhListBox, -1);
            ListBoxSetTopIndex(APIhListBox, -1);
        }
        ControlVisible(FRMAPIListhWnd, 1);
        SetFocus(APIhListBox);
    }
    else
    {
        // Remove it
        ControlClose(FRMAPIListhWnd);
    }
}
示例#5
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));
}
示例#6
0
// -----------------------------------------------------------------------
// Retrieve the correct name of a API function
// (for corrections purposes)
CStr RetrieveAPIName(CStr APIFncN)
{
    CStr ReturnValue;
    char *MaxName = 0;
    char *MaxName2 = 0;
    CStr BufString;

    if((UseDbFnc == 0) && (UseDbConst == 0)) return(ReturnValue);
    APIInfosName = 0;
    if(FncBase != 0) if(UseDbFnc == 1) MaxName = GetAPIKeywordToCorrect(FncBase,APIFncN.Get_String());
    if(ConstBase != 0) if(UseDbConst == 1) MaxName2 = GetAPIKeywordToCorrect(ConstBase,APIFncN.Get_String());
    if((MaxName != 0) || (MaxName2 != 0))
    {
        // found in functions database ?
        if(MaxName != 0) BufString = MaxName;
        // found in constants database ?
        if(MaxName2 != 0) BufString = MaxName2;
    }
    ReturnValue = BufString;
    return(ReturnValue);
}
示例#7
0
// -----------------------------------------------------------------------
// Initialize Form
int CALLBACK FRMPrjPropsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    PAINTSTRUCT CreatePs;
    CStr BufString;

    switch(uMsg)
    {
        case WM_INITDIALOG:
            FRMPrjPropshWnd = hwndDlg;
            ControlSetText(hwndDlg, "Project properties");
            FRMPrjPropsFr1 = CreateFrame(2, -1, 202, 108, hwndDlg, "Application", 0, 0, 0);
            FRMPrjPropsFr2 = CreateFrame(206, -1, 194, 108, hwndDlg, "Version", 0, 0, 0);
            FRMPrjPropsFr3 = CreateFrame(2, 108, 398, 94, hwndDlg, "Version informations", 14, &FRMPrjPropsFrame3, 0);
            CreateLabel(5, 21 + 20, 35, 15, FRMPrjPropsFr1, "Title :", 0, 0, 0, 0);
            CreateLabel(5, 41 + 25, 52, 15, FRMPrjPropsFr1, "File type :", 0, 0, 0, 0);
            CreateLabel(131, 41 + 25, 34, 15, FRMPrjPropsFr1, "Icon :", 0, 0, 0, 0);
            FRMPrjPropsOk = CreateButton(243, 214, 77, 23, hwndDlg, "Ok", 1, 0, 0, 0, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsCancel = CreateButton(322, 214, 77, 23, hwndDlg, "Cancel", 2, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsReg = CreateButton(159, 214, 77, 23, hwndDlg, "Register", 3, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsConstants = CreateButton(3, 214, 77, 23, hwndDlg, "Constants", 4, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMPrjPropsIncludeVersion = CreateCheckBox(7, 18, 140, 15, FRMPrjPropsFr1, "Include version resource", 5, 0, WS_TABSTOP | WS_GROUP, 0);
            FRMPrjPropsTxtTitle = CreateTextBox(36, 18 + 20, 159, 20, FRMPrjPropsFr1, "", 6, 0, WS_TABSTOP | ES_AUTOHSCROLL, WS_EX_STATICEDGE);
            FRMPrjPropsFileType = CreateComboBox(5, 56 + 25, 123, 150, FRMPrjPropsFr1, "", 7, 0, CBS_DROPDOWNLIST | WS_TABSTOP);
            ComboBoxAddItem(FRMPrjPropsFileType, "UNKNOWN", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "APP", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "DLL", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "DRV", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "FONT", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "VXD", -1);
            ComboBoxAddItem(FRMPrjPropsFileType, "STATIC_LIB", -1);
            ComboBoxSetIndex(FRMPrjPropsFileType, 0);
            FRMPrjPropsSetIcon = CreateButton(133, 56 + 25, 25, 21, hwndDlg, "...", 8, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            // Current icon
            if(ProjectTypeScheduledImg.Len()) BufString = ProjectTypeScheduledImg;
            else BufString = ProjectDir + (CStr) "\\" + (CStr) ProjectTypeImg;
            FRMPrjPropsIconhandle = LoadImage(0, BufString.Get_String(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
            FRMPrjPropsIcon = CreatePictureBox(163, 43 + 25, 35, 34, FRMPrjPropsFr1, FRMPrjPropsIconhandle, IMAGE_ICON, 9, 0, SS_CENTERIMAGE);
            CreateLabel(7, 15, 52, 13, FRMPrjPropsFr2, "Major :", 0, 0, 0, 0);
            CreateLabel(99, 15, 52, 13, FRMPrjPropsFr2, "Minor :", 0, 0, 0, 0);
            CreateLabel(7, 35, 52, 13, FRMPrjPropsFr2, "Revision :", 0, 0, 0, 0);
            CreateLabel(99, 35, 52, 13, FRMPrjPropsFr2, "Release :", 0, 0, 0, 0);
            FRMPrjPropsTxtMajor = CreateTextBox(59, 12, 33, 20, FRMPrjPropsFr2, "", 10, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            FRMPrjPropsTxtMinor = CreateTextBox(151, 12, 33, 20, FRMPrjPropsFr2, "", 11, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            FRMPrjPropsTxtRevision = CreateTextBox(59, 32, 33, 20, FRMPrjPropsFr2, "", 12, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            FRMPrjPropsTxtRelease = CreateTextBox(151, 32, 33, 20, FRMPrjPropsFr2, "", 13, 0, WS_TABSTOP | ES_NUMBER, WS_EX_STATICEDGE);
            CreateLabel(7, 61, 31, 15, FRMPrjPropsFr2, "OS :", 0, 0, 0, 0);
            FRMPrjPropsOS = CreateComboBox(34, 57, 150, 150, FRMPrjPropsFr2, "", 14, 0, CBS_DROPDOWNLIST | WS_TABSTOP);
            ComboBoxAddItem(FRMPrjPropsOS, "UNKNOWN", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "DOS", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "NT", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "WINDOWS16", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "WINDOWS32", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "DOS_WINDOWS16", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "DOS_WINDOWS32", -1);
            ComboBoxAddItem(FRMPrjPropsOS, "NT_WINDOWS32", -1);
            ComboBoxSetIndex(FRMPrjPropsOS, 0);
            FRMPrjPropsIncludeXPManifest = CreateCheckBox(16, 85, 170, 15, FRMPrjPropsFr2, "Include Windows XP manifest", 15, 0, WS_TABSTOP | WS_GROUP, 0);
            CreateLabel(5, 16, 52, 13, FRMPrjPropsFr3, "Type :", 0, 0, 0, 0);
            FRMPrjPropsTypeProp = CreateListBox(5, 30, 140, 59, FRMPrjPropsFr3, 16, 0, 0, WS_TABSTOP | WS_HSCROLL, WS_EX_STATICEDGE);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Comments", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Company name", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "File description", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Legal copyright", -1);
            ListBoxAddItem( FRMPrjPropsTypeProp, "Legal trademarks", -1);
            ListBoxAddItem(FRMPrjPropsTypeProp, "Product name", -1);
            ListBoxSetIndex(FRMPrjPropsTypeProp, 0);
            FRMPrjPropsTypeTxt = CreateTextBox(147, 13 - 2, 245, 79, FRMPrjPropsFr3, "", 17, &FRMPrjPropsTypeTxtHook, WS_TABSTOP | ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | ES_WANTRETURN, WS_EX_STATICEDGE);
            LoadUserInfos();
            ControlSetText(FRMPrjPropsTxtMajor, Prj_Major);
            ControlSetText(FRMPrjPropsTxtMinor, Prj_Minor);
            ControlSetText(FRMPrjPropsTxtRevision, Prj_Revision);
            ControlSetText(FRMPrjPropsTxtRelease, Prj_Release);
            CheckBoxSetState(FRMPrjPropsIncludeVersion, Prj_IncludeVersion);
            CheckBoxSetState(FRMPrjPropsIncludeXPManifest, Prj_IncludeManifest);
            ComboBoxSetIndex(FRMPrjPropsOS, Prj_OS);
            ComboBoxSetIndex(FRMPrjPropsFileType, Prj_FileType);
            ControlSetText(FRMPrjPropsTxtTitle, ProjectTitle);
            TmpPrj_Comments = Prj_Comments;
            if(Prj_CompanyName.Len()) TmpPrj_CompanyName = Prj_CompanyName;
            TmpPrj_FileDescription = Prj_FileDescription;
            if(Prj_LegalCopyRight.Len()) TmpPrj_LegalCopyRight = Prj_LegalCopyRight;
            if(Prj_LegalTrademarks.Len()) TmpPrj_LegalTrademarks = Prj_LegalTrademarks;
            TmpPrj_ProductName = Prj_ProductName;
            ControlSetText(FRMPrjPropsTypeTxt, TmpPrj_Comments);
            FreezeTimer = 1;
            return(1);
        case WM_COMMAND:
            if((HWND) lParam == FRMPrjPropsOk)
            {
                ProjectTypeScheduledImg = NewIconFile;
                SaveProjectProperties();
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsCancel)
            {
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsConstants)
            {
                CreateConstants(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsReg)
            {
                RegisterUserInfos();
                return(0);
            }
            else if((HWND) lParam == FRMPrjPropsSetIcon)
            {
                SetProjectIcon();
                return(0);
            }
            break;
        case WM_PAINT:
            BeginPaint(hwndDlg, &CreatePs);
            GDIDrawHorzSep(hwndDlg, 0, 207, 402);
            EndPaint(hwndDlg, &CreatePs);
            break;
        case WM_CLOSE:
            FreezeTimer = 0;
            EndDialog(hwndDlg, 0);
            break;
    }
    return(0);
}
// -----------------------------------------------------------------------
// Select a font
void PropSelectFont(void)
{
    CStr FName;
    CStr BufString;
    long FSize = 0;
    HDC NextDC = 0;
    int i = 0;

    // Note: Font name must always be followed by font size
    if(strlen((char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex + 1, PROPERTY_STORAGE)) != 0)
    {
        FSize = atol((char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex + 1, PROPERTY_STORAGE));
    }
    ControlEnable(FRMDiagToolhwnd, 0);
    ControlEnable(FRMDiagTBhwnd, 0);
    ControlEnable(FRMDiagPropshwnd, 0);
    if(ComDlgChooseFont(FRMDiaghwnd, (char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_STORAGE), FSize, 0) != 0)
    {
        for(i = 0; i <= LF_FACESIZE - 1; i++)
        {
            if(MyLogFont.lfFaceName[i] == 0) break;
            FName = FName + FName.Chr(MyLogFont.lfFaceName[i]);
        }
        if(FName.Len() != 0)
        {
            BufString = MyFont.iPointSize / 10;
            SetPropertyDatas(hCurrentObject, CurrentEditControlIndex + 1, PROPERTY_STORAGE, (long) BufString.Get_String());
            SetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_STORAGE, (long) FName.Get_String());
            ControlSetText(CurrentEditControlSubEdit, FName);
            // Set size
            NextDC = GetDC(hPropListbox);
            GDIWriteClippedText(NextDC, PropCurrentLeft + 1, PropCurrentTop + 1, PropCurrentWidth - 1, PropCurrentHeight, (char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex + 1, PROPERTY_STORAGE), GetSysColor(COLOR_WINDOWTEXT), WASerifFont, 0, GetSysColor(COLOR_WINDOW));
            ReleaseDC(hPropListbox, NextDC);
            if(GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_ROUTINE) != 0) JumpToAddr((FARPROC) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_ROUTINE));
        }
    }
    ControlEnable(FRMDiagToolhwnd, 1);
    ControlEnable(FRMDiagTBhwnd, 1);
    ControlEnable(FRMDiagPropshwnd, 1);
}
// -----------------------------------------------------------------------
// Sub listboxes hook
LRESULT CALLBACK PropSubListboxHook(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
    {
        case WM_CHAR:
            switch(wParam)
            {
                case 13:
                    SelectedInList = ListBoxGetSelItemIndex(hListBoolean);
                    SelectedInListText = ListBoxGetCurrentItem(hListBoolean);
                    ControlClose(hListBoolean);
                    SetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_STORAGE, (long) SelectedInListText.Get_String());
                    ControlSetText(CurrentEditControlSubEdit, SelectedInListText);
                    // Jump to associated routine (if any)
                    if(GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_ROUTINE) != 0) JumpToAddr((FARPROC) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_ROUTINE));
                    hListBoolean = 0;
                    return(0);
                case 27:
                    SelectedInList = -1;
                    SelectedInListText = "";
                    ControlClose(hListBoolean);
                    hListBoolean = 0;
                    return(0);
            }
            break;
        // Close listbox and update the list
        case WM_LBUTTONUP:
            SelectedInList = ListBoxGetSelItemIndex(hListBoolean);
            SelectedInListText = ListBoxGetCurrentItem(hListBoolean);
            ControlClose(hListBoolean);
            SetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_STORAGE, (long) SelectedInListText.Get_String());
            ControlSetText(CurrentEditControlSubEdit, SelectedInListText);
            // Jump to associated routine (if any)
            if(GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_ROUTINE) != 0) JumpToAddr((FARPROC) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_ROUTINE));
            hListBoolean = 0;
            return(0);
    }
    return(CallWindowProc((WNDPROC) GetWindowLong(hWnd, GWL_USERDATA), hWnd, uMsg, wParam, lParam));
}
// -----------------------------------------------------------------------
// Font buttons hook in properties
LRESULT CALLBACK PropListboxHook(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    CStr StrSubListBox;
    long *ArraySub = 0;
    int i = 0;
    char *ComboSubList;

    switch(uMsg)
    {
        case WM_VSCROLL:
            if(hListBoolean != 0)
            {
                ControlClose(hListBoolean);
                hListBoolean = 0;
            }
            break;
        case WM_CTLCOLORSTATIC:
            SetBkColor((HDC) wParam, GetSysColor(COLOR_WINDOW));
            return((LRESULT) hSubEditBrush);
        case WM_COMMAND:
            if((HWND) lParam == CurrentEditControl)
            {
                switch(CurrentEditControlType)
                {
                    case PROP_BOOLEAN:
                        if(hListBoolean != 0)
                        {
                            ControlClose(hListBoolean);
                            hListBoolean = 0;
                        }
                        else
                        {
                            PropCurrentTop = ControlTop(CurrentEditControl) - 2 - ControlTop(hPropListbox) + ControlHeight(CurrentEditControl) + 2;
                            // Bound bottom coordinate
                            if(((PropCurrentHeight * 2) + (PropCurrentTop)) > ControlClientHeight(hPropListbox))
                            {
                                PropCurrentTop = PropCurrentTop - (PropCurrentHeight * 2) - ControlHeight(CurrentEditControl);
                            }
                            hListBoolean = CreateListBox(PropCurrentLeft, PropCurrentTop - 2, PropCurrentWidth, PropCurrentHeight * 2, hPropListbox, 0, &PropSubListboxHook, 0, WS_VSCROLL | WS_BORDER, 0);
                            ListBoxAddItem(hListBoolean, "False", -1);
                            ListBoxAddItem(hListBoolean, "True", -1);
                            ListBoxSetIndex(hListBoolean, ListBoxItemExist(hListBoolean, (char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_STORAGE)));
                            SelectedInList = -1;
                            SelectedInListText = "";
                            SetFocus(hListBoolean);
                        }
                        break;
                    case PROP_COMBO:
                        if(hListBoolean != 0)
                        {
                            ControlClose(hListBoolean);
                            hListBoolean = 0;
                        }
                        else
                        {
                            // Bound bottom coordinate
                            PropCurrentTop = ControlTop(CurrentEditControl) - 2 - ControlTop(hPropListbox) + ControlHeight(CurrentEditControl) + 2;
                            if(GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_EXTEND) != 0) {
                                ComboSubList = (char *) GetPropertyDatas(hCurrentObject, CurrentEditControlIndex, PROPERTY_EXTEND);
                                StrSubListBox = StrSubListBox.String(strlen(ComboSubList), 1);
                                RtlCopyMemory(StrSubListBox.Get_String(), ComboSubList, strlen(ComboSubList));
                                ArraySub = StringSplit(&StrSubListBox, "|");
                                if(StringGetSplitUBound(ArraySub) != -1)
                                {
                                    // Bound bottom coordinate
                                    if(((PropCurrentHeight * (StringGetSplitUBound(ArraySub) + 1)) + (PropCurrentTop)) > ControlClientHeight(hPropListbox))
                                    {
                                        PropCurrentTop = PropCurrentTop - (PropCurrentHeight * (StringGetSplitUBound(ArraySub) + 1)) - ControlHeight(CurrentEditControl);
                                    }
                                    hListBoolean = CreateListBox(PropCurrentLeft, PropCurrentTop - 2, PropCurrentWidth, PropCurrentHeight * (StringGetSplitUBound(ArraySub) + 1), hPropListbox, 0, &PropSubListboxHook, 0, WS_VSCROLL | WS_BORDER, 0);
                                    for(i = 0; i <= StringGetSplitUBound(ArraySub); i++)
                                    {
                                        ListBoxAddItem(hListBoolean, StringGetSplitElement(&StrSubListBox, ArraySub, i), -1);
                                    }
                                }
                                StringReleaseSplit(ArraySub);
                            }
                            ListBoxSetIndex(hListBoolean, ListBoxItemExist(hListBoolean, (char *) GetPropertyDatas(hCurrentObject,
                                                                                                                       CurrentEditControlIndex,
                                                                                                                       PROPERTY_STORAGE)));
                            SelectedInList = -1;
                            SelectedInListText = "";
                            SetFocus(hListBoolean);
                        }
                        break;
                    case PROP_FILESELECT:
                        break;
                    case PROP_FONTSELECT:
                        PropCurrentTop = ControlTop(CurrentEditControl) - ControlTop(hPropListbox) + ControlHeight(CurrentEditControl);
                        PropSelectFont();
                        break;
                }
                return(0);
            }
    }
    return(CallWindowProc((WNDPROC) GetWindowLong(hWnd, GWL_USERDATA), hWnd, uMsg, wParam, lParam));
}
示例#11
0
// -----------------------------------------------------------------------
// Fill the listview with filenames
long DllDefFillFilesList(void)
{
    int i = 0;
    CStr DefValue;
    CStr DefEntryValue;
    long ReturnValue = 0;

    DefEntryValue = IniReadKey("ENTRYPOINT", "Proc", DllDefFile);
    for(i = 0; i <= StringGetSplitUBound(DllDefArray) - 1; i++)
    {
        if(strlen(StringGetSplitElement(RealProcList, DllDefArray, i).Get_String()) != 0)
        {
            ListViewAddItem(FRMDllDefListview, StringGetSplitElement(RealProcList, DllDefArray, i), i, 0);
            if(_strcmpi(StringGetSplitElement(RealProcList, DllDefArray, i).Get_String(), DefEntryValue.Get_String()) == 0) ReturnValue = i + 1;
            ComboBoxAddItem(FRMDllDefComboBox, StringGetSplitElement(RealProcList, DllDefArray, i), -1);
            DefValue = IniReadKey("EXPORTS", StringGetSplitElement(RealProcList, DllDefArray, i), DllDefFile);
            if(DefValue.Len() != 0) ListViewSetItemCheckbox(FRMDllDefListview, i, 1);
        }
    }
    return(ReturnValue);
}
示例#12
0
// -----------------------------------------------------------------------
// Fill the languages extensions
void FillExtLanguage(void)
{
    long *ExtArray = 0;
    CStr LangToCheck;
    CStr RegEntry;
    CStr BufString;
    int i = 0;
    int j = 0;
    int k = 0;
    
    // Get default extensions (.med/.mws)
    ListViewAddItem(FRMRegsListview, "med", k, 0);
    RegEntry = RegistryGetKeyValue(HKEY_CLASSES_ROOT, ".med", "");
    if(RegEntry.Len() != 0)
    {
        if(_strcmpi(RegEntry.Get_String(), "Chromatic project file") == 0)
        {
            ListViewSetItemCheckbox(FRMRegsListview, k, 1);
        }
    }
    ListViewSetSubItem(FRMRegsListview, "(Chromatic projects)", k, 1);
    k++;
    ListViewAddItem(FRMRegsListview, "mws", k, 0);
    RegEntry = RegistryGetKeyValue(HKEY_CLASSES_ROOT, ".mws", "");
    if(RegEntry.Len() != 0)
    {
        if(_strcmpi(RegEntry.Get_String(), "Chromatic workspace file") == 0)
        {
            ListViewSetItemCheckbox(FRMRegsListview, k, 1);
        }
    }
    ListViewSetSubItem(FRMRegsListview, "(Chromatic workspaces)", k, 1);
    k++;
    for(i = 0; i <= 999; i++)
    {
        FRMRegsRetVal = IniReadKey("RefLanguages", "Ext" + (CStr) StringNumberComplement(i, 3).Get_String(), LanguagesIniFile).Trim();
        LangToCheck = IniReadKey("RefLanguages", "Lang" + (CStr) StringNumberComplement(i, 3).Get_String(), LanguagesIniFile);
        if(FRMRegsRetVal.Len() == 0) break;
        LangToCheck = ChangeRelativePaths(LangToCheck);
        LangFileToRead = LangToCheck;
        FRMRegsLangName = IniReadKey("LangSpec", "LangName", LangFileToRead);
        if(FRMRegsLangName.Len() == 0)
        {
            LangToCheck = "<Error>";
        }
        else
        {
            LangToCheck = FRMRegsLangName;
        }
        ExtArray = StringSplit(FRMRegsRetVal, " ");
        if(StringGetSplitUBound(ExtArray) != -1)
        {
            for(j = 0; j <= StringGetSplitUBound(ExtArray); j++)
            {
                ListViewAddItem(FRMRegsListview, StringGetSplitElement(FRMRegsRetVal, ExtArray, j), k, 0);
                RegEntry = RegistryGetKeyValue(HKEY_CLASSES_ROOT, "." + (CStr) StringGetSplitElement(FRMRegsRetVal, ExtArray, j).Get_String(), "");
                if(RegEntry.Len() != 0)
                {
                    BufString = "Chromatic " + (CStr) StringGetSplitElement(FRMRegsRetVal, ExtArray, j).Get_String() + (CStr) " file";
                    if(_strcmpi(RegEntry.Get_String(), BufString.Get_String()) == 0)
                    {
                        ListViewSetItemCheckbox(FRMRegsListview, k, 1);
                    }
                }
                ListViewSetSubItem(FRMRegsListview, LangToCheck, k, 1);
                k++;
            }
        }
        StringReleaseSplit(ExtArray);
    }
}
示例#13
0
// -----------------------------------------------------------------------
// Initialize Form
int CALLBACK FRMAddInsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    PAINTSTRUCT CreatePs;
    long CurrentLvItem = 0;
    long AddInIcon = 0;
    CStr RunningInIniFile;
    POINT PopMenuCoords;
    CStr OpFilters;
    CStr LdFile;
    FARPROC AddInAuthUpDate = 0;
    FARPROC AddInDescUpDate = 0;
    long OldRunningState = 0;
    CStr BufString;

    switch(uMsg)
    {
        case WM_SYSCOLORCHANGE:
            ListViewSetBackColor(FRMAddInsListView, GetSysColor(COLOR_WINDOW));
            break;
        case WM_INITDIALOG:
            FRMAddInshWnd = hwndDlg;
            ControlSetText(hwndDlg, "AddIns manager");
            FRMAddInsCmdOk = CreateButton(327, 292, 77, 23, hwndDlg, "Ok", 1, 0, 0, 0, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP, Buttons_StaticEdge);
            FRMAddInsCmdCancel = CreateButton(406, 292, 77, 23, hwndDlg, "Cancel", 2, 0, 0, 0, WS_TABSTOP, Buttons_StaticEdge);
            FRMAddInsListView = CreateListView(2, 1, 482, 278, hwndDlg, 0, GlobalImageList1, 0, LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP | LVS_EX_CHECKBOXES, LVS_REPORT | LVS_SINGLESEL | WS_TABSTOP | LVS_NOSORTHEADER, WS_EX_STATICEDGE);
            ListViewAddCol(FRMAddInsListView, "Author", 198, 0);
            ListViewAddCol(FRMAddInsListView, "Description", 265, 1);
            ListViewSetItemSel(FRMAddInsListView, 0);
            FillAddinsList();
            hAddInsMenu = CreatePopupMenu();
            MenuAddString(hAddInsMenu, "Load/Unload AddIn", ADDIN_IDBASE + ADDIN_ENABLE, TRUE);
            MenuSetDefaultItem(hAddInsMenu, 0);
            MenuAddSeparator(hAddInsMenu);
            MenuAddString(hAddInsMenu, "Display in AddIns menu", ADDIN_IDBASE + ADDIN_MENU, TRUE);
            MenuAddString(hAddInsMenu, "Remove from AddIns menu", ADDIN_IDBASE + ADDIN_REMMENU, TRUE);
            MenuAddSeparator(hAddInsMenu);
            MenuAddString(hAddInsMenu, "Update AddIn", ADDIN_IDBASE + ADDIN_UPDATE, TRUE);
            FreezeTimer = 1;
            return(0);
        case WM_PAINT:
            BeginPaint(hwndDlg, &CreatePs);
            GDIDrawHorzSep(hwndDlg, 0, 285, 486);
            EndPaint(hwndDlg, &CreatePs);
            break;
        case WM_COMMAND:
            if((HWND) lParam == FRMAddInsCmdOk)
            {
                SaveAddInList();
                ReFillAddInsArrays();
                FillAddInsMenu();
                RefreshRunningStates();
                ControlClose(hwndDlg);
                return(0);
            }
            else if((HWND) lParam == FRMAddInsCmdCancel)
            {
                ControlClose(hwndDlg);
                return(0);
            }
            switch(wParam)
            {
                case (ADDIN_ENABLE + ADDIN_IDBASE):
                    AddInIcon = ListViewGetSubItemImage(FRMAddInsListView, CurrentPopupItem, 0);
                    if(AddInIcon == ICON_ADDINR) AddInIcon = ICON_ADDINS;
                    else AddInIcon = ICON_ADDINR;
                    ListViewSetSubItemImage(FRMAddInsListView, AddInIcon, CurrentPopupItem, 0);
                    return(0);
                case (ADDIN_MENU + ADDIN_IDBASE):
                    ListViewSetItemCheckbox(FRMAddInsListView, CurrentPopupItem, 1);
                    return(0);
                case (ADDIN_REMMENU + ADDIN_IDBASE):
                    ListViewSetItemCheckbox(FRMAddInsListView, CurrentPopupItem, 0);
                    return(0);
                case (ADDIN_UPDATE + ADDIN_IDBASE):
                    OpFilters = AppTitle + (CStr) " AddIn (*.dll)|*.dll";
                    LdFile = ComDlgGetOpenFileName(hwndDlg, OpFilters, LastAddInDir, 0, CurrentDir);
                    if(LdFile.Len() != 0)
                    {
                        // Check if the AddIn is located in AddIns directory
                        if(_strcmpi(FileGetDirectory(LdFile).Get_String(), Dirs[DIR_ADDINS]) == 0)
                        {
                            MiscMsgBox(hwndDlg, "New AddIn can't be located in AddIns directory.", MB_ERROR, Requesters);
                            return(0);
                        }
                        // Check if file exist
                        if(FileExist(Dirs[DIR_ADDINS] + (CStr) "\\" + (CStr) FileGetFileName(LdFile)) == 0)
                        {
                            MiscMsgBox(hwndDlg, "No corresponding AddIn found.", MB_ERROR, Requesters);
                            return(0);
                        }
                        // Check if names are identicals
                        if(_strcmpi(LocalAddInsFiles.Get(CurrentPopupItem)->Content,
                                   FileGetFileName(LdFile).Get_String()) != 0)
                        {
                            MiscMsgBox(hwndDlg, "AddIn name doesn't match.", MB_ERROR, Requesters);
                            return(0);
                        }
                        if(IsAddIn(LdFile) == 0)
                        {
                            MiscMsgBox(hwndDlg, "Not a Chromatic AddIn.", MB_ERROR, Requesters);
                            return(0);
                        }
                        // Step 1: Shutdown it
                        OldRunningState = ShutDownAddIn(CurrentPopupItem);
                        // Step 2: Delete it
                        BufString = Dirs[DIR_ADDINS] + (CStr) "\\" + (CStr) LocalAddInsFiles.Get(CurrentPopupItem)->Content;
                        DeleteFile(BufString.Get_String());
                        // Step 3: Copy it
                        CopyFile(LdFile.Get_String(), BufString.Get_String(), 0);
                        // Step 4: Restart it
                        RunningAddIns.Set(CurrentPopupItem, OldRunningState);
                        if(RestartAddIn(CurrentPopupItem) == 0)
                        {
                            MiscMsgBox(hwndDlg, "Can't update this AddIn.", MB_ERROR, Requesters);
                            return(0);
                        }
                        SetForegroundWindow(FRMAddInshWnd);
                        SetActiveWindow(FRMAddInshWnd);
                        // Step 5: Update listview with possible new infos
                        AddInDescUpDate = GetProcAddress(AddInsDLL.Get(CurrentPopupItem)->Content, "AddInDescription");
                        AddInAuthUpDate = GetProcAddress(AddInsDLL.Get(CurrentPopupItem)->Content, "AddInAuthor");
                        ListViewSetSelItemText(FRMAddInsListView, GetDLLDescription(LocalAddInsFiles.Get(CurrentPopupItem)->Content, AddInDescUpDate), 0);
                        ListViewSetSelItemText(FRMAddInsListView, GetDLLAuthor(AddInAuthUpDate), 1);
                        LastAddInDir = FileGetDirectory(LdFile);
                        MiscMsgBox(hwndDlg, "AddIn '" + GetDLLDescription(LocalAddInsFiles.Get(CurrentPopupItem)->Content, AddInDescUpDate) + (CStr) "' updated.", MB_INFORMATION, Requesters);
                    }
                    return(0);
            }
            break;
        case WM_NOTIFY:
            if(ControlGetNotifiedhWnd(lParam) == FRMAddInsListView)
            {
                switch(ControlGetNotifiedMsg(lParam))
                {
                    case NM_DBLCLK:
                        CurrentLvItem = ListViewGetItemUnderCursor(FRMAddInsListView);
                        if(CurrentLvItem != -1)
                        {
                            AddInIcon = ListViewGetSubItemImage(FRMAddInsListView, CurrentLvItem, 0);
                            if(AddInIcon == ICON_ADDINR) AddInIcon = ICON_ADDINS;
                            else AddInIcon = ICON_ADDINR;
                            ListViewSetItemSel(FRMAddInsListView, CurrentLvItem);
                            ListViewSetSubItemImage(FRMAddInsListView, AddInIcon, CurrentLvItem, 0);
                        }
                        return(0);
                }
            }
            break;
        case WM_CONTEXTMENU:
            CurrentLvItem = ListViewGetItemUnderCursor(FRMAddInsListView);
            if(CurrentLvItem != -1)
            {
                ListViewSetItemSel(FRMAddInsListView, CurrentLvItem);
                CurrentPopupItem = ListViewGetItemUnderCursor(FRMAddInsListView);
                SetFocus(FRMAddInsListView);
                GetCursorPos(&PopMenuCoords);
                TrackPopupMenu(hAddInsMenu, TPM_LEFTALIGN + TPM_LEFTBUTTON, PopMenuCoords.x, PopMenuCoords.y, 0, hwndDlg, NULL);
            }
            return(0);
        case WM_CLOSE:
            if(hAddInsMenu != 0) DestroyMenu(hAddInsMenu);
            FreezeTimer = 0;
            FRMAddInsListView = 0;
            EndDialog(hwndDlg, 0);
    }
    return(0);
}
示例#14
0
// -----------------------------------------------------------------------
// Refresh the running states of the addins after manager modifications
void RefreshRunningStates(void)
{
    long OldAddInIndex = 0;
    long AddInIndex = 0;
    CStr AddInFileName;
    CStr AddInRunning;
    int i = 0;

    // Run them or not
    for(i = 0; i <= 999; i++)
    {
        AddInFileName = IniReadKey("AddIns", "File" + (CStr) StringNumberComplement(i, 3).Get_String(), MainIniFile);
        AddInRunning = IniReadKey("AddIns", "Running" + (CStr) StringNumberComplement(i, 3).Get_String(), MainIniFile);
        if(AddInFileName.Len() == 0) break;
        OldAddInIndex = SearchOldAddInName(AddInFileName);
        if(OldAddInIndex != -1)
        {
            // Want to it to run ?
            if(_strcmpi(AddInRunning.Get_String(), "1") == 0)
            {
                // Let's run it (if it wasn't running before)
                if(OldRunningAddIns.Get(OldAddInIndex)->Content != 1)
                {
                    AddInIndex = SearchAddInName(AddInFileName);
                    if(AddInsLoad.Get(AddInIndex)->Content != 0)
                    {
                        switch(JumpToAddrArg(AddInsLoad.Get(AddInIndex)->Content, (long) &AddInLib))
                        {
                            case ADDIN_FINISHED:
                                RunningAddIns.Set(AddInIndex, 0);
                                // Unload it now
                                if(AddInsUnLoad.Get(AddInIndex)->Content != 0)
                                {
                                    JumpToAddr(AddInsUnLoad.Get(AddInIndex)->Content);
                                    IniWriteKey("AddIns", "Running" + (CStr) StringNumberComplement(i, 3).Get_String(), "0", MainIniFile);
                                }
                                break;
                            case ADDIN_PERSISTANT:
                                RunningAddIns.Set(AddInIndex, 1);
                                // Mark it as persistantly running
                                IniWriteKey("AddIns", "Running" + (CStr) StringNumberComplement(i, 3).Get_String(), "1", MainIniFile);
                                break;
                        }
                    }
                }
            }
            else
            {
                // Let's stop it (if it wasn't stopped before)
                if(OldRunningAddIns.Get(OldAddInIndex)->Content != 0)
                {
                    AddInIndex = SearchAddInName(AddInFileName);
                    if(AddInsUnLoad.Get(AddInIndex)->Content != 0)
                    {
                        JumpToAddr(AddInsUnLoad.Get(AddInIndex)->Content);
                        IniWriteKey("AddIns", "Running" + (CStr) StringNumberComplement(i, 3).Get_String(), "0", MainIniFile);
                    }
                }
            }
        }
        else
        {
            // Not found to check if user wants it to be running now
            if(_strcmpi(AddInRunning.Get_String(), "1") == 0)
            {
                AddInIndex = SearchAddInName(AddInFileName);
                if(AddInsLoad.Get(AddInIndex)->Content != 0)
                {
                    switch(JumpToAddrArg(AddInsLoad.Get(AddInIndex)->Content, (long) &AddInLib))
                    {
                        case ADDIN_FINISHED:
                            RunningAddIns.Set(AddInIndex, 0);
                            // Unload it now
                            if(AddInsUnLoad.Get(AddInIndex)->Content != 0)
                            {
                                JumpToAddr(AddInsUnLoad.Get(AddInIndex)->Content);
                                IniWriteKey("AddIns", "Running" + (CStr) StringNumberComplement(i, 3).Get_String(), "0", MainIniFile);
                            }
                            break;
                        case ADDIN_PERSISTANT:
                            RunningAddIns.Set(AddInIndex, 1);
                            // Mark it as persistantly running
                            IniWriteKey("AddIns", "Running" + (CStr) StringNumberComplement(i, 3).Get_String(), "1", MainIniFile);
                            break;
                    }
                }
            }
        }
    }
}
示例#15
0
// -----------------------------------------------------------------------
// The the listview with found AddIns
void FillAddinsList(void)
{
    int i = 0;
    CStr AddInName;
    HMODULE AddInLib = 0;
    FARPROC AddInDesc = 0;
    FARPROC AddInAuth = 0;
    FARPROC AddInLoad = 0;
    FARPROC AddInUnload = 0;
    FARPROC AddInMenu = 0;
    CStr Description;
    CStr Auth;
    long PosInIniFile = 0;
    CStr LoadedInIniFile;
    long AddInIcon = 0;
    CStr RunningInIniFile;
    CStr BufString;

    AddInName = FileDir(&((CStr) Dirs[DIR_ADDINS] + (CStr) "\\*.dll"));
    LocalAddInsFiles.Erase();
    while(AddInName.Len() != 0)
    {
        BufString = Dirs[DIR_ADDINS] + (CStr) "\\" + (CStr) AddInName;
        AddInLib = LoadLibrary(BufString.Get_String());
        if(AddInLib != 0)
        {
            AddInDesc = GetProcAddress(AddInLib, "AddInDescription");
            AddInAuth = GetProcAddress(AddInLib, "AddInAuthor");
            AddInLoad = GetProcAddress(AddInLib, "AddInLoad");
            AddInUnload = GetProcAddress(AddInLib, "AddInUnLoad");
            AddInMenu = GetProcAddress(AddInLib, "AddInMenu");
            // Must have all procedures
            if(AddInDesc != 0 && AddInAuth != 0 && AddInLoad != 0 && AddInUnload != 0 && AddInMenu != 0)
            {
                Description = GetDLLDescription(AddInName, AddInDesc);
                Auth = GetDLLAuthor(AddInAuth);
                AddInIcon = ICON_ADDINR;
                PosInIniFile = CheckAddInIniList(AddInName);
                if(PosInIniFile != -1)
                {
                    // Check if it is running if found in ini file
                    RunningInIniFile = IniReadKey("AddIns", "Running" + (CStr) StringNumberComplement(PosInIniFile, 3).Get_String(), MainIniFile);
                    if(_strcmpi(RunningInIniFile.Get_String(), "1") == 0) AddInIcon = ICON_ADDINS;
                }
                ListViewAddItem(FRMAddInsListView, Description, i, AddInIcon);
                ListViewSetSubItem(FRMAddInsListView, Auth, i, 1);
                // Check in the ini file if it's been already loaded
                PosInIniFile = CheckAddInIniList(AddInName);
                if(PosInIniFile != -1)
                {
                    LoadedInIniFile = IniReadKey("AddIns", "Loaded" + (CStr) StringNumberComplement(PosInIniFile, 3).Get_String(), MainIniFile);
                    if(LoadedInIniFile.Len() != 0)
                    {
                        if(_strcmpi(LoadedInIniFile.Get_String(), "1") == 0)
                        {
                            ListViewSetItemCheckbox(FRMAddInsListView, i, 1);
                        }
                        else
                        {
                            ListViewSetItemCheckbox(FRMAddInsListView, i, 0);
                        }
                    }
                    else
                    {
                        ListViewSetItemCheckbox(FRMAddInsListView, i, 0);
                    }
                }
                LocalAddInsFiles.Add(AddInName.Get_String());
                i++;
            }
            FreeLibrary(AddInLib);
            // Dlg_Filters.cpp for more infos
            #ifndef _DEBUG
                CloseHandle(AddInLib);
            #endif
        }
        AddInName = FileDir();
    }
}
示例#16
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);
}