Code Monkey home page Code Monkey logo

desktopwindow's Issues

x86 gives exception.

Exception thrown at 0x76E5A6E2 in DesktopWindowSample.exe: Microsoft C++ exception: EEMessageException at memory location 0x00F7E548.
Exception thrown: 'System.EntryPointNotFoundException' in WindowExtensions.dll
An exception of type 'System.EntryPointNotFoundException' occurred in WindowExtensions.dll but was not handled in user code
Unable to find an entry point named 'SetWindowLongPtr' in DLL 'user32'.

Getting exception while running the code

System.Reflection.TargetInvocationException
HResult=0x80131604
Message=Exception has been thrown by the target of an invocation.
Source=System.Private.CoreLib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
at System.Activator.CreateInstanceT
at WinRT.WeakLazy`1.get_Value()
at Microsoft.UI.Xaml.Application._IApplicationStatics.get_Instance()
at Microsoft.UI.Xaml.Application.Start(ApplicationInitializationCallback callback)
at DesktopWindowSample.Program.Main(String[] args) in D:\Temp\DesktopWindow-master\DesktopWindow-master\DesktopWindowSample\DesktopWindowSample\obj\x86\Debug\net5.0-windows10.0.19041.0\App.g.i.cs:line 26

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
COMException: Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))

can't cancel window close

Canceling the window close doesn't work for me.

I'm doing:

this.Closing += MainWin_Closing;
private void MainWin_Closing(object sender, WindowClosingEventArgs e)
{
    if (someCondition())
	e.TryCancel();
}

When I click the X, the WM_CLOSE message is being intercepted by the NewWindowProc in DesktopWindow (at which point IsClosing is still false), so we call OnClosing() which then triggers my MainWin_Closing handler which then calls TryCancel() which sets IsClosing to true, but then we just exit.

What am I doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.