Page 1 of 1
Posted: Wed Feb 26, 2003 6:31 pm
by BackupUser
Restored from previous forum. Originally posted by dmoc.
Which of these is correct and why?
hWnd = CreateWindowEx_(....
MoveWindow_(hWnd, ...
or...
*hWnd = CreateWindowEx_(....
MoveWindow_(*hWnd, ...
Posted: Wed Feb 26, 2003 6:43 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Originally posted by dmoc
hWnd = CreateWindowEx_(....
MoveWindow_(hWnd, ...
This one is probably the most correct. The reason is that Windows works mainly on handles, not pointers, so you have no way of being able to do "*hWnd\SomeFieldInTheStructure = $BAADC0DE" because a handle does not give you the direct address of something in memory.
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + all updates, PB3.51, Ed3.53)
Posted: Wed Feb 26, 2003 6:48 pm
by BackupUser
Restored from previous forum. Originally posted by dmoc.
The PB Editor source uses the second form for all the rich edit gadgets. Confusing. I'm trying to resize a multi-line string gadget
created via CreateWindowEx_() and getting nowhere.
Posted: Wed Feb 26, 2003 6:59 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Originally posted by dmoc
The PB Editor source uses the second form for all the rich edit gadgets. Confusing. I'm trying to resize a multi-line string gadget
created via CreateWindowEx_() and getting nowhere.
From a point of view of whether the program works or not, both versions would work. It just needs to be a 32bit place to store some value.
Looking at the Windows header files I see that:
typedef void *HANDLE;
So the definition of the HANDLE type already includes the fact that this is a "pointer" to some non-descript type. But since you cannot do this in PB it will be defined as a long, which is good enough.
If you wrote HANDLE *hWnd in C you would effectively have a pointer to a pointer, giving you warnings but it would still work.
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + all updates, PB3.51, Ed3.53)
Posted: Wed Feb 26, 2003 7:39 pm
by BackupUser
Restored from previous forum. Originally posted by dmoc.
OK, thanks, I'll experiment some more.
Posted: Wed Feb 26, 2003 7:50 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Originally posted by dmoc
OK, thanks, I'll experiment some more.
This works if you like, but it uses the wrong types (I wrote it some time ago
Code: Select all
If OpenWindow(0, 0, 0, 500, 500, #PB_Window_SystemMenu, "Scrollbar Example")
If CreateGadgetList(WindowID())
scrollbar.l = CreateWindowEx_(0, "ScrollBar", "", #WS_CHILD | #WS_VISIBLE | #SBS_VERT | #SBS_LEFTALIGN, 20, 20, 10, 50, WindowID(), 0, GetModuleHandle_(0), 0)
SetWindowLong_(scrollbar, #GWL_ID, 3)
params.SCROLLINFO
params\cbSize = SizeOf(SCROLLINFO)
params\fMask = #SIF_DISABLENOSCROLL | #SIF_PAGE | #SIF_POS | #SIF_RANGE
params\nMin = 0
params\nMax = 100
params\nPage = 10
params\nPos = 0
SendMessage_(scrollbar, #SBM_SETSCROLLINFO, #TRUE, @params)
; This is how to resize an OS created gadget under PB
MoveWindow_(scrollbar, 40, 40, 20, 300, #TRUE)
EndIf
While quitprog.w=0
ev.l=WaitWindowEvent()
Select ev
Case #PB_Event_CloseWindow
quitprog=1
EndSelect
Wend
EndIf
End
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + all updates, PB3.51, Ed3.53)
Posted: Wed Feb 26, 2003 8:08 pm
by BackupUser
Restored from previous forum. Originally posted by dmoc.
Tinman, thanks for your help. Stupid me, I had deleted a global which
just happened to be the control's handle... duh... did yer know I'm
Homer's brother?