Categories
Development

Why do Get­Class­Name and Real­Get­Window­Class return the same value?

The goal I developed a keyboard in Unity3D (C#) and want it to pop up when the users click on “EDIT” type control such as a address bar or an input field. Therefore, I need to detect when an “EDIT” control is clicked. What I’ve tried Currently I use SetWinEventHook and listen to event EVENT_OBJECT_FOCUS […]

Categories
Development

Issues using TwainDotNet in WinForms when opening data source more than once

I am using the TwainDotNet library from GitHub, in a WinForms application. If a document is loaded and I start a scan, the job is successful and I can start another. If there is an error, such as a document not being loaded, then an attempt to scan will throw the DocumentNotLoaded exception, but any […]

Categories
Development

Bring calculator window to front in Windows 10

I would like to ask you a question about bringing calculator window to front in Windows 10. I have tested a lot of codes, but nothing is really working. I think the main problem is, that Calculator is part of “ApplicationFrameHost”. In my application (C# WinForm), I would like to start system Calculator, if it’s […]

Categories
Development Linux

Port C# code to Unix

Is it possible to control the Ubuntu terminal like I’m doing in Windows with this code? if so How can I do it? public Rasterizer(short width, short height) { StringBuilder = new StringBuilder(); DoubleBuffer = new DoubleBuffer<Color>(width, height); Width = width; Height = height; hConsole = CreateConsoleScreenBuffer( 0x80000000 | 0x40000000, 0x00000001 | 0x00000002, IntPtr.Zero, 0x00000001, […]

Categories
Development Windows

How to load registry hive for a newly created windows user who have never login?

I created a new windows user using C# and I would like to restrict list of apps to run through setting registry using C#. But the user profile and its registry is not initialized yet, since the user has never login, it will not have registry hive loaded and I cannot make changes. I have […]

Categories
Development

Strange behavior with DrawIconEx and GetDIBits, with alpha as zero

I’m using this code to capture the screen + cursor: new System.Security.Permissions.UIPermission(System.Security.Permissions.UIPermissionWindow.AllWindows).Demand(); var success = Native.BitBlt(_compatibleDeviceContext, 0, 0, Width, Height, _windowDeviceContext, Left, Top, Native.CopyPixelOperation.SourceCopy | Native.CopyPixelOperation.CaptureBlt); if (!success) return FrameCount; try { var cursorInfo = new Native.CursorInfo(); cursorInfo.cbSize = Marshal.SizeOf(cursorInfo); if (Native.GetCursorInfo(out cursorInfo)) { if (cursorInfo.flags == Native.CursorShowing) { var hicon = Native.CopyIcon(cursorInfo.hCursor); if (hicon […]

Categories
Development

Valid friendly monitor names with C#

My main development machine is a laptop with 2 screens: an internal screen and an external Samsung monitor. Generic PnP Monitor= 1366×768, Top: 0, Left: 1920 -> secondary display SF350_S24F350FH / S24F352FH / S24F354FH (HDMI)= 1920×1080, Top: 0, Left: 0 -> main display And my codes are: Dispay.cs using System; using System.Collections.Generic; using System.Drawing; using […]

Categories
Development

How to close WPF system tray application from another app?

I have a windowless WPF application using great NotifyIcon by Philipp Sumi. I’m gladly replacing my old WinForms based version, however, I have one problem. My app has uninstaller that closes the tray application before removing the executable files. The closing thing is done with sending WM_CLOSE message to the tray application process. It’s relatively […]

Categories
Development

CallbackOnCollectedDelegate detected

After few minutes of successfull running I get this error in my application. Asistente para la depuración administrada ‘CallbackOnCollectedDelegate’ Se realizó una devolución de llamada al delegado recolectado de tipo ‘Threads!Threads.Hud+NativeMethods+WinEventDelegate::Invoke’. Since I cant figure out which part of the code is in responsible for this issue, I’m posting the complete class here. (I guess […]