Win3x.Org

Windows & DOS Community

Programming with CTL3D.DLL

Répondre   Page 1 sur 1  [ 3 messages ]
Auteur Message
Capitaine
Sujet du message : Programming with CTL3D.DLL
Publié : 11 févr. 2013 18:09
Membre inscrit
Hors-ligne
 
Messages : 58
Inscription : 06 juin 2004 10:31
 
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 : 68

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:


Haut
Profil Citer
le chef suprême
Sujet du message : Re: Programming with CTL3D.DLL
Publié : 11 févr. 2013 21:06
Membre inscrit
Avatar de l’utilisateur
Hors-ligne
 
Messages : 331
Inscription : 02 juin 2006 18:57
 
Waouh, that's amazing :o


Haut
Profil Citer
Jajan
Sujet du message : Re: Programming with CTL3D.DLL
Publié : 03 janv. 2014 14:52
Membre d'honneur
Avatar de l’utilisateur
Hors-ligne
 
Messages : 1058
Inscription : 01 mai 2010 19:44
PC Rétro : Mon boulier !
 
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


Haut
Profil
Afficher : Trier par : Ordre :
Répondre   Page 1 sur 1  [ 3 messages ]
Revenir à « Resources »
Aller :