Migrating Legacy Custom Control DLL

This forum designated to discuss the Resource Builder
Post Reply
seek2fly
Posts: 2
Joined: Thu Oct 13, 2011 10:44 pm

Migrating Legacy Custom Control DLL

Post by seek2fly »

I need to upgrade a custom control DLL (for which we have the source code) so that it is compatible with Resource Builder's Custom Control Dialog Editor.

Goal: Allow us to use Resource Builder for this DLL such that the available controls appear in the Custom Control Available Controls list in the Dialog Editor configuration screen and function similarly to the sample DLL.

In short: I need to add ListClasses and all related functions.

Issues: I know C/C++, can export functions but I do not have experience with resources. I need assistance to convert/link to the existing resource control code in the exiting DLL and do not know where to start.

Platform: Visual Studio 2005 and 2008, C/C++.

I have created and exported a ListClasses function.
I have created Info, Style and Flags functions with only contents for the Info functions.
The existing code has "CustomControlsInfoA" and supporting functions from which I derive my ListClasses code.
I need to be able to:
1) Debug my DLL when adding it to the Resource Builder. I need to see evidence that my ListClasses function is being called.
2) I need to know if there are requirements regarding shared memory/objects for Resource Builder to access the DLL functions.
3) Do I need specific ordinals
4) The DLL has to continue to function is the target applications as it currently does.

Any assistance to get us on the right track would be appreciated.

Help!
Thanks in advance!

seek2fly
Posts: 2
Joined: Thu Oct 13, 2011 10:44 pm

Calling convention

Post by seek2fly »

Progress relating to previous post:

I have constructed and tested ListClasses and Info functions using my own exe calling my resource DLL. Resource Builder succeeds at running ListClasses but appears to get Access Violations when calling the Info functions.

It appears I have one of two problems:
1) I am not respecting Resource Builder's calling convention for the Info functions as stored in the class list structures.
2) I am compiling with the wrong header files, thus conflicting with what Resource Builder expects.

Where can I get:
a) Calling convention / programming standards for Resource Builder (stdcall, cdecl)?
b) Where can I get the proper custcntl.h file to comply with what Resource Builder uses.

The custctrl.h file I am using comes from the Borland Resource Workshop from which the original DLL I am trying to port comes from.

Any help from anyone would be great. It I can't crack this we will need to ditch using Resource Builder and use a plan B as my allocated time has run out.

Thanks in advance!
M.

isiticov
Site Admin
Posts: 2268
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hello,

1. All functions shall be with stdcall calling convention.
2. All records should be packed. It means no padding in fields.
3. All char[] fields shall be ANSI chars (single byte) not Unicode (2 bytes).
4. The returned pointers to Info strectures shall point to memory allocated by GlobalAlloc() with GMEM_SHARE flag.
There is Pascal sample unit and project that implements custom controls library. You can always check it to find the differences (if any) with your code.
Hope this helps.
Best regards,
Igor Sitikov.

Post Reply