Re: How to read live output from another process ?

2023-06-28 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 23 June 2023 at 23:37:29 UTC, Vinod K Chandran wrote: Hi all, Hi, I found the solution by myself. We can use Pipe struct for this job. Here is the code looks like. This is for future readers. ```d void onBtnBurnClick(Control c, EventArgs e) { // A button click event handler

How to read live output from another process ?

2023-06-23 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am trying to create a program which burns time codes to a video. I am using ffmpeg for this. So far, I can successfully start ffmpeg in another thread and stop it when I need. But I can't read the live outputs from ffmpeg. This is my code. ```d void onBtnBurnClick(Control c,

Re: How to call a function from a dll created with d ?

2022-07-02 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 2 July 2022 at 21:36:50 UTC, mw wrote: Actually, can you create a github repo, I'm sure people will send you a working PR. Yes I can. I will inform here once I did it.

Re: How to call a function from a dll created with d ?

2022-07-02 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 2 July 2022 at 01:05:25 UTC, Ali Çehreli wrote: 3) The users of this dll should import that .di file (declaring the functions themselves won't work): Ali Hi, Thanks for the reply. I have tried your suggestion. First, I compiled my dll's source code with `-H` switch as you

Re: How to call a function from a dll created with d ?

2022-07-01 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 1 July 2022 at 22:38:17 UTC, Adam D Ruppe wrote: On Friday, 1 July 2022 at 22:32:24 UTC, Vinod K Chandran wrote: So using a `def` file is a must I think. no it is not. you just need to mark things export and make sure names match (including module name) Thanks for the reply.

Re: How to call a function from a dll created with d ?

2022-07-01 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 1 July 2022 at 22:22:42 UTC, mw wrote: Try follow instructions here: https://wiki.dlang.org/Win32_DLLs_in_D Thanks. So using a `def` file is a must I think. At first, I thought I can skip that.

Re: How to call a function from a dll created with d ?

2022-07-01 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 1 July 2022 at 21:02:20 UTC, mw wrote: I think the problem is the linker looking for dime.testFunc, while your lib function is dimedll.testFunc Thanks for the reply. What about this `mixin SimpleDllMain;` I suspect this.

Re: How to call a function from a dll created with d ?

2022-07-01 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 1 July 2022 at 20:08:45 UTC, ryuukk_ wrote: I think it is `extern(D) void testFunc();`? Thanks for the reply. But the result is same linker error.

Re: Window created with Windows API is not visible

2022-06-18 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 18 June 2022 at 21:03:23 UTC, solidstate1991 wrote: It seems that you are created a layered window. So chances are there to it become translucent.

Re: How to call a GDI+ function from D ?

2022-06-05 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 5 June 2022 at 11:33:14 UTC, Vinod K Chandran wrote: For future readers of this thread, rikki cattermole helped me to findthe solution to this problem. I Do not need the C++ classes or their methods for this. There is a set of C functions in gdiplus.dll. Check this link.

Re: How to call a GDI+ function from D ?

2022-06-05 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 5 June 2022 at 10:57:16 UTC, rikki cattermole wrote: Bitmap is a class, not a namespace. The function you want is actually a constructor. https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/include/gdiplus/gdiplusheaders.h#L179 Thank you for the reply. Well, I know

How to call a GDI+ function from D ?

2022-06-05 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I want to call the Bitmap function from gdi+. This is the syntax of the function in C++. ```c++ void Bitmap( [in] const WCHAR *filename, [in] BOOLuseEmbeddedColorManagement ); ``` And this is the mangled name which I got from goldbolt compiler. `?Bitmap@@YAXPEB_WH@Z ` Now,

Re: How to convert a LPCWSTR aka const(wchar)* to string

2022-05-09 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 10 May 2022 at 01:07:37 UTC, Mike Parker wrote: ```d import std.conv : to; string s = to!string(pszUserString); ``` Thanks, it worked. At first, I tried `to!string` but it failed because of this usage-- ```d this(LPCWSTR dtpStr) { this.dateString = to!string(LPCWSTR)(dtpStr) ; }

How to convert a LPCWSTR aka const(wchar)* to string

2022-05-09 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all. I want to convert an LPCWSTR to string. I have a struct like this ```cpp typedef struct tagNMDATETIMESTRINGW { NMHDR nmhdr; LPCWSTRpszUserString; SYSTEMTIME st; DWORD dwFlags; } NMDATETIMESTRINGW, *LPNMDATETIMESTRINGW; ``` I want to convert this `pszUserString` to a

Re: How to remove an element from a dynamic array with given index ?

2022-05-02 Thread Vinod K Chandran via Digitalmars-d-learn
On Monday, 2 May 2022 at 20:50:17 UTC, H. S. Teoh wrote: should be in the same order. How to do it ? int[] data = [ 10, 20, 30, 40, 50 ]; data = data.remove(2); assert(data == [ 10, 20, 40, 50 ]); T Thanks a lot.

How to remove an element from a dynamic array with given index ?

2022-05-02 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I have dynamic array and I want to remove an element from it. All I have the index of the element to remove. And I want to the array should be in the same order. How to do it ?

Re: How to implement private constructor

2022-04-25 Thread Vinod K Chandran via Digitalmars-d-learn
On Monday, 25 April 2022 at 07:19:31 UTC, bauss wrote: Yes and in addition to Ali's message then remember it's private for the module only. Oops typo. What I meant is that private is module level, so it's __not__ private in the module, but it is for other modules. Thanks for the reply.

Re: How to implement private constructor

2022-04-25 Thread Vinod K Chandran via Digitalmars-d-learn
On Monday, 25 April 2022 at 02:22:42 UTC, Ali Çehreli wrote: Looks good to me. There are other ways as well: Thanks a lot. All I wanted to implement more than ctor with different parameters and avoid code duplication.

How to implement private constructor

2022-04-24 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, Please take a look at this code. Is this the right way to use private constructors ? ```d class Foo { int p1 ; string p2 ; bool p3 ; private this(int a, string b, bool c) { this.p1 = a this.p2 = b this.p3 = c } this(int a) {

Re: I want to append to lists without using append

2022-04-04 Thread Vinod K Chandran via Digitalmars-d-learn
On Monday, 4 April 2022 at 13:32:19 UTC, Steven Schveighoffer wrote: This looks more like lisp or scheme. You know this is a forum for the D programming language? This was the same question in my mind.

Re: Help needed to learn typeof(return)

2022-03-27 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 27 March 2022 at 01:11:02 UTC, Steven Schveighoffer wrote: Not sure what the question here is, Thanks for the reply. Actually, my problem was this, I forgot the presence of `LargerOf!(A, B)` template function in that chapter. When I see it in a function, I thought where is the

Re: Help needed to learn typeof(return)

2022-03-26 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 26 March 2022 at 18:25:54 UTC, Vinod K Chandran wrote: Hi all, The author says `LargerOf!(A, B)` is used instead of `auto` keyword. How did compiler understands the return type from `LargerOf!(A, B)`. Oh Sorry !. I forgot the `LargerOf!(A, B)` definition which is in the same

Help needed to learn typeof(return)

2022-03-26 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am reading `Programming in D` online book. There is a paragraph in the chapter `More Templates`. ``` typeof(return) generates the return type of a function, inside that function. For example, instead of defining the calculate() function above as an auto function, we can be more

Re: Help needed to learn templates

2022-03-20 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 19 March 2022 at 22:31:19 UTC, Stanislav Blinov wrote: It is appearing not in the `static if`, but in the `is` expression, which I described further in the rest of my first reply. Sorry if that wasn't clear. No, it was my mistake, I missed it. The other template syntax -

Re: Help needed to learn templates

2022-03-19 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 19 March 2022 at 16:08:33 UTC, Ali Çehreli wrote: Here is the clickable url: http://ddili.org/ders/d.en/is_expr.html I just read it again and I still like what I wrote there. :) (Usually it is the other way around.) Ali Thanks. Let me read that chapter.

Re: Help needed to learn templates

2022-03-19 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 19 March 2022 at 15:58:25 UTC, Ali Çehreli wrote: I wrote a chapter about the is expression but it's still mysterious to me. :) ddili.org/ders/d.en/is_expr.html Thanks for the reply. I think I choose the wrong book. I knew about your book but I thought this one is

Re: Help needed to learn templates

2022-03-19 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 19 March 2022 at 08:49:02 UTC, Salih Dincer wrote: Thanks for the reply. You explained the idea very well and it's easy to understand for a novice.

Re: Help needed to learn templates

2022-03-19 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 19 March 2022 at 11:47:53 UTC, Stanislav Blinov wrote: No. First of all Thanks for the reply. The answer "No" is a wonder to me. Because, from my point of view, `U` is coming from nowhere. My understanding is, we can use any parameter of a template inside the template. So in

Help needed to learn templates

2022-03-18 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am trying to learn D templates with Philippe Sigaud's "D Templates: A Tutorial". So far so good. I have completed first 19 pages and in the 20th page, I found an obstacle. This is the code. ```d module rank1; template rank(T) { static if (is(T t == U[], U)) // is T an array of

Re: Documentation generator is not working

2021-09-06 Thread Vinod K Chandran via Digitalmars-d-learn
On Monday, 6 September 2021 at 01:19:04 UTC, Ali Çehreli wrote: Yes, but it was meant to be a joke. Don't do that. :) Ha ha, okay :)

Re: Documentation generator is not working

2021-09-05 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 3 September 2021 at 20:21:43 UTC, Ali Çehreli wrote: So, change your program to respond to -D and generate the documentation potentially by spawning a dmd instance. :o) I am not sure i get the point correctly. You mean, starting dmd as a new process from my program and pass the

Re: Documentation generator is not working

2021-09-02 Thread Vinod K Chandran via Digitalmars-d-learn
On Thursday, 2 September 2021 at 17:34:59 UTC, Adam D Ruppe wrote: Anything after -run goes to your program not the compiler. Args to the compiler must be before -run. Thanks for the reply. Got the point now. :)

Re: Documentation generator is not working

2021-09-02 Thread Vinod K Chandran via Digitalmars-d-learn
On Thursday, 2 September 2021 at 16:26:19 UTC, jfondren wrote: What commands are you running? What you describe doing, works: ``` $ dmd -D file $ w3m -dump file.html|grep -A1 function A sample function. Let's check what we will get in documentation. abc - A simple string $ rm

Documentation generator is not working

2021-09-02 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am playing with ddoc. I wrote this code-- ```d import std.stdio : log = writeln; void main() { log("Experimenting with dDoc"); } /// A sample function. /// Let's check what we will get in documentation. /// abc - A simple string void sample(string abc) {log(abc);} ``` And then,

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-29 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 29 May 2021 at 01:04:02 UTC, Marcone wrote: Win32Api + Metaprogramming? Yes.

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-28 Thread Vinod K Chandran via Digitalmars-d-learn
On Thursday, 27 May 2021 at 01:17:44 UTC, someone wrote: I am learning D by writing a Windows only GUI library. It is taking too much time for me since, I am writing some stuff and then happen to learn some new things about it and re-writing it.Anyhow, so far so good. This is the code now.

Re: How to use dub with our own package

2021-05-13 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 12 May 2021 at 20:55:07 UTC, Christian Köstlin wrote: if you want to do a separate package later on, you only have to change a little in your project setup, code can stay the same. kind regards, Christian That's nice. :)

Re: How to use dub with our own package

2021-05-12 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 12 May 2021 at 15:03:14 UTC, Imperatorn wrote: Check out add-local Thanks. Let me check. :)

Re: How to use dub with our own package

2021-05-12 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 12 May 2021 at 17:23:16 UTC, JG wrote: Have a look at [link](https://forum.dlang.org/post/jyxdcotuqhcdfqwwh...@forum.dlang.org). Thanks for the link. :)

Re: How to use dub with our own package

2021-05-12 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 12 May 2021 at 18:26:39 UTC, Christian Köstlin wrote: Are you really interested in doing winglib as a separate dub package? If not you could just do a `dub init yourappname` which gives you the basic skeleton. something like: . ├── dub.sdl └── source └── app.d then you

How to use dub with our own package

2021-05-12 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am creating a hobby project related with win api gui functions. i would like to work with dub. But How do I use dub in my project. 1. All my gui library modules are located in a folder named "winglib". 2. And that folder also conatains a d file called "package.d" 3. "package.d"

Re: Question about property & method access scope.

2021-05-11 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 11 May 2021 at 10:48:03 UTC, Mike Parker wrote: On Tuesday, 11 May 2021 at 09:10:02 UTC, Vinod K Chandran wrote: So in many situations, I need to check some boolean properties of Window class and call some functions of Window class in WndProc. But I don't want to expose those

Re: Question about property & method access scope.

2021-05-11 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 11 May 2021 at 10:47:15 UTC, cc wrote: The `package` protection attribute should work here if the modules reside in the same package (directory)? Thanks. "package" scope worked.

Question about property & method access scope.

2021-05-11 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am practising D with a win api GUI hobby project. I have a Window class and it resides in module window.d My WndProc function resides in another module named wnd_proc_module.d Inside my WndProc, I get the Window class like this. ```d Window win = cast(Window) (cast(void*)

Re: Is there any bettter solution to Windows wide string

2021-05-09 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 9 May 2021 at 09:34:00 UTC, FreeSlave wrote: You may try using tempCStringW from std.internal.cstring. It uses small string optimization. However the api is internal, so I'm not sure how valid it is to use this function. The returned struct is a temporary buffer so you must

Re: Is there any bettter solution to Windows wide string

2021-05-08 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 8 May 2021 at 21:26:06 UTC, Imperatorn wrote: iirc that's toUTF16z Thanks. Let me check. :)

Is there any bettter solution to Windows wide string

2021-05-08 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am planning some win32 hobby projects. Now I have this function to tackle the LPCWSTR data type in win32. ```d private import std.utf; auto toWString(S)(S s) { return toUTFz!(const(wchar)*)(s); } ``` Is there any better way to do this ?

Re: dlang vs crystal-language

2021-05-05 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 5 May 2021 at 18:50:05 UTC, Alain De Vos wrote: What's wrong with WSL. I think it is a great idea. What Imperatorn said is the write thing. Sorry for not being clear.

Re: dlang vs crystal-language

2021-05-01 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 30 April 2021 at 19:25:16 UTC, Siemargl wrote: I did this @2014. No problems remembered. May be it's my fault. Let me check once again.

Re: dlang vs crystal-language

2021-05-01 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 30 April 2021 at 17:01:52 UTC, TheGag96 wrote: I used tkD a long time ago. Look through [this repo](https://github.com/thegag96/codewrite) - maybe something in there will help you. Thanks for the link. Let me check.

Re: dlang vs crystal-language

2021-05-01 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 30 April 2021 at 14:49:33 UTC, Alain De Vos wrote: tkd works perfectly. Which O.S. are you using ? I can guide. I am using Windows 10 x64.

Re: dlang vs crystal-language

2021-04-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 28 April 2021 at 22:41:03 UTC, Alain De Vos wrote: What are the strengths and weaknesses comparing the two languages ? I can name a strength of dlang is the working binding to tk and gtk. Pros of **Crystal** 1. Attractive syntax. I like Ruby like syntax. It's really expressive.

Re: Windows Console and writing Unicode characters

2021-03-30 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 30 March 2021 at 08:31:02 UTC, Luhrel wrote: I have been used this trick in C++, so it might also work in D: ``` import core.stdc.stdlib; import std.stdio; void main() { version(Windows) system("chcp 65001 > NUL".ptr); writeln("çéäö"); } ``` Works like a charm in

Re: How to delete dynamic array ?

2021-03-18 Thread Vinod K Chandran via Digitalmars-d-learn
On Thursday, 18 March 2021 at 21:21:37 UTC, Paul Backus wrote: The source code is here: https://github.com/p0nce/d-idioms/ Thanks for the answer. But it's more complex than I thought. Something like Latex was in my mind.

Re: How to delete dynamic array ?

2021-03-18 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat wrote: I made this article to clear up that point: https://p0nce.github.io/d-idioms/#Slices-.capacity,-the-mysterious-property Sorry for this off-topic question. I am amazed with eye catchy look of that d-idioms page. I want to

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-17 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 06:39:26 UTC, Imperatorn wrote: Good that you solved it, that wasn't what I thought the solution would be  I was sure about i can solve this through NM_CUSTOMDRAW. Because, in VB .net, we can change back color & fore color of button. On the same time, there

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-16 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 19:42:26 UTC, Imperatorn wrote: At last, i found the answer myself. There is a item called dwDrawStage in NMCUSTOMDRAW structure. If value of dwDrawStage is equal to CDDS_PREERASE, call SetBkMode with transparent and call SetTextColor. Then draw text with

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-16 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 18:35:00 UTC, Imperatorn wrote: I see  Do you get CLR_INVALID in return? From that results, second one contains my color value. Set Text color result - 0233FF66 RGB(102, 255, 51) is the color. 66 = 102 FF = 255 33 = 51

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-16 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 18:35:00 UTC, Imperatorn wrote: I see  Do you get CLR_INVALID in return? That results might be wrong. So i printed them in hex. These are the hex results. Set Text color result - Set Text color result - 0233FF66 Set Text color result - Set

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-16 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 18:35:00 UTC, Imperatorn wrote: I see  Do you get CLR_INVALID in return? As far as i know this is the value of CLR_INVALID - 4294967295. And these are the results i got from my function. Set Text color result - 0 Set Text color result - 36962150 Set Text

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-16 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 17:45:09 UTC, Imperatorn wrote: Omg the pain. Are you forced to use raw win api for this? Not at all. It's my hobby project. I choose raw win api. It's a fun.

How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-16 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am creating a Button class with Win32 API functions. So far so good. I am using NM_CUSTOMDRAW message to change the back color of my buttons. It's really easy to change the back color in this way. But I can't change the text color of my button. This is my pseudo code. ``` uint

Re: How can I make this work?

2021-03-16 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 28 February 2021 at 13:15:47 UTC, Adam D. Ruppe wrote: And it is the simplest thing, no missing length, no weird property casting. The GC handled with two simple add/remove calls. Perfect example of teaching something. Thank you for this knowledge. Even though, this was not my

Re: How to use dguihub package ?

2021-01-20 Thread Vinod K Chandran via Digitalmars-d-learn
On Tuesday, 19 January 2021 at 16:52:18 UTC, Paul Backus wrote: On Tuesday, 19 January 2021 at 16:22:35 UTC, Vinod K Chandran wrote: b ? (tbinfo.fsState |= TBSTATE_ENABLED) : (tbinfo.fsState &= ~TBSTATE_ENABLED); This means, "if b is true, set the TBSTATE_ENABLED flag to true;

Re: How to use dguihub package ?

2021-01-19 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 17 January 2021 at 14:00:48 UTC, Mike Parker wrote: On Sunday, 17 January 2021 at 13:04:33 UTC, Vinod K Chandran Three of those messages include the solution to fix the errors. The fourth one is a missing import (`import std.conv : to`) in dguihub.core.utils. You could fix these

How to use dguihub package ?

2021-01-17 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I would like to use a gui package called "dguihub". So i did these steps. 1. Downloaded source files from Github. 2. Extract it and copy dguihub folder to my project folder. this folder contains all the source files of this package. 3. Write an import statement in my app.d "import

Re: How to work Get & Set text in clipboard in Windows ?

2020-06-22 Thread Vinod K Chandran via Digitalmars-d-learn
On Monday, 22 June 2020 at 10:26:12 UTC, aberba wrote: It would be a one-liner if it was an api. Such utility APIs are quite missing in D. Um, You are right. How about putting them together into a package? Well, this is an inspiration to me. Let me try. :)

Re: How to work Get & Set text in clipboard in Windows ?

2020-06-20 Thread Vinod K Chandran via Digitalmars-d-learn
On Saturday, 20 June 2020 at 13:46:05 UTC, Dennis wrote: Thanks a lot. Well, i thought it should be a one liner like- Clipboard.SetText(sText) But after reading your reply, i realized that this is D, not a scripting language. :)

How to work Get & Set text in clipboard in Windows ?

2020-06-20 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I would like to know how to get & set text in clipboard. I am using windows machine. Thanks in advance. --Vinod Chandran

Re: What is the current stage of @property ?

2020-06-10 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 22:15:25 UTC, 12345swordy wrote: It can't do binary operations and unary operations. @12345swordy, You mean we can't do such ops inside the property ?

Re: What is the current stage of @property ?

2020-06-10 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 21:40:44 UTC, Paul Backus wrote: The current state of @property is that it doesn't really do anything. D allows you to call functions without parentheses, and to use assignment syntax to call a single-argument function, so you can write getters and setters that

Re: What is the current stage of @property ?

2020-06-10 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 21:41:54 UTC, H. S. Teoh wrote: It's stuck in limbo, like many things that people just cannot agree on. There are a few places where it's needed (like satisfying the range API, which implicitly checks for it), but for the most part, you can just ignore it, it

What is the current stage of @property ?

2020-06-10 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I read in an old thread that authors of D wants to eliminate @property. I just roughly read the big thread bu couldn't find a conclusion. After all that thread is a 48 page longer jumbo thread. So out of curiosity, i am asking this. What is the current state of @property ? Is it

Re: How to parse enum from a string ?

2020-05-27 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 27 May 2020 at 17:36:35 UTC, Dennis wrote: On Wednesday, 27 May 2020 at 17:33:33 UTC, Vinod K Chandran wrote: I am saving this enum values as string in database. So, when i retrieve them from the database, how can i parse the string into TestEnum ? Use `to` from `std.conv`.

How to parse enum from a string ?

2020-05-27 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, Assume that i have an enum like this. enum TestEnum { Received = 1, Started , Finished , Sent } I am saving this enum values as string in database. So, when i retrieve them from the database, how can i parse the string into TestEnum ? In vb. net, i can use

Re: How to get the pointer of "this" ?

2020-05-26 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: How to get the pointer of "this" ?

2020-05-26 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: How to get the pointer of "this" ?

2020-05-26 Thread Vinod K Chandran via Digitalmars-d-learn
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.

Re: How to get the pointer of "this" ?

2020-05-26 Thread Vinod K Chandran via Digitalmars-d-learn
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:

Re: How to get the pointer of "this" ?

2020-05-26 Thread Vinod K Chandran via Digitalmars-d-learn
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.

Re: How to get the pointer of "this" ?

2020-05-26 Thread Vinod K Chandran via Digitalmars-d-learn
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(), UINT_PTR(subClsID),

Re: How to get the pointer of "this" ?

2020-05-26 Thread Vinod K Chandran via Digitalmars-d-learn
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 might be what you need? No. A class reference is a pointer

Re: How to get the pointer of "this" ?

2020-05-26 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: How to get the pointer of "this" ?

2020-05-26 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: How to get the pointer of "this" ?

2020-05-25 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: How to get the pointer of "this" ?

2020-05-25 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: How to get the pointer of "this" ?

2020-05-25 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: How to get the pointer of "this" ?

2020-05-25 Thread Vinod K Chandran via Digitalmars-d-learn
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

Re: How to get the pointer of "this" ?

2020-05-25 Thread Vinod K Chandran via Digitalmars-d-learn
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

How to get the pointer of "this" ?

2020-05-24 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I have a class like this. class Button : Control { ... HWND createButton(){ ... SetWindowSubclass(this.mHandle, SUBCLASSPROC(), UINT_PTR(subClsID), cast(DWORD_PTR) this); } } But compiler says that - "Error: 'this' is not an lvalue and cannot

Re: How to use base class & child class as parameter in one function ?

2020-05-23 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 22 May 2020 at 22:44:17 UTC, H. S. Teoh wrote: On Fri, May 22, 2020 at 09:39:16PM +, Vinod K Chandran via Digitalmars-d-learn wrote: [...] So in the same manner, i want void function(Base) = fnPtr wiil work with void function(Child) You cannot, because that's type unsafe

Re: How to use base class & child class as parameter in one function ?

2020-05-23 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 22 May 2020 at 22:40:50 UTC, Steven Schveighoffer wrote: On 5/22/20 5:39 PM, Vinod K Chandran wrote: [...] That is the opposite of what you are thinking. A function pointer has to be valid based on its parameter types. Covariant functions are allowed. This is OK: void

Re: How to use base class & child class as parameter in one function ?

2020-05-22 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 22 May 2020 at 20:51:20 UTC, Steven Schveighoffer wrote: On 5/22/20 4:04 PM, Vinod K Chandran wrote: [...] Yes. What you cannot do is this (which I hope doesn't compile in VB.net, but I wouldn't be surprised): Dim sampleList As New List(Of Child) sampleList.Add(New Base(10))

Re: How to use base class & child class as parameter in one function ?

2020-05-22 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 22 May 2020 at 20:06:20 UTC, Adam D. Ruppe wrote: On Friday, 22 May 2020 at 20:04:24 UTC, Vinod K Chandran wrote: sampleList.Add(New Child(10.5)) Is this possible in D without casting ? Direct translation of this code works just fine in D. Yeah, my bad. I just checked in D. But

Re: How to use base class & child class as parameter in one function ?

2020-05-22 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 22 May 2020 at 16:12:12 UTC, Steven Schveighoffer wrote: On 5/22/20 9:10 AM, Vinod K Chandran wrote: On Friday, 22 May 2020 at 12:21:25 UTC, rikki cattermole wrote: if (Child child = cast(Child)parent) { assert(child !is null); } Actually, problem occurs in addHandler

Re: How to use base class & child class as parameter in one function ?

2020-05-22 Thread Vinod K Chandran via Digitalmars-d-learn
On Friday, 22 May 2020 at 12:21:25 UTC, rikki cattermole wrote: if (Child child = cast(Child)parent) { assert(child !is null); } Actually, problem occurs in addHandler function. It expects an argument of type "EventArgs", not MouseEventArgs.

How to use base class & child class as parameter in one function ?

2020-05-22 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I have a windows gui setup like this; class EventArgs {} \\ Base class for all messages class MouseEventArgs : EventArgs { // child class for handling mouse messages ... int x; int y; this(WPARAM wpm, LPARAM lpm){ this.x = xFromLparam(lpm); this.y =

Re: How to use GET_X_LPARAM in D ?

2020-05-21 Thread Vinod K Chandran via Digitalmars-d-learn
On Thursday, 21 May 2020 at 20:12:13 UTC, Harry Gillanders wrote: On Thursday, 21 May 2020 at 18:42:47 UTC, Vinod K Chandran wrote: Hi all, I need to use the macro GET_X_LPARAM. But compiler says that "undefined identifier GET_X_LPARAM". I cant find any modules with GET_X_LPARAM defined. Do i

Re: How to use GET_X_LPARAM in D ?

2020-05-21 Thread Vinod K Chandran via Digitalmars-d-learn
On Thursday, 21 May 2020 at 18:42:47 UTC, Vinod K Chandran wrote: Hi all, I need to use the macro GET_X_LPARAM. But compiler says that "undefined identifier GET_X_LPARAM". I cant find any modules with GET_X_LPARAM defined. Do i miss something ? I search all modules in "

How to use GET_X_LPARAM in D ?

2020-05-21 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I need to use the macro GET_X_LPARAM. But compiler says that "undefined identifier GET_X_LPARAM". I cant find any modules with GET_X_LPARAM defined. Do i miss something ?

  1   2   >