- popup with timeout question - 7 Updates
- A question about if constexpr - 3 Updates
- "Microsoft Exploring Rust as the Solution for Safe Software" - 8 Updates
T <T@invalid.invalid>: Dec 02 09:02PM -0800 Hi All, I write in Perl6. I wrote a module to give me a pop up in Windows to send information to the user. It uses a native call and I do believe it is a C++ call, but I really don't know what I am doing when it comes to anything C. Do any of you guys know how to add a time out to the pop up? I do believe it would be in the choice of the constants. Many thanks, -T <WinMsg.pm6> # unit module WinMsg; # WinMsg.pm6 #`{ Reference: https://stackoverflow.com/questions/59105696/how-can-i-create-pop-up-windows-for-perl6-in-windows } use NativeCall; sub WinMsg( Str $TitleStr, Str $MessageStr ) is export( :WinMsg ) { #`{ Pop up a message box to the user. Windows only. Test one liner: perl6 -e "use lib '.'; use WinMsg :WinMsg; WinMsg( 'Super Duper Title', 'What? You were expecting something witty?' );" } my $SubName = &?ROUTINE.name; my $OS = $*KERNEL.name; if not $OS eq "win32" { say "Sorry, $SubName only work in Windows."; exit; } constant WCHAR = uint16; constant INT = int32; constant UINT = uint32; constant HANDLE = Pointer[void]; constant LPWCTSTR = CArray[WCHAR]; constant MB_ICONEXCLAMATION = 0x00000030; # Note: the following two subs have to be embedded sub MessageBoxW( HANDLE, LPWCTSTR, LPWCTSTR, UINT ) is native('user32') returns INT { * }; sub to-c-str( Str $str ) returns CArray[WCHAR] { my @str := CArray[WCHAR].new; for ( $str.comb ).kv -> $i, $char { @str[$i] = $char.ord; } @str[ $str.chars ] = 0; @str; } # MessageBoxW( my $handle, to-c-str("๘❤ Raku is awesome ❤๖"), to-c-str("Hellö Wαrld"), MB_ICONEXCLAMATION ); MessageBoxW( my $handle, to-c-str( $MessageStr ), to-c-str( $TitleStr ), MB_ICONEXCLAMATION ); } </WinSmg/pm6> |
Paavo Helde <myfirstname@osa.pri.ee>: Dec 03 10:13AM +0200 On 3.12.2019 7:02, T wrote: > a native call and I do believe it is a C++ call, but I > really don't know what I am doing when it comes to > anything C. C and C++ are two different languages. Windows SDK interface is defined in C, not C++. > constants. > MessageBoxW( my $handle, to-c-str( $MessageStr ), to-c-str( > $TitleStr ), MB_ICONEXCLAMATION ); MessageBoxW is documented at "https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox" - it does not mention any timeout. I have written some code for a "Windows popup with timeout" in C++, but I doubt it will help you. It displays the message box in a separate thread, while the main thread waits for it on a condition variable with a timeout. I guess you would get better responses in forums where Perl or Windows are on topic. |
T <T@invalid.invalid>: Dec 03 01:17AM -0800 On 2019-12-03 00:13, Paavo Helde wrote: > a timeout. > I guess you would get better responses in forums where Perl or Windows > are on topic. Hi Paavo, Now I know were and what is going on with my MessageBoxW call. On your reference, I also found MessageBoxIndirectA and MessageBoxIndirectW. Maybe they will work. It is worth experimenting! Thank you! -T |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Dec 03 11:08AM +0100 On 03.12.2019 06:02, T wrote: > a native call and I do believe it is a C++ call, but I > really don't know what I am doing when it comes to > anything C. Perl code that calls a C function in the Windows API. Naturally that's best asked about in a C++ language group. > Do any of you guys know how to add a time out to the > pop up? I do believe it would be in the choice of the > constants. No, `MessageBox` and immediate closest family does not support any timeouts. It may be that this JScript snippet, using the some of the COM-based scripting support in the Windows API, can help you: var WshShell = WScript.CreateObject("WScript.Shell"); var BtnCode = WshShell.Popup("Do you feel alright?", 7, "Answer This Question:", 4 + 32); switch(BtnCode) { case 6: WScript.Echo("Glad to hear you feel alright."); break; case 7: WScript.Echo("Hope you're feeling better soon."); break; case -1: WScript.Echo("Is there anybody out there?"); break; } Here "7" is the number of seconds before the message box closes automatically, and "WScript.Shell" is a COM programmatic ID, which you maybe can use with the relevant COM object creation functionality in Perl, if there is. > Many thanks, Oh, don't mention it. - Alf |
T <T@invalid.invalid>: Dec 03 03:06AM -0800 On 2019-12-03 02:08, Alf P. Steinbach wrote: >> Many thanks, > Oh, don't mention it. > - Alf Thank you! |
Geoff <geoff@invalid.invalid>: Dec 03 12:28PM -0800 >constants. >Many thanks, >-T There is no provision for a timeout in any message box in Windows. However, you can probably use SetTimer in the initialization of the message box with a pointer to a TimerProc and when the timer expires the TimerProc function can send a WM_COMMAND message to the message box. |
T <T@invalid.invalid>: Dec 03 02:14PM -0800 On 2019-12-03 12:28, Geoff wrote: > message box with a pointer to a TimerProc and when the timer expires > the TimerProc function can send a WM_COMMAND message to the message > box. That explains it. Thank you! I am spoiled by Linux's send-notify. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Dec 03 05:05PM On 01/12/2019 17:33, Christian Gollwitzer wrote: >> capable of defining the syntax of any >> context-free grammar: > here is your problem: C is not context free. It is usually dealt with the "lexer hack" to use a parser for context-free grammar. neos can compile code for languages which aren't definable using a context free grammar; neos also deals with BOTH the syntax AND the semantics of a language. > Also, parsing the syntax is only a minor step in most actual compilers. The big pile of work is in the optimizer (which is in theory optional) and the code generator, and another big pile is in the library. Pure C without the library is good for nothing. > That's why most regulars in this group are rather sceptical of Flibble's project. A more realistic approach would sit on top of LLVM, where years of work have been done already. Try speaking for yourself and not for others unless you own some kind of fucking crystal ball. /Flibble -- "Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
boltar@nowhere.co.uk: Dec 03 05:09PM On Tue, 3 Dec 2019 17:05:03 +0000 >work have been done already. >Try speaking for yourself and not for others unless you own some kind of >fucking crystal ball. I'll speak for me - I'm sure your project is fun and important for you, but no one else gives a rats arse. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Dec 03 06:03PM >> fucking crystal ball. > I'll speak for me - I'm sure your project is fun and important for you, but no > one else gives a rats arse. You just contradicted yourself, dear. /Flibble -- "Snakes didn't evolve, instead talking snakes with legs changed into snakes." - Rick C. Hodgin "You won't burn in hell. But be nice anyway." – Ricky Gervais "I see Atheists are fighting and killing each other again, over who doesn't believe in any God the most. Oh, no..wait.. that never happens." – Ricky Gervais "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Byrne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Öö Tiib" <ootiib@hot.ee>: Dec 02 03:39PM -0800 On Monday, 2 December 2019 23:17:41 UTC+2, Melzzzzz wrote: > goal is safety in that kind of safety Rust is ok choice. > There were times I loved it (beginnings) then hated it, then I love it > again. One cannot be indeferent to Rust, that's for sure. Who knows? Google has Go and Apple has Swift so perhaps Microsoft also wants to have some garbage-free programming language. The syntax of Rust is not that different from Swift or Go. However the compiler feels like impressive effort of limiting ways to express nonsense. Actually what does it matter how easy it is to write some incoherent and buggy programs? There are no such "gotcha!" bear traps in Rust like C++ is full of and so it perhaps suits novices better than C++. |
Pankaj Jangid <p4j@j4d.net>: Dec 03 09:21AM +0530 Actually, it is considering implementing a new language inspired by Rust. https://www.zdnet.com/article/microsoft-were-creating-a-new-rust-based-programming-language-for-secure-coding/ -- Pankaj Jangid |
Cholo Lennon <chololennon@hotmail.com>: Dec 03 02:03AM -0300 On 12/3/19 12:51 AM, Pankaj Jangid wrote: > Actually, it is considering implementing a new language inspired by > Rust. https://www.zdnet.com/article/microsoft-were-creating-a-new-rust-based-programming-language-for-secure-coding/ OMG! I didn't know that, another programming language and what's worse, created/sponsored by Microsoft :-O I've already seen this several times... a company needs to have the control of the tool (Microsoft/VisualBasic/VisualJ/C#/TypeScript/F#, Sun/Java, Google/Go/Dart, JetBrains/Kotlin, etc) -- Cholo Lennon Bs.As. ARG |
gazelle@shell.xmission.com (Kenny McCormack): Dec 03 09:40AM In article <qs4qb5$1qt5$1@gioia.aioe.org>, >I've already seen this several times... a company needs to have the >control of the tool (Microsoft/VisualBasic/VisualJ/C#/TypeScript/F#, >Sun/Java, Google/Go/Dart, JetBrains/Kotlin, etc) Not Invented Here Syndrome. -- Just for a change of pace, this sig is *not* an obscure reference to comp.lang.c... |
David Brown <david.brown@hesbynett.no>: Dec 03 11:40AM +0100 On 03/12/2019 10:40, Kenny McCormack wrote: >> control of the tool (Microsoft/VisualBasic/VisualJ/C#/TypeScript/F#, >> Sun/Java, Google/Go/Dart, JetBrains/Kotlin, etc) > Not Invented Here Syndrome. Not /Controlled/ Here Syndrome. MS were quite happy to support Java as long as they could make their own incompatible version. When the courts said they were not allowed to do that (and still call it "Java"), they went off in a huff and made C# as their own alternative to Java which /they/ controlled. (I don't think MS are as bad at this as they used to be, and I am not implying that other companies are necessarily better.) |
gazelle@shell.xmission.com (Kenny McCormack): Dec 03 11:33AM In article <qs5e3e$91s$1@dont-email.me>, David Brown <david.brown@hesbynett.no> wrote: ... >incompatible version. When the courts said they were not allowed to do >that (and still call it "Java"), they went off in a huff and made C# as >their own alternative to Java which /they/ controlled. Well, they controlled it because they had invented it. I don't think we really disagree much here. P.S. People often talk as if C# was invented by itself, as a standalone language. In fact, C# is just one member of the .NET/CLR family. I think of VB.NET as the primary .NET language. I suppose C# comes next after VB. -- To my knowledge, Jacob Navia is not a Christian. - Rick C Hodgin - |
David Brown <david.brown@hesbynett.no>: Dec 03 04:24PM +0100 On 03/12/2019 12:33, Kenny McCormack wrote: >> that (and still call it "Java"), they went off in a huff and made C# as >> their own alternative to Java which /they/ controlled. > Well, they controlled it because they had invented it. Actually, I believe a fair amount of the work on dotnet / CLR was by Borland originally, within their Delphi range. But I am not sure about that (and it's getting a good deal off-topic here, even though they made C++ compilers). > I don't think we really disagree much here. Not much, no, but you have the logic reversed. It is not "MS made C#, so they get to control that language" - it is "MS wanted a language they controlled, so they made C#". |
Manfred <noname@add.invalid>: Dec 03 05:13PM +0100 On 12/3/2019 4:24 PM, David Brown wrote: > Borland originally, within their Delphi range. But I am not sure about > that (and it's getting a good deal off-topic here, even though they made > C++ compilers). C# was developed "originally" by Microsoft, but the lead architect of the project was (still is?) Anders Hejlsberg, who formerly was the chief architect of Turbo Pascal and Delphi at Borland. > Not much, no, but you have the logic reversed. It is not "MS made C#, > so they get to control that language" - it is "MS wanted a language they > controlled, so they made C#". Sounds pretty much like two sides of the same story. Bottom line is that they control the runtime, so they ensure that C# applications need the Windows ecosystem to run (Mono looks far too limited as far as I have seen). >> P.S. People often talk as if C# was invented by itself, as a standalone >> language. In fact, C# is just one member of the .NET/CLR family. I think >> of VB.NET as the primary .NET language. I suppose C# comes next after VB. I think VB.NET was the primary target from the marketing point of view, i.e. VB is a huge market for Microsoft, thus of primary relevance. I doubt that C# can be seen as a derivative of VB.NET (which I know little about, I have to admit), although contamination is evident. I think it is mostly because of the need for interoperability, rather than language derivation, though - one of the goals of C# was to talk easily with VB and remove the complexity of COM. |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment