Win3x.Org
http://www.win3x.org/win3board/

Programming with CTL3D.DLL
http://www.win3x.org/win3board/viewtopic.php?f=79&t=14706
Page 1 sur 1
Auteur :  Capitaine [ 11 févr. 2013 18:09 ]
Sujet du message :  Programming with CTL3D.DLL

A short explanation about the usage of CTL3D.DLL

By trying to compile some code lines with VC 1.52, I found a program that used 3D controls with Ctl3dRegister and Ctl3dUnAutoSubclass features.

I cannot obviously compile it... because CTL3D.H, CTL3D.LIB or CTL3DS.LIB aren't in the Resource Kit 3.1 and these features are not documented... :roll:

The KB97361 article is supposed to explain that... but the download link is dead!

I managed to find CTL3D.DLL and CTL3DV2.DLL, though.
CTL3D.DLL and CTL3DV2.DLL (23 Ko) Clics : 129

To return to my code lines: when I attempted to compile them, I was still without the header and libs. So, I created functions to dynamically and transparent add 3D effects.
The following example is interesting since it can work as well in 16-bit as in 32-bit environments, without any error message due to lack of DLL file.
#include <windows.h>

HINSTANCE	hCtl3d;

void WINAPI Ctl3dLoad(HINSTANCE hInst)
{
	BOOL (WINAPI *Ctl3dRegister)(HANDLE);
	BOOL (WINAPI *Ctl3dAutoSubclass)(HANDLE);

	SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
	hCtl3d = LoadLibrary("ctl3dv2.dll");
	if ((UINT)hCtl3d <= HINSTANCE_ERROR)
		hCtl3d = LoadLibrary("ctl3d.dll");

	if ((UINT)hCtl3d <= HINSTANCE_ERROR)
	{
		hCtl3d = 0;
		return;
	}	

	Ctl3dRegister = (BOOL (WINAPI *)(HANDLE))GetProcAddress(hCtl3d, "Ctl3dRegister");
	Ctl3dAutoSubclass = (BOOL (WINAPI *)(HANDLE))GetProcAddress(hCtl3d, "Ctl3dAutoSubclass");

	if (Ctl3dRegister && Ctl3dAutoSubclass)
	{
		Ctl3dRegister(hInst);
		Ctl3dAutoSubclass(hInst);
	}

	SetErrorMode(0);
}

void WINAPI Ctl3dUnload(HINSTANCE hInst)
{
	BOOL (WINAPI *Ctl3dUnRegister)(HANDLE);

	if (hCtl3d)
	{
		Ctl3dUnRegister = (BOOL (WINAPI *)(HANDLE))GetProcAddress(hCtl3d, "Ctl3dUnRegister");
		if (Ctl3dUnRegister)
			Ctl3dUnRegister(hInst);

		FreeLibrary(hCtl3d);
	}
}

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{                              
	Ctl3dLoad(hInstance);
	MessageBox(NULL, "With CTL3D", "Test", MB_OK + MB_ICONINFORMATION);

	Ctl3dUnload(hInstance);
	MessageBox(NULL, "Without CTL3D", "Test", MB_OK + MB_ICONINFORMATION);

	return FALSE;
}
The change : [ img ] ==> [ img ]

[ img ]
The missing archive is useful because its help file explains how to get 3D effects in Pascal or Visual Basic.

Naturally, for the only purpose of programming in 32-bit environment, there is no point :mrgreen:

Auteur :  le chef suprême [ 11 févr. 2013 21:06 ]
Sujet du message :  Re: Programming with CTL3D.DLL

Waouh, that's amazing :o

Auteur :  Jajan [ 03 janv. 2014 14:52 ]
Sujet du message :  Re: Programming with CTL3D.DLL

It's actually the same on Windows NT 3.xx


----
Publié : Vendredi 11 Avril 2014 17:30:28

I succeeded to find the lost archive: ctl3d.exe

Page 1 sur 1 Fuseau horaire sur UTC+02:00
Développé par phpBB® Forum Software © phpBB Limited
Traduction française officielle © Qiaeru