// ----------------------------------------------------------------------- // 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); }
// ----------------------------------------------------------------------- // 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)); }
// ----------------------------------------------------------------------- // 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); }