On Tuesday, 26 May 2020 at 22:23:19 UTC, bauss wrote:
On Tuesday, 26 May 2020 at 12:08:29 UTC, Johannes Loher wrote:
[...]
You can just do this to get around it:
auto button = this;
log(&button);
True, somebody else posted the same idea already. But as
explained, it doesn'
On Tuesday, 26 May 2020 at 12:08:29 UTC, Johannes Loher wrote:
On Tuesday, 26 May 2020 at 11:44:58 UTC, Vinod K Chandran wrote:
On Monday, 25 May 2020 at 16:39:30 UTC, Mike Parker wrote:
On Monday, 25 May 2020 at 08:39:23 UTC, John Burton wrote:
I believe that in D *this* is a reference to th
On Tuesday, 26 May 2020 at 14:42:04 UTC, Steven Schveighoffer
wrote:
On Tuesday, 26 May 2020 at 14:42:04 UTC, Steven Schveighoffer
wrote:
Hm... According to run.dlang.io, this behavior changed in 2.072
(prior to that it worked). In 2.067.1 to 2.071.2, changing the
this reference was actuall
On Tuesday, 26 May 2020 at 13:37:22 UTC, Vinod K Chandran wrote:
On Tuesday, 26 May 2020 at 12:41:20 UTC, John Chapman wrote:
On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote:
Here is my full code. Please take a look.
https://pastebin.com/av3nrvtT
Change line 124 to:
SetWindowS
On 5/26/20 8:08 AM, Johannes Loher wrote:
On Tuesday, 26 May 2020 at 11:44:58 UTC, Vinod K Chandran wrote:
On Monday, 25 May 2020 at 16:39:30 UTC, Mike Parker wrote:
On Monday, 25 May 2020 at 08:39:23 UTC, John Burton wrote:
I believe that in D *this* is a reference to the
object and not a po
Am 26.05.20 um 16:17 schrieb Vinod K Chandran:
> On Tuesday, 26 May 2020 at 13:48:52 UTC, ag0aep6g wrote:
>> On 26.05.20 15:43, Vinod K Chandran wrote:
>>> So far now, two solutions are very clear for this problem.
>>> 1. As per John Chapman's suggestion - use
>>> cast(DWORD_PTR)cast(void*)this).
>
On Tuesday, 26 May 2020 at 13:48:52 UTC, ag0aep6g wrote:
On 26.05.20 15:43, Vinod K Chandran wrote:
So far now, two solutions are very clear for this problem.
1. As per John Chapman's suggestion - use
cast(DWORD_PTR)cast(void*)this).
2. Use another varibale to use as an lvalue. -
Button
On Tuesday, 26 May 2020 at 13:44:24 UTC, Adam D. Ruppe wrote:
On Tuesday, 26 May 2020 at 11:35:23 UTC, Vinod K Chandran wrote:
Okay, but uint is working perfectly.
It won't if you use -m64.
Okay. I got it.
On 26.05.20 15:43, Vinod K Chandran wrote:
So far now, two solutions are very clear for this problem.
1. As per John Chapman's suggestion - use cast(DWORD_PTR)cast(void*)this).
2. Use another varibale to use as an lvalue. -
Button dummyBtn = this;
cast(DWORD_PTR)&dummyBtn;
Among these
On Tuesday, 26 May 2020 at 11:35:23 UTC, Vinod K Chandran wrote:
Okay, but uint is working perfectly.
It won't if you use -m64.
On Tuesday, 26 May 2020 at 13:37:22 UTC, Vinod K Chandran wrote:
On Tuesday, 26 May 2020 at 12:41:20 UTC, John Chapman wrote:
On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote:
Here is my full code. Please take a look.
https://pastebin.com/av3nrvtT
Change line 124 to:
SetWindowS
On Tuesday, 26 May 2020 at 12:08:29 UTC, Johannes Loher wrote:
On Tuesday, 26 May 2020 at 11:44:58 UTC, Vinod K Chandran wrote:
[...]
[...]
It doesn't compile, the line
string mt
[...]
Hi,
Sorry for the typos in my code.
On Tuesday, 26 May 2020 at 12:41:20 UTC, John Chapman wrote:
On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote:
Here is my full code. Please take a look.
https://pastebin.com/av3nrvtT
Change line 124 to:
SetWindowSubclass(this.mHandle, SUBCLASSPROC(&btnWndProc),
UINT_PTR(subClsI
On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote:
Here is my full code. Please take a look.
https://pastebin.com/av3nrvtT
Change line 124 to:
SetWindowSubclass(this.mHandle, SUBCLASSPROC(&btnWndProc),
UINT_PTR(subClsID), cast(DWORD_PTR)cast(void*)this);
That is, change `&this`
On Tuesday, 26 May 2020 at 12:08:29 UTC, Johannes Loher wrote:
[...]
Small correction: I said that this is an lvalue and that you
cannot take the address of lvalues. Of course that is incorrect,
I meant to say that rvalues (this is an rvalue and you cannot
take the address of rvalues).
On Tuesday, 26 May 2020 at 11:44:58 UTC, Vinod K Chandran wrote:
On Monday, 25 May 2020 at 16:39:30 UTC, Mike Parker wrote:
On Monday, 25 May 2020 at 08:39:23 UTC, John Burton wrote:
I believe that in D *this* is a reference to the
object and not a pointer like in C++.
So I think that writing
On Monday, 25 May 2020 at 16:39:30 UTC, Mike Parker wrote:
On Monday, 25 May 2020 at 08:39:23 UTC, John Burton wrote:
I believe that in D *this* is a reference to the
object and not a pointer like in C++.
So I think that writing &this might be what you need?
No. A class reference is a pointer
On Monday, 25 May 2020 at 18:42:33 UTC, bauss wrote:
On Monday, 25 May 2020 at 17:14:13 UTC, Vinod K Chandran wrote:
On Monday, 25 May 2020 at 16:54:11 UTC, Mike Parker wrote:
[...]
Hi @Mike Parker,
Thank you for your valuable suggestions. I will sure follow
them. Well, the exact line numbe
On Monday, 25 May 2020 at 22:54:32 UTC, Adam D. Ruppe wrote:
On Monday, 25 May 2020 at 22:31:00 UTC, Vinod K Chandran wrote:
A dword is an unsigned, 32-bit unit of data. We can use uint
in D. I have tried that too, but no luck.
A DWORD_PTR is *not* the same as a uint. It is more like a
size_t
On Monday, 25 May 2020 at 22:32:52 UTC, Vinod K Chandran wrote:
What is an opCast ?
operator overload of the cast function. if you didn't write one,
you don't have to worry about this.
On Monday, 25 May 2020 at 22:31:00 UTC, Vinod K Chandran wrote:
A dword is an unsigned, 32-bit unit of data. We can use uint in
D. I have tried that too, but no luck.
A DWORD_PTR is *not* the same as a uint. It is more like a size_t
or void* depending on context.
On Monday, 25 May 2020 at 22:04:28 UTC, Adam D. Ruppe wrote:
On Monday, 25 May 2020 at 21:45:39 UTC, welkam wrote:
Where is DWORD_PTR defined?
it is a win32 thing. should be able to directly cast to it most
the time
if there is opCast on the class it needs another layer of
helper function
On Monday, 25 May 2020 at 21:45:39 UTC, welkam wrote:
On Sunday, 24 May 2020 at 17:05:16 UTC, Vinod K Chandran wrote:
cast(DWORD_PTR) this);
Where is DWORD_PTR defined? I cant find it in docs. If its an
alias of long then you have to cast to a pointer like this
cast(long*) this;
you need to
On Monday, 25 May 2020 at 21:45:39 UTC, welkam wrote:
Where is DWORD_PTR defined?
it is a win32 thing. should be able to directly cast to it most
the time
if there is opCast on the class it needs another layer of helper
function but without opCast it should just work
On Sunday, 24 May 2020 at 17:05:16 UTC, Vinod K Chandran wrote:
cast(DWORD_PTR) this);
Where is DWORD_PTR defined? I cant find it in docs. If its an
alias of long then you have to cast to a pointer like this
cast(long*) this;
you need to specify that you want to cast to a pointer of type T.
On Monday, 25 May 2020 at 18:42:33 UTC, bauss wrote:
On Monday, 25 May 2020 at 17:14:13 UTC, Vinod K Chandran wrote:
On Monday, 25 May 2020 at 16:54:11 UTC, Mike Parker wrote:
[...]
Hi @Mike Parker,
Thank you for your valuable suggestions. I will sure follow
them. Well, the exact line numbe
On Monday, 25 May 2020 at 17:14:13 UTC, Vinod K Chandran wrote:
On Monday, 25 May 2020 at 16:54:11 UTC, Mike Parker wrote:
On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote:
[...]
The error has nothing to do with taking a pointer to `this`.
It's suggesting that somewhere in you
On Monday, 25 May 2020 at 16:39:30 UTC, Mike Parker wrote:
On Monday, 25 May 2020 at 08:39:23 UTC, John Burton wrote:
I believe that in D *this* is a reference to the
object and not a pointer like in C++.
So I think that writing &this might be what you need?
No. A class reference is a pointer
On Monday, 25 May 2020 at 16:54:11 UTC, Mike Parker wrote:
On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote:
[...]
The error has nothing to do with taking a pointer to `this`.
It's suggesting that somewhere in your code you're attempting
to use the `this` reference like an lva
On Monday, 25 May 2020 at 16:26:31 UTC, Vinod K Chandran wrote:
Here is my full code. Please take a look.
https://pastebin.com/av3nrvtT
The error has nothing to do with taking a pointer to `this`. It's
suggesting that somewhere in your code you're attempting to use
the `this` reference like
On Monday, 25 May 2020 at 08:39:23 UTC, John Burton wrote:
I believe that in D *this* is a reference to the
object and not a pointer like in C++.
So I think that writing &this might be what you need?
No. A class reference is a pointer under the hood. Getting its
address will result in a point
On Sunday, 24 May 2020 at 17:40:10 UTC, bauss wrote:
On Sunday, 24 May 2020 at 17:05:16 UTC, Vinod K Chandran wrote:
[...]
I think your issue might be elsewhere because casting this
should be fine and it should not complain about that in your
given code.
At least you should be able to pass
On Sunday, 24 May 2020 at 17:40:10 UTC, bauss wrote:
On Sunday, 24 May 2020 at 17:05:16 UTC, Vinod K Chandran wrote:
[...]
I think your issue might be elsewhere because casting this
should be fine and it should not complain about that in your
given code.
At least you should be able to pass
On Sunday, 24 May 2020 at 17:05:16 UTC, Vinod K Chandran wrote:
Hi all,
I have a class like this.
class Button : Control {
...
HWND createButton(){
...
SetWindowSubclass(this.mHandle, SUBCLASSPROC(&btnWndProc),
UINT_PTR(subClsID), cast(DWORD_PTR) this);
34 matches
Mail list logo