Quantcast
Channel: General Windows Desktop Development Issues forum
Viewing all 6180 articles
Browse latest View live

Where is the Screen Mode data stored in windows 10 ?

$
0
0

Hi,

I'm trying to discover where to look to find which Display Mode my computer is set to.

I can set it to whatever mode I like by using the 'Windows Key' and the 'P' key, that's fine, but I'd like to know where that information is stored in order to be able to read it in a Visual Basic .NET application.

I've spent a few hours trying to find an answer but have not found it yet.

Old Sea Dog.


Modifying visual effects using SystemParametersInfo

$
0
0

I have managed to modify several of the visual effect settings. I'm currently missing a few options though. Does anyone know where I can find how to modify the remaining options?

Here's the settings I have managed to edit:

SPI_SETCLIENTAREAANIMATION = Animate controls and elements inside windows
SPI_SETANIMATION = Animate windows when minimizing and maximizing        
SPI_SETMENUANIMATION = Fade or slide menus into view                     
SPI_SETCURSORSHADOW = Show shadows under mouse pointer                   
SPI_SETDROPSHADOW = Show shadows under windows                           
SPI_SETCOMBOBOXANIMATION = Slide open combo boxes                        
SPI_SETCLEARTYPE = Smooth edges of screen fonts                          
SPI_SETLISTBOXSMOOTHSCROLLING = Smooth-scroll list boxes                 
SPI_SETUIEFFECTS = A whole bunch of settings                             

Here's the ones I am still missing:

Animations in the taskbar and Start Menu       
Show translucent selection rectangle           
Show window content while dragging             
Use drop shadows for icon labels on the desktop
Use visual styles on windows and buttons       

Thanks.


Raw input blocks input locale switching when RIDEV_NOLEGACY is specified

$
0
0

Hi all.

I'm writing a keyboard input system for Windows based on raw input. It is implemented with RIDEV_NOLEGACY flag set, and legacy keyboard messages are generated manually, only when input was not processed by clients.

I've managed to get it working but language switching hotkey (Alt+Shift in my case) is now broken.

With RIDEV_NOLEGACY handler can consume WM_INPUT or leave it unprocessed. In the second case system generates WM_[SYS]KEYUP / WM_[SYS]KEYDOWN messages by itself and posts them via PostMessage. Since PostMessage doesn't update thread's keyboard state, system updates it too in an appropriate place. So 3, 4 and 5 are OK. But Alt+Shift stops responding.

Without RIDEV_NOLEGACY Alt+Shift changes locale as expected, but raw input generates legacy WM_[SYS]KEYUP / WM_[SYS]KEYDOWN regardless of whether some client processed WM_INPUT or not.

There is a minimal working example of the problem:

https://github.com/niello/misc/tree/master/RawInputLocale

Reproduced on Win10 and Win8.1, but probably will be the same on any Windows since Vista.

Note that if you set USE_NOLEGACY_RAW_INPUT in an example to true, WM_CHAR messages are generated only for each second keystroke, as if another one was consumed by our system client, but if you try to change input locale, nothing happens. And if you set USE_NOLEGACY_RAW_INPUT to false you will switch locale normally and receive WM_INPUTLANGCHANGE, but WM_CHAR will be generated for consumed keystrokes too.

I've run out of ideas, so any help will be greatly appreciated.

Failed. Error Code 1816 - While uninstalling software

$
0
0

Hi All,

I am uninstalling a software using Ansible from a windows machine.

During un-installation internally we unregister/stop services.
We are getting error in this. "Failed Error Code: 1816".

The command we are using to stop/unregister:
- net stop ServiceName /Yes

I searched and this error code is pointing to "Not Enough Space to Process".

I have checked that we have allocated around 40 GB for offline/temporary files in this system.

Any pointers to resolve this would be really helpful.

The frosted glass effect of UWP application realized by C++

$
0
0
There is a 'Frosted-glass' effect that makes the UWP form transparent and produces Gaussian blur. How can this effect be achieved?

How to get the HWND of a particular application based on its executable file name?

$
0
0

I need to get the HWND of a particular application. My first attempt was to traverse all top-level windows and filter out the one I want using the window's caption. But later I noticed that the caption can change occasionally so this approach is not reliable. As a result, I decided to use executable file name as the filtering criteria because it does not change. But I don't have the knowledge to do this, so can you share me a sample code or point me to some useful link? To be more specific, what I want is a piece of C++ code with input parameter being a const char * which stores the executable file name and return being the HWND of the top-level window of the application with the given executable file name. Thank you.

Some environment information:

- Assume the particular application has already run in the system.

- The particular application has normal window style.

- Windows 10 64-bit.

- Visual Studio 2015.

How do I programmitcally launch EXE by disabling compatibility mode?

$
0
0

User launches my EXE in compatibility mode which launches another EXE but I don't want the child EXE to inherit the compatibility mode settings. How do I achieve it? Cannot find any resources which makes this work.

I'm using ShellExecuteEx to launch the child EXE (it requires administrative privilege)


Sameer Thigale

How can EXE detect that it is running in compatibility mode and abort?

$
0
0
I don't want EXE to run in compatibility mode. Can the EXE gracefully exit by showing some message?

Sameer Thigale


How do I develop an EXE which cannot run in compatibility mode?

$
0
0

I can see that winver.exe does not have "compatibility" tab. How do I create similar EXE which cannot run in compatibility mode at all?


Sameer Thigale


What is the true scope of CP_UTF8 in MapiMessage::ulReserved?

$
0
0

MapiMessage documentation page [1] mentions a special value possible for MapiMessage::ulReserved: when it's CP_UTF8, then the struct's "lpszSubject, lpszNoteText, lpszMessageType, lpszDateReceived, lpszConversationID" are "UTF-8 instead of ANSI strings". I couldn't find other mentions of this special value in the documentation.

Yet, while debugging Thunderbird MAPI implementation, I see that MS Word 2016 uses this special value when sends the document using File->Share->Email->Send as Attachment (when it uses MAPISendMail, even when MAPISendMailW is available); and when doing so, the special value has at least one additional effect: in the MapiFileDesc struct [2] pointed to by lpFiles, at least lpszFileName also becomes UTF-8 (I see that when file name is not representable in current ACP, and ACP isn't the beta UTF-8 in Windows 10).

In my testing, I couldn't come with a method how to test other strings in the data passed by Word; but it is possible that also MapiFileDesc::lpszPathName, and the strings inside MapiRecipDesc [3] (lpszName,lpszAddress), could be affected (e.g., what is pointed by lpOriginator, lpRecips) - or not, e.g. if they are expected to be in ASCII (who knows - there's no mention about that in the documentation!).

So the question is: *what is the real scope of the CP_UTF8 value of MapiMessage::ulReserved*? Which exhaustive set of data should I treat as UTF-8 with that flag when implementing MAPI DLL? Thank you!

[1] https://docs.microsoft.com/en-us/windows/desktop/api/mapi/ns-mapi-mapimessage

[2] https://docs.microsoft.com/en-us/windows/desktop/api/mapi/ns-mapi-mapifiledesc

[3] https://docs.microsoft.com/en-us/windows/desktop/api/mapi/ns-mapi-mapirecipdesc

Flow Document to PDF

$
0
0

Hi Experts,

       Is any way to save a flow document to PDF directly ( Currently i am  converting into image then pdf) 

     


Wrapping/Unwrapping private keys with CNG

$
0
0

PKCS #11 Defines a procedure for wrapping/unwrapping of private keys using symmetric keys PKCS #11 v2.20 (Section 12.6). The unwrapping procedure simply reverses the wrapping procedure; so there is a C_UnwrapKey function to complement C_WrapKey.

I was wondering if there is a similar procedure with CNG (or CAPI; but i prefer CNG). Importing PKCS#8 encrypted key to RSACng is the best i found to describe the capabilities of CNG with regard to accepting PKCS#8 encrypted private keys (to unwrap them). However, there it mentions only PKCS#8 keys that were encrypted using a password - i know Microsoft did this in order to be compatible with PKCS#12 to support PFX files, yet i want to be able to decrypt an encrypted PKCS#8 private key using an existing key in the CNG provider (i.e. to unwrap the key) just as described in PKCS#11.

Can anybody confirm whether such a capability exists anywhere within CNG and if it exists, then i would appreciate any directions.

How to get Windows certification for a non UWP desktop application?

$
0
0

I'm trying to get my Windows desktop application certified for Windows without converting it to UWP or utilizing the desktop bridge.  According to the article on the below link I should run the Windows App Certification Kit and then submit the test result to the "Windows Certification Dashboard".

https://docs.microsoft.com/en-us/windows/desktop/win_cert/windows-certification-portal

However, the "Windows Certification Dashboard" only provides links to the hardware driver submission process (not for desktop software application).

https://msdn.microsoft.com/library/windows/hardware/br230791.aspx

Is there any way for us to submit and receive Windows certification for a regular desktop application developed without UWP or use of the Desktop bridge because we are not currently targeting distribution on the Windows Store yet.

It would be very much appreciated if someone can point me to the proper submission process so that I can get my application certified for Windows.

Thank you!

Kevin







Generic HID access using C# - unable to read all packets.

$
0
0

I have a custom HID device (sensor) transmitting data every 1ms. The dataare received at the PC without losing packets, and thisis confirmed by <g class="gr_ gr_41 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="41" id="41">analysing</g> USB traffic with USBlyzer.

I have written a simple code in C# using WPF to read data under Windows 10 at 1ms update rate. The 16-bit index is included in each packet to check that all packets havebeen received. Debugging info shows that the program reads all the packets during first 10 seconds, sometimes for much longer. However, on some occasions, after first 10 seconds ofcorrect reading, the update rate drops and packets are now detected only every 5 to 10 ms.

Application priorityis set to high. When restarting the HID <g class="gr_ gr_37 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="37" id="37">initialisation</g>, thenormal reading speed returns back for at least next 10 seconds, sometimes for more than 1 hour.

Is it possible to suggest a way of reading all data without missing individual packets?

Below I included example of the code:

// HID initialization:

 

       privateasyncTask<Boolean> InitHid()

       {

           try

           {

               isHid = false;

               string hidDeviceSelector =HidDevice.GetDeviceSelector(usagePage, usageId, vendorId, productId);

 

                 hidDeviceInformationCollection = awaitDeviceInformation.FindAllAsync(hidDeviceSelector);

               if (hidDeviceInformationCollection.Count > 0)

               {

                   hidDevice = awaitHidDevice.FromIdAsync(hidDeviceInformationCollection.ElementAt(0).Id,FileAccessMode.ReadWrite);

                   if (hidDevice !=null)

                   {

                       // construct a HID output report to send to the device

                       isHid = true;

                       Debug.WriteLine("InitHid ok");

 

                       if (!isRegInputReportEventsHid)

                       {

                           // Registration  Input Report Events from HID

                           hidDevice.InputReportReceived += HandleInputReportRecieved;

                           isRegInputReportEventsHid = true;

                       }

 

                   }

               }

           }

           catch

           {

               isHid = false;

               Debug.WriteLine("InitHid false err");

           }

           return isHid;

       }

 

 

// main code to receive data and <g class="gr_ gr_35 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="35" id="35">analyse</g> for missing packets:

   privatevoid HandleInputReportRecieved(

           HidDevice sender,

           HidInputReportReceivedEventArgs args)

       {

           HidInputReport inputReport = args.Report;

           IBuffer buffer = inputReport.Data;

           DataReader dr =DataReader.FromBuffer(buffer);

           byte[] bytes =newbyte[inputReport.Data.Length];

           dr.ReadBytes(bytes);

 

           int diffSensor = (unt16)((uint)bytes[4] * 256 + (uint)bytes[5]);

 

           if (testhid != (diffSensor-1))

           {

               Debug.WriteLine("Testhid {0} difi {1}; ", testhid, diffSensor);

           }

 

           testhid = diffSensor;

           

       }

 

How do I get exact and true Windows version even if EXE is running in compatibility mode in C++?

$
0
0

I want to get exact & true version of Windows even if process is running in OS compatibility mode.

I tried to read version of kernel32.dll, but it still gives version as reported by compatibility mode.


Sameer Thigale


Printing from System.Windows.Forms.WebBrowser

$
0
0

Hi,

   I have a windows form (not WPF) application with a System.Windows.Forms.WebBrowser control. I have text marked up in  the control with background highlighting, underlining and borders for specific characters (see below for image). I would like users to be able to print and retain all the formatting. I tried using the browser's print with RightClick-Print. That does not print the highlight colors. I tried copying and pasting into Word. That does not print the borders. So then I cobbled together the following code (which I don't quite understand):

 private void printBowserButton_Click(object sender, EventArgs e)
        {
            System.Drawing.Printing.PrintDocument printDoc = new System.Drawing.Printing.PrintDocument();
            printDoc.PrintPage += PrintDoc_PrintPage;
            printDoc.Print();
        }
        private void PrintDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Bitmap image = TakeScreenShot(startStopRegionBrowser);
            e.Graphics.DrawImage(image, e.MarginBounds.Left, e.MarginBounds.Top);
        }

        private Bitmap TakeScreenShot(Control control)
        {
            Bitmap tmpImg = new Bitmap(control.Width, control.Height);
            using (Graphics g = Graphics.FromImage(tmpImg))
            {
                g.CopyFromScreen(
                    control.PointToScreen(new Point(0, 0)),
                    new Point(0, 0),
                    new Size(control.Width, control.Height));
            }
            return tmpImg;
        }

This works and prints an image of the portion of the webbrowser control that is visible when the print button is clicked. I would really like to print the complete document. Any suggestions?

I am programming in C# using Visual Studio Enterprise 2017 with .Net Framework 4.6.1. I am running Windows 10. My default Web Browser is IE 11 (does that matter?).

If this is the wrong forum, can you please point me in the right direction?

Thanks!

Ethan


Ethan Strauss

What to use in place of DoEvents?

$
0
0

Main Form:

            InitializeComponent();
            this.FormClosing += FrmMain_FormClosing;
            this.backgroundWorker1.ProgressChanged += BackgroundWorker1_ProgressChanged;
            backgroundWorker1.WorkerReportsProgress = true;

            //backgroundWorker1.WorkerSupportsCancellation = true;

           private void BackgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)

        {
            //const int WM_NCLBUTTONDOWN = 0xA1;
            //const int HT_CAPTION = 0x2;

            //this.Capture = false;
            //Message msg = Message.Create(this.Handle,
            //    WM_NCLBUTTONDOWN, (IntPtr)HT_CAPTION, IntPtr.Zero);
            //WndProc(ref msg);
            //this.Invalidate();
            pbInvoices.PerformStep();
        }

Class where I use it:

                        //pbInvoices.PerformStep();
                        //bWorker.RunWorkerAsync();
                        bWorker.ReportProgress(pbInvoices.Value/pbInvoices.Maximum);

The ProgressBar updates just fine via the BackgroundWorker event but what in the world am I supposed to use in place of DoEvents when I want to allow the user to move the window around?  Everything I see on the internet about this involves passing the buck by saying "refer to this link"!  What can I use in place of DoEvents for my Winforms app?

GetVersionEx returns version as Windows 7 even if application is manifested for Windows 10 and process is not running in compatibility mode

$
0
0

Hi all, I've end users who are running on Windows 10 systems (I know that definitely since my other related processes have determined OS as Windows 10).

When my process runs, it uses GetVersionEx to determine version of Windows and gets resulted version as 6.2 (for other users as 6.3).

This EXE is manifested for Windows 10 and written in C++.

Now this program I know is not running in compatibility mode since it is present at a random location every time and there is no possibility that user goes to that location and changes compatibility settings. Since it is a short lived process and gets deleted immediately.

I'm not seeing this issue reported on all Windows 10 systems only few users are reporting it.

Can some one please suggest based on above information why GetVersionEx returns incorrect version of Windows?


Sameer Thigale

To update the exception list (bypass proxy list) of proxy settings in IE through C#

$
0
0

Hi,

We are developing a desktop application using WPF and C#, as part of our functional requirements, we have to update the exception list (bypass addresses) to view local addresses on browser.

The code has been taken from this source: https://www.codeproject.com/Tips/1223511/Csharp-Programming-Enable-Disable-Proxy-IP

 Registry.SetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", "ProxyOverride", _proxyByPass);
// Forcing the OS to refresh the IE settings to reflect new proxy settings.
 InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0);
InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0)

This code adds the IP address into bypass list  However, its not actually reflecting on browser side when we hit its IP into tab (IE, Chrome)

When we manually press OK on proxy settings once IP address is inserted through code (Connection-> LAN Settings-> Advanced -> Exception list), it works fine

To reflect the altered changes into IE, two functions are used of (wininet.dll) that refresh the IE setting ( I believe), but not working as expected

System  Environment:

  • OS: Win 7, 10
  • IE: 11.0
  • .Net Framework: v4.5.2

Can anyone guide on this  please?  How to add ip addresses permanently into IE ?

 

How does the display name correspond to the device name?

$
0
0
    HI,  I used the DisplayConfigGetDeviceInfo function to successfully get the display name, which appeared on the desktop - > display, and then EnumDisplayMonitors got all the monitor device names [\\\\.\\DISPLAY1]

    But if there are multiple monitors, how do I know which device corresponds to the monitored name?
Viewing all 6180 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>