Recent Posts

Pages: [1] 2 3 ... 10
1
General Questions / Re: DLL creation
« Last post by Brian Pugh on September 22, 2018, 11:22:23 AM »
There are some plugins for paint.net which includes a button maker - it's pretty good and easy. So easy, even I made one!

https://forums.getpaint.net/topic/7186-madjik-all-plugins-last-updated-2018-04-07/

Brian
2
General Questions / Re: DLL creation
« Last post by fasecero on September 22, 2018, 10:43:37 AM »
There was a magazine with a CD-ROM many years ago – so long ago I don't remember the name, it was cheap and was filled with lots of shareware and freeware programs. At that time I still didn't have internet at home so I spent hours installing apps. In there I found out by pure chance a program called darkbasic that was able to make games, so I began to program. I was very bad at making games lol so I start to ask myself how traditional programs were made. Can't remember what I wrote in google but Creative Basic was the first result I got. MSDN guided me to study some c, but I only feel comfortable writting code with our tools in here :) Anyway sorry to get off track. I'm now interested in making a button with a glow effect, I mean with a transition or animation, no idea what it takes so we'll see
3
User Offerings / Re: Control constant and values - a must for all - News.
« Last post by Andy on September 22, 2018, 03:43:45 AM »
I wanted to check something out regarding adding in descriptions for the constants.

So I contacted MS and asked them would it be okay to use their descriptions in my program - they said yes, as long as the program was for educational purposes (which it is), and free (which it is).

They said that was "perfect!"

So with the copyright issue cleared up, I will be releasing an important update to the constants search program in a few days.

This program I will call something like - Constants reference guide (or words to that effect).

Andy.
4
General Questions / Re: DLL creation
« Last post by Brian Pugh on September 22, 2018, 02:48:36 AM »
Fasecero,

I remember the Photoshop giveaways. In the UK, you could buy a magazine with a CD inside, containing the full version (7, I think), no limitations, private or business use. Got to be over 10 years ago, now. Although it wasn't easy to update them later

My money-conscious MD asked me to take some money out of the petty cash, and go and buy 10 copies. I think we cleaned the town centre shops out!

I tried GIMP a few years ago, and found it very slow. I have the latest version now, and it has speeded up tremendously, although I don't think it is very friendly. Maybe I don't use it enough to give it a fair comment

Brian
5
General Questions / Re: DLL creation
« Last post by fasecero on September 21, 2018, 02:00:05 PM »
I have a very old copy of photoshop (I think it's a version more than 10 years old that was given for free for a limited time by adobe). I also have an old embarcadero that was given for free also, but I never liked delphi so I never touched it. I have heard good things from Paint.net, also for GIMP as alternatives. I did a kick search and found this short video to make a glow in paint.net, maybe it can help, my advice watch the video without sound, the music is terrible: https://www.youtube.com/watch?v=BR6BxROSPDg
6
General Questions / Re: DLL creation
« Last post by Brian Pugh on September 21, 2018, 11:57:40 AM »
And another one bites the dust! How did you do the "glow" effect? I used paint.net, which had the birthday cake as a shape, and then I added the colours, and saved it as a PNG. Very useful program, and there are a lot of plugins for it

Brian
7
General Questions / Re: DLL creation
« Last post by fasecero on September 21, 2018, 11:28:01 AM »
Also, if we want to complicate things even more :) we can make an OWNERDRAW button that uses a different image for each state: normal, over, pressed.

Code: [Select]
$include "windowssdk.inc"
$INCLUDE "Commctrl.inc"
$include "cfImages.inc"

WINDOW win
UINT hCake,hCakeOver,hCakePressed
INT subclassID = 12345
INT isOverButton = 0

OPENWINDOW win,0,0,640,480,@MINBOX|@MAXBOX|@SIZE,0,"PNG as button",&win_handler
SETWINDOWCOLOR win,RGB(200,255,200)

hCake=Load_PNG_FromFile(GETSTARTPATH+"birthday cake normal.png",140,140,0xFFC8FFC8)
hCakeOver=Load_PNG_FromFile(GETSTARTPATH+"birthday cake over.png",140,140,0xFFC8FFC8)
hCakePressed=Load_PNG_FromFile(GETSTARTPATH+"birthday cake pressed.png",140,140,0xFFC8FFC8)
SHOWIMAGE win,hCake,@IMGBITMAP,270,50,140,140

' method #2
CONST BUTTON_1 = 1
CONTROL win,@SYSBUTTON,"",265,201,140,140,0x50000000,BUTTON_1
ButtonSetImages(win, BUTTON_1)
SetWindowSubclass(GetDlgItem(win.hwnd, BUTTON_1), &subclassButtonProc, subclassID, 0)

WAITUNTIL ISWINDOWCLOSED(win)
DELETEIMAGE hCake,@IMGBITMAP
DELETEIMAGE hCakeOver,@IMGBITMAP
DELETEIMAGE hCakePressed,@IMGBITMAP
RemoveWindowSubclass(GetDlgItem(win.hwnd, BUTTON_1), &subclassButtonProc, subclassID)
END

SUB win_handler(),INT
SELECT @MESSAGE
CASE WM_SETCURSOR
isOverButton = 0
RedrawWindow(GetDlgItem(win.hwnd, BUTTON_1), NULL, NULL, RDW_INVALIDATE)
CASE @IDCREATE
CENTERWINDOW win
CASE @IDCLOSEWINDOW
CLOSEWINDOW win
CASE @IDCONTROL
SELECT @CONTROLID
CASE BUTTON_1
IF @NOTIFYCODE = 0
SETCAPTION(win,"You have just clicked the button")
ENDIF
ENDSELECT
ENDSELECT
RETURN 0
ENDSUB

SUB subclassButtonProc(hWnd:INT,uMsg:INT,wParam:INT,lParam:INT,uIdSubclass:UINT_PTR,dwRefData:DWORD_PTR),INT
SELECT uMsg
CASE WM_SETCURSOR
isOverButton = 1
RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE)
WINDOW w
w.hwnd = hWnd
SETCURSOR(w, @CSCUSTOM, LoadCursor(NULL, IDC_HAND))
RETURN TRUE
CASE WM_DRAWITEM
IF *<DRAWITEMSTRUCT>lParam.itemState & ODS_DEFAULT THEN
DrawButtonImage(*<DRAWITEMSTRUCT>lParam.hDC, hCake, 0, 0, *<DRAWITEMSTRUCT>lParam.rcItem.right, *<DRAWITEMSTRUCT>lParam.rcItem.bottom)
ELSEIF *<DRAWITEMSTRUCT>lParam.itemState & ODS_SELECTED THEN
DrawButtonImage(*<DRAWITEMSTRUCT>lParam.hDC, hCakePressed, 0, 0, *<DRAWITEMSTRUCT>lParam.rcItem.right, *<DRAWITEMSTRUCT>lParam.rcItem.bottom)
ELSEIF isOverButton THEN
DrawButtonImage(*<DRAWITEMSTRUCT>lParam.hDC, hCakeOver, 0, 0, *<DRAWITEMSTRUCT>lParam.rcItem.right, *<DRAWITEMSTRUCT>lParam.rcItem.bottom)
ELSE
DrawButtonImage(*<DRAWITEMSTRUCT>lParam.hDC, hCake, 0, 0, *<DRAWITEMSTRUCT>lParam.rcItem.right, *<DRAWITEMSTRUCT>lParam.rcItem.bottom)
ENDIF
ENDSELECT

RETURN DefSubclassProc(hWnd, uMsg, wParam, lParam)
ENDSUB

SUB ButtonSetImages(WINDOW w, INT id)
INT handle = GetDlgItem(w.hwnd, id)
LONG style = GetWindowLong(handle,GWL_STYLE)
style = WS_CHILD | WS_VISIBLE | BS_OWNERDRAW
SetWindowLong(handle,GWL_STYLE,style)
_SendMessage(handle, WM_CHANGEUISTATE, MAKELONG(UIS_SET, UISF_HIDEFOCUS), 0)
ENDSUB

SUB DrawButtonImage(INT hDC, UINT hbit, INT x, INT y, INT width, INT height) ' alpha: 1 to 255
HDC hdcMem = CreateCompatibleDC(hDC)
    HBITMAP hbmOld = SelectObject(hdcMem, hbit)
BITMAP bm
GetObject(hbit, LEN(bm), &bm)
    StretchBlt(hDC, x, y, width, height, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY)
    SelectObject(hdcMem, hbmOld)
    DeleteDC(hdcMem)
ENDSUB

8
General Questions / Re: RESTORE & GETDATA
« Last post by Andy on September 21, 2018, 09:27:19 AM »
Thanks everyone for your replies and emails.

I will check the suggestions out - much appreciated!

Andy.
 :)
9
General Questions / Re: DLL creation
« Last post by Brian Pugh on September 21, 2018, 08:19:07 AM »
Well, we are learning some stuff at the moment! Works well here, as does all your code

Many thanks,

Brian
10
General Questions / Re: DLL creation
« Last post by fasecero on September 21, 2018, 07:53:35 AM »
If you do not want any edge use a static. The subclass is optional to change the cursor when the mouse is over the control.

Code: [Select]
$include "windowssdk.inc"
$INCLUDE "Commctrl.inc"
$include "cfImages.inc"

WINDOW win
UINT hCake
INT subclassID = 12345

OPENWINDOW win,0,0,640,480,@MINBOX|@MAXBOX|@SIZE,0,"PNG as button",&win_handler
SETWINDOWCOLOR win,RGB(200,255,200)

hCake=Load_PNG_FromFile(GETSTARTPATH+"birthday cake.png",100,100,0xFFC8FFC8)
SHOWIMAGE win,hCake,@IMGBITMAP,270,50,100,100

CONST STATIC_1=1
CONTROL win,@STATIC,"",265,201,104,104,0x50000000,STATIC_1
StaticSetImage(win,STATIC_1,hCake)
SetWindowSubclass(GetDlgItem(win.hwnd, STATIC_1), &subclassStaticProc, subclassID, 0)

WAITUNTIL ISWINDOWCLOSED(win)
DELETEIMAGE hCake,@IMGBITMAP
RemoveWindowSubclass(GetDlgItem(win.hwnd, STATIC_1), &subclassStaticProc, subclassID)
END

SUB win_handler(),INT
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW win
CASE @IDCLOSEWINDOW
CLOSEWINDOW win
CASE @IDCONTROL
SELECT @CONTROLID
CASE STATIC_1
IF @NOTIFYCODE = 0
SETCAPTION(win,"You have just clicked the static")
ENDIF
ENDSELECT
ENDSELECT
RETURN 0
ENDSUB

SUB subclassStaticProc(hWnd:INT,uMsg:INT,wParam:INT,lParam:INT,uIdSubclass:UINT_PTR,dwRefData:DWORD_PTR),INT
SELECT uMsg
CASE WM_SETCURSOR
WINDOW w
w.hwnd = hWnd
SETCURSOR(w, @CSCUSTOM, LoadCursor(NULL, IDC_HAND))
RETURN TRUE
ENDSELECT

RETURN DefSubclassProc(hWnd, uMsg, wParam, lParam)
ENDSUB

SUB StaticSetImage(WINDOW w,INT id,INT image)
INT handle=GetDlgItem(w.hWnd,id)
LONG style=GetWindowLong(handle,GWL_STYLE)
style=style|SS_BITMAP|SS_NOTIFY
SetWindowLong(handle,GWL_STYLE,style)
_SendMessage(handle,STM_SETIMAGE,IMAGE_BITMAP,image)
ENDSUB

Pages: [1] 2 3 ... 10