Okay, I've done pretty much what you said: I've loaded the DLL (successfully). I've created a class to represent my control. In that class's new() function, I invoke Win32::GUI->_new. In my main program, I position the control as usual.
The control is not rendered properly. Its "text" attribute is displayed on the main window, just as a Label would appear. I get no errors, but no features either. Question: What is the "type" parameter to _new? All the controls in Win32::GUI.pm load constants from deep in the bowels of XS. What should it be for my custom control? For my test control, I used the RoundButton control at http://www.ondotnet.com/pub/a/dotnet/2002/03/18/customcontrols.html?page =2 . My perl code to wrap it is as follows: use strict; package RoundButton; use Win32::GUI; use Tie::Hash; our @ISA = ('Tie::StdHash'); my $dll = Win32::GUI::LoadLibrary('RoundButton.dll') or die "Cannot load dll file"; sub new { my $class = shift; my $const = Win32::GUI::constant("WIN32__GUI__STATIC", 0); my $self = Win32::GUI->_new($const, $class, @_); return $self; } Why did I load Tie::Hash? Because _new() ties its argument class. I don't know why, or what to implement with the tie. Why did I choose WIN32__GUI__STATIC? It's the constant that is used in the Scintilla control. <shrug> My main program is as follows: use strict; use Win32::GUI; use RoundButton; my $mw = Win32::GUI::Window->new(-name => 'mainwin', -text => 'RoundButton Test', -height => 200, -width => 300); my $lbl = $mw->AddLabel(-name=>'lbl', -top => 30, -left => 20, -width => 100, -height => 20, -text => 'Ready.'); my $rb = RoundButton->new(-parent=>$mw, -left=>20, -top=>100, -height=>60, -width=>100, -text=>'Howdy'); $mw->Show; Win32::GUI::Dialog; exit; sub mainwin_Terminate { return -1; } Any illumination you can give would be much appreciated. Eric -----Original Message----- From: Robert May [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 4:45 PM To: Glenn Linderman; perl-win32-gui-users@lists.sourceforge.net Cc: Roode, Eric Subject: Re: [perl-win32-gui-users] Using custom controls/widgets Glenn Linderman wrote: > On approximately 5/4/2007 6:25 AM, came the following characters from > the keyboard of Roode, Eric: >> Say I create a dll containing a library of custom controls (written >> in >> C++, C#, whatever). How can I use these controls in a Win32::GUI >> program? > > Or even say someone else creates such a dll, how can I use it/them? Assuming that this is a "standard" control library that registers the classes that it needs on loading etc., then off the top of my head (no code available right now). You need to (1) Use LoadLibrary to load the DLL (2) call the (internal) Win32::GUI::_new() function as a class constructor, passing in the (Win32) Class name take the control needs as one of the arguments - this in turn calls CreateWindow(). (3) Use SendMessage to send instructions to the control and get information back from it. The Win32::GUI::Scintilla class (Scintilla.pm) should have most of the detail that you need. Rob. -- Robert May Win32::GUI, a perl extension for native Win32 applications http://perl-win32-gui.sourceforge.net/