May 15, 2024, 06:07:56 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


CreatewindowEx - a reminder please

Started by Andy, October 24, 2016, 06:10:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

fasecero


$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

BTW, that article from LarryMc helped me a lot with GDI+ back in the day.

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.