Asked  9 Months ago    Answers:  5   Viewed   10 times

We can’t just leave our customers that are not able to upgrade to windows 8 for a long time in the larch. However there is demand for a “tablet”/”touch” version of our app.

So how can we support both touch with Metro on Windows 8 and our current customers from a single code base?

When WPF come out, after a lot of “Pushing” Microsoft saw since and make it work on Windows XP – has anything like this been talked about for WinRT.

(I am not expecting any solution to work on XP, as XP support is being wound down.)

See Also: Can the ARM version of Windows 8 only run Metro (WinRt) style apps?



The best answer is that you do not want the same application to run on Windows 7 and Windows 8 Metro style. The UI that works best for mouse and keyboards (windows 7) will not work well for a touch-first presentation and visa versa. It is important to re-imagine the UI for the two different worlds.

That said, you have 2 options if you want to share a lot of the code: 1) Write it largely in JavaScript/HTML5. This will let you re-use many of the assets (especially the business logic parts). 2) Write it in (desktop) Silverlight. The Silverlight XAML is closest to Windows XAML. WPF is further away and will require more re-work later.

In either case, you should look at and follow the principles used when writing cross-platform code. Understand the platform dependencies and isolate them behind indirection boundaries. You want to localize all of the code that will have to change. For instance, you don't want calls to the .Net System.IO.File APIs which you know will have to change to Windows.System.Storage calls being scattered throughout your code. Instead, you want it localized in one function that can be modified later.

Saturday, September 18, 2021

Update: There is now a better answer to this question: use GDB _is_caller convenience function.

The need you describe comes up quite often, usually in the context of some_utility_fn being called a lot, but you only are interested in the call which comes from some_other_fn.

You could probably script this entire interaction using the new embedded Python support in GDB from CVS trunk.

Without Python, you are limited in what you can do, but the usual technique is to have a disabled breakpoint on a(), and enable it from a command, attached to a breakpoint on b().

Here is an example:

int a(int x)
  return x + 1;

int b()
  return a(1);

int call_a_lots()
  int i, sum = 0;
  for (i = 0; i < 100; i++)
    sum += a(i);

int main()
  return b();

gcc -g t.c
gdb -q ./a.out
Reading symbols from /tmp/a.out...done.
(gdb) break a
Breakpoint 1 at 0x4004cb: file t.c, line 3.
(gdb) disable 1
(gdb) break b
Breakpoint 2 at 0x4004d7: file t.c, line 8.
(gdb) command 2
>enable 1
(gdb) run

Breakpoint 1, a (x=1) at t.c:3
3     return x + 1;
(gdb) bt
#0  a (x=1) at t.c:3
#1  0x00000000004004e1 in b () at t.c:8
#2  0x000000000040052c in main () at t.c:21
(gdb) q

Voila: we've stopped on a() called from b(), ignoring previous 100 calls to a().

Friday, June 11, 2021

There are some new blog and forum articles around this topic, pointing to problems with API usage which disqualifies applications from the MS app store:

Why no native WinRT support in Delphi XE3? - quoting a forum post by Allen Bauer

We are very keen on supporting WinRT with native Delphi & C++ code. Right now, the issues surrounding the WinRT space center around the fact that many OS-supplied APIs which are required by anyone implementing their own language RTL are actually off-limits unless you’re the VC++ RTL DLL. You know, little things like RtlUnwind for exception processing and VirtualAlloc (et. al.) for memory management… Any calls to those APIs from your application will automatically disqualify your application from being an "official" WinRT application capable of delivering through the MS app store.

See also: Third-party compilers locked out of Windows Runtime development

On the other hand, this official Microsoft presentation contains a statement that

Martyn (Lovell) made it clear that we not only want language designers and implementers to add WinRT to their list of target platforms for their language and toolchains, but we will help and advise.

Sunday, August 8, 2021

The basic route to doing this:

Create your custom cursor and package it in a .res using a C++ Metro DLL Take a note of your resource id by peeking into the resource.h file in the C++ project In my project the resource number was 101 and I didn't adjust. Add the .res to a CSharp XAML Metro project Open your .csproj using a text editor Inside the first property group add a section that points to your .res file Switch out the cursor to the custom cursor using the function call you referenced, and the resource number you found by peeking at resource.h. Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Custom, 101);

I realize this is a lot. I posted a detailed step by step walk through on my blog at . Hope this helps.

Sunday, August 15, 2021

You could subclass the classmethod descriptor:

class classonly(classmethod):
    def __get__(self, obj, type):
        if obj: raise AttributeError
        return super(classonly, self).__get__(obj, type)

This is how it would behave:

class C(object):
    def foo(cls):
        return 42
>>> c=C()

This desugars to the descriptor call (rather, it is invoked by the default implementation of __getattribute__):

>>> C.__dict__['foo'].__get__(None, C)
<bound method of <class '__main__.C'>>
>>> C.__dict__['foo'].__get__(c, type(c))

Required reading: Data Model — Implementing Descriptors and Descriptor HowTo Guide.

Tuesday, December 28, 2021
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :