Plugin.dll sliders in FilterFactory 3.0.4

Back to technical analysis page

Filter Factory 3.0.4 will draw sliders using the Photoshop library Plugin.dll while Filter Factory 3.00 drew the sliders with custom code (and was therefore independent from Photoshop!).

Here is how you use the sliders:

PS7 plugins using Plugin.dll sliders

Slider functions in Plugin.dll of Photoshop 7

// TODO: Analyze!
int/*?*/ __cdecl AllocSlider(HWND hWnd);

// TODO: Analyze!
int/*?*/ __cdecl FreeSlider(HWND hWnd);

// This method will receive the slider position in either its value or measured with pixels.
int __cdecl GetSliderPos(HWND hWnd, BOOL bPixelPosition); // will crash if LockSliderData returns 0!

// Returns slider value. Lower 16 bit = lower range. Upper 16 bit = upper range.
DWORD __cdecl GetSliderRange(HWND hWnd);
typedef struct SliderRange_ {
	uint16_t lower;
	uint16_t upper;
} SliderRange;
SliderRange __cdecl GetSliderRange(HWND hWnd);

// TODO: Analyze!
int/*?*/ __cdecl LockSliderData(HWND hWnd);

// TODO: Analyze!
int/*?*/ __cdecl PaintSlider(HWND hWnd,int);

// This method will register the "slider" class used in dialogs.
// Called by Filter Factory like this: RegisterSlider(PTR DS:[1C008000h], PTR DS:[1C008010h]);
// The message ID returned will be used to receive slider updates
// It is calculated this way:  outMessageID=RegisterWindowMessageA("PSSlCmd")
// Attention: This function might fail if a previous UnRegisterSlider was forgotten or failed.
BOOL __cdecl RegisterSlider(HINSTANCE hInstanceDll, DWORD* outMessageID);

// TODO: Analyze!
int/*?*/ __cdecl SetSliderData(HWND hWnd,int)

// TODO: Analyze!
int/*?*/ __cdecl SetSliderFlags(HWND hWnd,int,int)

// Sets the upper range of the slider
int/*?*/ __cdecl SetSliderMax(HWND hWnd,int)

// Sets the lower range of the slider
int/*?*/ __cdecl SetSliderMin(HWND hWnd,int)

// This method will set the position of a slider. dlgitem can be retrieved with GetDlgItem(hDlg, ID_SLIDER1)
int/*?*/ __cdecl SetSliderPos(HWND dlgitem, int nPos, BOOL bRepaint);

// TODO: Analyze!
int/*?*/ __cdecl SetSliderProc(HWND hWnd,int,int)

// This method will set the range of a slider. dlgitem can be retrieved with GetDlgItem(hDlg, ID_SLIDER1)
int/*?*/ __cdecl SetSliderRange(HWND dlgitem, int nMin, int nMax);

// TODO: Analyze!
int/*?*/ __cdecl SetSliderThumbOff(HWND hWnd,int)

// TODO: Analyze!
int/*?*/ __cdecl SetSliderThumbSize(HWND hWnd,int,int)

// TODO: Analyze!
int/*?*/ __stdcall SliderWndProc(HGDIOBJ hWnd,int,int,int)

// This method will unregister the "slider" class used in dialogs.
// This method MUST be called, otherwise other calls to RegisterSlider() might fail
BOOL __cdecl UnRegisterSlider(HINSTANCE hInstanceDll);

// TODO: Analyze!
int/*?*/ __cdecl UnlockSliderData(HWND hWnd);

Download a Visual Studio test project working with sliders!

Example for putting a slider on a window

#define CTL_SLIDER1 123

void initWindow() {
    RegisterSlider(hInstance, &sliderMsgID);
    CreateWindowW(L"slider", L"", WS_CHILD | WS_VISIBLE, 10, 10, 600, 40, hWnd, (HMENU)CTL_SLIDER1, hInstance, 0);
    SetSliderRange(GetDlgItem(hWnd, CTL_SLIDER1), 0, 100);
}

void destroyWindow() {
    UnRegisterSlider(hInstance);
}

Message "PSSlCmd" (get the MessageID from RegisterSlider)

Received wParam = ID of the control

Received lParam = lower 16 bits is the position, higher 16 bits is unknown. The normal value seems to be 0x7FFB if the mouse cursor is idle and 0x7FFC - 0x7FFE if the mouse cursor is moving.