BBC BASIC for Windows
« Accessing the Window's API »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:49pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: Accessing the Window's API  (Read 4469 times)
Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Accessing the Window's API
« Reply #15 on: Oct 4th, 2010, 06:17am »

Ah, that would explain my problem. Thanks.

One of the things I was trying to do with this was to find out if the DateTime checkbox that I've got on a Propsheet is checked or not. I can't seem to find another constant that would allow me to do this. Am I, again, just missing something obvious?

Matt
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Accessing the Window's API
« Reply #16 on: Oct 4th, 2010, 11:01am »

on Oct 4th, 2010, 06:17am, Matt wrote:
One of the things I was trying to do with this was to find out if the DateTime checkbox that I've got on a Propsheet is checked or not. Am I, again, just missing something obvious?

I don't know whether it is "obvious", but it is there! If you look at the docs for the DTM_GETSYSTEMTIME message you will find this:

Returns GDT_VALID if the time information was successfully placed in lpSysTime. Returns GDT_NONE if the control was set to the DTS_SHOWNONE style and the control check box was not selected:

http://msdn.microsoft.com/en-us/library/bb761769.aspx

So to determine whether the checkbox was selected or not, simply query the date/time in the normal way and test the value returned from SendMessage. If the checkbox was selected you will get GDT_VALID (0) , if it wasn't you will get GDT_NONE (1).

Richard.
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Accessing the Window's API
« Reply #17 on: Oct 4th, 2010, 7:52pm »

Thanks Richard.

Just tried it and it works fine. Although it seems to me that the result is the wrong way round as zero is normally considered as false, but that's splitting hairs.

Thanks again.

Matt
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Accessing the Window's API
« Reply #18 on: Oct 4th, 2010, 9:41pm »

on Oct 4th, 2010, 7:52pm, Matt wrote:
it seems to me that the result is the wrong way round

It makes perfect sense if you consider the returned value to be an error code. GDT_VALID (0) indicates success (the checkbox was selected, so a valid date/time was returned) and GDT_NONE (1) indicates failure (the checkbox was not selected, so there is no date/time to return). The other value that can be returned is GDT_ERROR (-1) which indicates that some other error occurred.

Richard.
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Accessing the Window's API
« Reply #19 on: Oct 5th, 2010, 04:52am »

I stand corrected. Now you explain it, it does make sence. Thanks.
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Accessing the Window's API
« Reply #20 on: Oct 9th, 2010, 8:32pm »

Hi,

I've managed to get access to a line's info on a List View by single clicking and getting the index, then clicking another button to get the record. But I can't figure out how to access it by double clicking using a List View control. Is there one, or will I just have to use a seperate button?

Matt
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Accessing the Window's API
« Reply #21 on: Oct 10th, 2010, 09:24am »

on Oct 9th, 2010, 8:32pm, Matt wrote:
But I can't figure out how to access it by double clicking using a List View control. Is there one, or will I just have to use a seperate button?

If you've ever used the Search BASIC Programs add-in utility you'll know that double-clicking in a List View is supported (in that utility you double-click on a program name to display it in a new instantiation of the IDE).

Unfortunately the double-click notification is sent in the form of a WM_NOTIFY message and the only reliable way to intercept that in BB4W is using assembler code (although WM_NOTIFY is one of the messages you can intercept using *SYS 1, the data it carries is volatile and typically no longer valid by the time you get to see it).

This contrasts with a regular List Box control, which passes the double-click notification as a WM_COMMAND message that you can reliably intercept using ON SYS (and, no, I have no idea why they work differently).

So if you want to handle the double-click notification from a List View it's a case of incorporating some assembler code, even if you don't know how it works! If so let me know and I'll write it up in a Wiki article.

Richard.
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Accessing the Window's API
« Reply #22 on: Oct 10th, 2010, 6:42pm »

Hi Richard,

I'm using the assember and other parts from the program 'DIRdetails.bbc' (Can't remember where I got it.) These are the main parts.

WHEN WM_NOTIFY :
IF sortcount%>-1 THEN
IF click%(1) = sortcol% THEN
direction% *= -1
C% = sortcount%+1
CALL indexsort%((direction%+1)/2), sort$(0,0), sort$(1,0)
sortcol% = click%(1)
ELSE
direction% = 1
sortcol% = click%(1)
PROC_SORT
ENDIF
relist% = TRUE
ENDIF


FOR pass% = 8 TO 10 STEP 2
P% = code
[OPT pass%
.oldwndproc
dd 0
:
.hdn_itemclick
mov eax,[eax+12]
mov [esp+16],eax
mov dword [esp+8],WM_COMMAND
mov dword [esp+12],WM_NOTIFY
jmp [oldwndproc]
:
.wm_notify
mov eax,[esp+16]
cmp dword [eax+8],HDN_ITEMCLICKA
jz hdn_itemclick
jmp [oldwndproc]
:
.newwndproc
cmp dword [esp+8],WM_NOTIFY
jz wm_notify
jmp [oldwndproc]
]
NEXT pass%


But this only seems to check for clicking on the column header. To check for the item I'm using,

SYS "SendMessage", hlist%, LVM_GETNEXTITEM, -1, LVNI_SELECTED TO index%

This gives a constant running value, so I can't even time a double click.

Are these the types of codings that you are referring to?

Matt
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Accessing the Window's API
« Reply #23 on: Oct 10th, 2010, 9:38pm »

on Oct 10th, 2010, 6:42pm, Matt wrote:
I'm using the assember and other parts from the program 'DIRdetails.bbc'.... But this only seems to check for clicking on the column header.

Since you're already using assembler code to handle the HDN_ITEMCLICKA notification you can add to that code to handle the NM_DBLCLK notification as well. The HDN_ITEMCLICKA gets converted by the assembler code to a WM_COMMAND message (which can easily be processed using ON SYS) so it would make sense to do just the same for the NM_DBLCLK notification.

As only one notification is intercepted by the existing code it isn't necessary to indicate which notification it was. Obviously once you're handling both HDN_ITEMCLICKA and NM_DBLCLK notifications you'll have to pass more information to your ON SYS handler; You could for example pass the notification code as the @lparam% parameter (currently unused), although it might be more consistent with the way List Boxes and other simple controls work to pass it in the high 16-bits of @wparam%.

Richard.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Accessing the Window's API
« Reply #24 on: Oct 12th, 2010, 12:11pm »

Although not entirely relevant you may find this article useful when intercepting windows messages in assembler, especially those pesky WM_NOTIFY messages.

http://bb4w.wikispaces.com/Colour+text+in+a+List+View

It is, I admit, rather effusive and probably more confusing than helpful as I wrote it a while back but it may help. I would be interested in your comments!

Michael Hutton


User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls