IonicWind Software

IWBasic => General Questions => Topic started by: Andy on October 24, 2016, 06:10:28 AM

Title: CreatewindowEx - a reminder please
Post by: Andy on October 24, 2016, 06:10:28 AM
Could someone remind me how to create a button / checkbox etc using the CreatewindowEx function.

I simply can't remember, and I have to say that since the site was updated I'm finding it harder to search for previous examples as it now only shows you snippets of what you're searching for, where as before it showed you larger chunks of code.

So, we have a window called "win"

And I want to create a button later on after the window has been created using CreatewindowEx.

Please remind me as my mind has gone on this one!  :'(

Thanks,
Andy.
Title: Re: CreatewindowEx - a reminder please
Post by: LarryMc on October 24, 2016, 08:20:18 AM
I think I covered it in my tutorial on creating custom controls.

Look here and see if this helps you

http://www.ionicwind.com/forums/index.php?topic=4676.msg36462#msg36462
Title: Re: CreatewindowEx - a reminder please
Post by: Andy on October 24, 2016, 09:14:04 AM
Larry,

Yes I read that, and although it does mention about the different control types, it doesn't give an example of creating a control such as a button etc.

A simple control example would be of help in the tutorial.

I will read on, as there is a lot in there...

Thanks,
Andy.
Title: Re: CreatewindowEx - a reminder please
Post by: fasecero on October 24, 2016, 01:38:46 PM

$INCLUDE "windowssdk.inc"

CONST BUTTON_1 = 1001
CONST CHECK_1 = 1002
CONST RADIO_1 = 1003

SUB CreateControls(WINDOW w)
uint dwStyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP

CreateWindowEx(0, "BUTTON", "Button1", dwStyle | BS_PUSHBUTTON,      91,  45, 70, 20, w.hwnd, BUTTON_1, GetModuleHandle(0), 0)
CreateWindowEx(0, "BUTTON", "Check1",  dwStyle | BS_AUTOCHECKBOX,    91,  87, 70, 20, w.hwnd, CHECK_1,  GetModuleHandle(0), 0)
CreateWindowEx(0, "BUTTON", "Radio1",  dwStyle | BS_AUTORADIOBUTTON, 91, 136, 70, 20, w.hwnd, RADIO_1,  GetModuleHandle(0), 0)
ENDSUB


You can find more detailed info on MSDN.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb775947(v=vs.85).aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/bb775947(v=vs.85).aspx)

BTW, that article from LarryMc helped me a lot with GDI+ back in the day.
Title: Re: CreatewindowEx - a reminder please
Post by: Andy on October 24, 2016, 10:30:24 PM
Fasecero,

Thanks for the reply, yes I remember it now, thank you.

While I was trying (yesterday) to read msdn, and then Larry's post the power kept going off and coming back on again.

So for the sake of my PC (and my sanity) I decided to leave it until this morning.

I've not used that command for a long long time, and simply couldn't remember it.

Thanks again to both of you.
Andy.