March 28, 2024, 03:13:36 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Catfood Software Utility DLL - RLIB.DLL

Started by h3kt0r, December 31, 2019, 01:01:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

h3kt0r

December 31, 2019, 01:01:32 AM Last Edit: January 24, 2020, 01:47:57 PM by h3kt0r Reason: attachment
Found this DLL that may be interesting to someone.
I think it might be used in an iwBasic application but i still have
to write a sample program to test its functions.

Detailed instructions are contained within the following header files:

DLList.h - Linked list functions
Hyperlink.h - Hyperlink control for use in dialog boxes
GDIMagic.h - Transparant BitBlt and StretchBlt
MButton.h - Web style rollover controls
AClock.h - Analog clock control


Package attached to this post.

h3kt0r

January 23, 2020, 10:22:59 AM #1 Last Edit: January 24, 2020, 02:09:55 AM by h3kt0r Reason: removed attachment
I've started to work on a sample program to demonstrate the RLIB functions and i went into some trouble
with the "TBitBlt" function. This function accepts the exact same parameters as "BitBlt" except it adds one
more parameter, which is the transparent color.
This parameter is passed to the function in the form of a "COLORREF" value which is defined by the "Win32
Programmer's Reference" as follows :


QuoteThe COLORREF value is a 32-bit value used to specify an RGB color.

Remarks

When specifying an explicit RGB color, the COLORREF value has the following hexadecimal form:

0x00bbggrr


The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF.

So, i'm creating a BITMAP in a memory DC, fill it with the transparent color (which is pink), then write a text string
and call the function with the color value in hexadecimal form (which is 0xFF00FF).
But this does not work :

QuoteCompiling...
RLIB_Sample.iwb
File: A:\Project\rlib\RLIB_Sample.iwb (117) Error: Unable to convert int to structure
Error(s) in compiling A:\Project\rlib\RLIB_Sample.iwb
When i replace the COLORREF parameter by an INTEGER, the program compiles and the BITMAP is transferred

on the window canvas, but the transparent color too. (See compiled sample in attached file).

My question is : how do i use this COLORREF parameter to make the program work correctly ?

Andy

Hi,

Well it depends on what you are asking, if it works passing an integer then that's simple.

There are posts on here to convert hex to decimal, but for a quick start, you can use my string map function

SMHexToDec

Link is here:
https://www.ionicwind.com/forums/index.php?topic=5866.msg43398#msg43398

All you have to do is then is use VAL to get the integer value and pass that instead of the hex value.

If the transparency is the problem, I'm sure someone with better graphics knowledge can help out.

Andy.
 
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

h3kt0r

January 23, 2020, 10:00:04 PM #3 Last Edit: January 23, 2020, 10:52:26 PM by h3kt0r
Thank you, i'll give this a try.

I've updated the code for the sample program, see attached ZIP file in the first post...

If someone could have a look at what i'm trying to do and give some advice, that would be great.

aurelCB

This example confused me a lot ,first i don't see any advantage of using this DLL over already built in
win32 BitBlt , second i get whole bunch of errors under EB.(yes i still use that oldie)

My question is do you try same thing using just API functions?

h3kt0r

January 24, 2020, 01:58:24 AM #5 Last Edit: January 24, 2020, 02:00:49 AM by h3kt0r
This is an exercise. I just want to learn to use a simple DLL written in C language.
So, now i've created a project file, added some resources (images for the bitmap button).
I've found out that the HINSTANCE member of the MBUTTON_DATA TYPE does :

QuoteIdentifies the instance of the module whose executable file contains the bitmap to be loaded.
Which is a good thing. Still, i have no clue where i can find this instance.

Whenever i replace HINSTANCE by a UINT, the linker spits out that error :

QuoteCompiling Resources...
No Errors

Compiling...
RLIB_Sample.iwb

Linking...
IWBasic Linker v1.11 Copyright © 2011 Ionic Wind Software
Unresolved external _ib_main
Error: C:\iwbdev\libs\winmain.o - Unresolved extern _ib_main
Error(s) in linking RLIB_Sample.exe
So, i guess i have to stick with it.  Someone knows something about HINSTANCE ?


P.S : files updated, see first post to get attachment...

Brian

I think you will find HINSTANCE is an INT

Brian

h3kt0r

Fine; So, as it would not compile as a project with resources, i've modified the source to let the
program load bitmap files from the disk.
I've also swapped HINSTANCE for UINT and found an API call* to pass a value to the "hInstRes" member
of the "MBUTTON_DATA" TYPE.
It compiles okay but when i run the program, it won't display the button bitmaps on the static control.
That's it for now. I'll keep on searching until everything works, meanwhile, every suggestion is welcome.

*_GetModuleHandle(NULL)

Brian

January 24, 2020, 03:48:36 AM #8 Last Edit: January 24, 2020, 03:51:01 AM by Brian
Well, I managed to get it to compile as a project. Did you forget to put $main at the top? Won't conpile as a project without it
And you appear to be using an old version of the windows sdk include files
Brian

h3kt0r

Ooops ! You're absolutely right. I forgot to put "$Main" at the top.
As for the include file, i don't know what to say except that i've got the SDK includes from
the Sapero installation program found on this forum...

Brian

January 24, 2020, 11:02:23 AM #10 Last Edit: January 24, 2020, 11:06:23 AM by Brian
Well, if you are using Sapero's files, the $include statement should be $include "windowssdk.inc" and not just "windows.inc"

I have had a go with your program, and altered the TYPEs somewhat, and also a couple of the Declares. Didn't use the POINTERs

Brian

If you haven't got the latest Sapero include files, get them from here:
http://www.ionicwind.com/forums/index.php?topic=4983.msg37938#msg37938


h3kt0r

All right guys, thanks to the help provided by Brian, now there are four working functions in the sample.
Still have to dig the MButtonSubclassStatic to make it work and next there is the double
linked list function (which was designed for multiple level undo/redo)...

Updated the files --> see attachment in first post.

aurelCB

Well if you wish to play with DLL s i can make DLL in another basic compiler then you may try it

h3kt0r

Sounds like an idea. Okay then, i'll be happy to test your library.