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

USB bootloading procedure

$
0
0

Hello, 

        I have previously written my own basic kernel in my class project. Now I am figuring out how to write a boot loader.

I seen examples where boot loaders are written to load the OS from floppies, but floppies are past, and I want to learn how to access USB , and try loading my kernel from USB. I know that Usb architecture is one of the most complex, But I would appreciate if anyone could direct me to a good source/sample code (other than the 600 page of USB 2.0/3.0 specification manual). Also if possible,  it would be great to know how Microsoft boots its kernel (Using ntdlr??).


HRESULT reverse bit order?

$
0
0

Hi

The 32-bit hexadecimal value 0x80000000 is represented as 10000000000000000000000000000000 in binary format. If we can agree that the 1 bit in this number is themost significant bit, or bit 31, then the bit order on the illustration near the top on the page explaining the structure of an HRESULT is reversed [http://msdn.microsoft.com/en-us/library/cc231198.aspx]. The name fields are in correct order, but the numbers above them are ascending from left to right. Or am I missing something here?

How to close/kill a Windows 8 app from a desktop app ?

$
0
0

Hello,

We've been trying to programmatically exit all Windows 8 (Metro) applications running on the computer from our kiosk-mode WPF application. So far all our attempts have failed :

  • Killing the process (for example WWAHost for a HTML/javascript app) leaves the application in the taskbar in a "zombie" state
  • Using ipackagedebugsettings works pretty well for all apps except IE, but it requires Windows SDK on all client computers
  • Getting all metro main windows (using the classname "Windows.UI.Core.CoreWindow"), switching to them using SetForegroundWindow then sending ALT+F4 using SendKeys. It's pretty sluggish and unreliable.
  • Sending a metro main window WM_CLOSE/SC_CLOSE/WM_QUIT doesn't exit the app

We're about to try mouse automation : right click the app icon in the taskbar then click "close". I guess it should work but it looks like a pretty ugly solution to me.

Is there a proper way to achieve this ?

Thank you

MSChart or other software package to support plotting / graphing of data for VS2013, C# app development?

$
0
0

Hi,  I'm developing Windows desktop apps using VS2013 and C# in a Win8.1 OS environment.  I would like to add plotting / graphing of data to my application.  Is MSChart the best option?  How do I download that?  Are there other good options?  I would like to generate charts similar to what MS Excel or Matlab generate.  Thanks, Arv

 

Windows Firewall set current profile

$
0
0

Is it possible to set the current profile in windows firewall ? Private/Domain/Public?

I am using HNetCfg.FwPolicy2 to retrieve CurrentProfileTypes, but wondered if was possible to set rather than just read.

using netsh has been unreliable and only sets the firewall on or of for a profile.. , I was hoping to use powershell 3 instead to force the current profile.

netsh advfirewall set pubilcprofile state off

netsh advfirewall set privateprofile state off

netsh advfirewall set domainprofile state on

many thanks in advance

K


kittuk



System.Runtime.InteropServices.COMException (0x80040201) when setting Internet Connection Sharing after restarting the PC

$
0
0

I was writing an internet sharing app, using WLanAPI.dll for softAP and NETCONLib for ICS.

Everything was fine, everything worked (I was able to start Full ICS service and use shared internet on other devices). Suddenly I started getting that exception:

System.Runtime.InteropServices.COMException (0x80040201): An event was unable to invoke any of the subscribers (Exception from HRESULT: 0x80040201)
   at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type)

It occurs when I am trying to set up my softAP as a Private connection of ICS, or when I try to set up my WiFi access as a public interface of ICS. It happens completely randomly as far as I am concerned.

I am running Windows 8, VS 2012, .NET 4.5.

If you need more details, ask and I will try to provide all the necessary info.

Please people this has been giving me a headache for 2 weeks now and apparently nobody can help...

Thanks for help



IMsRdpClientNonScriptable::SendKeys

$
0
0

I'd like to use the IMsRdpClientNonScriptable::SendKeys function to transfer keystrokes to an RDP ActiveX plugin embedded in a Form.
I'm using C#, VS2008, .NET 3.5 and a clean test project only containing a few files.

Like in this topic:
http://social.msdn.microsoft.com/Forums/en-US/netfxcompact/thread/ba56a8f9-e3c2-4cc4-9565-67d6a1c5cb96 
the generated interface of IMsRdpCleintNonScriptable is not correct, however that's not my main issue.

I'm currently trying to figure out how to send key combinations like alt+f4, ctrl+alt+end to the Remote Computer.


FIRST issue:

According to MSDN the SendKey function is defined (http://msdn.microsoft.com/en-us/library/aa381294(VS.85).aspx) like this:

HRESULT SendKeys(







  [in]  LONG numKeys,







  [in]  VARIANT_BOOL *pbArrayKeyUp,







  [in]  LONG *plKeyData







);

plKeyData is according to MSDN the same as lParam in a WM_KEYDOWN message (link to WM_KEYDOWN in the MSDN article is broken, though).

lParam (plKeyData)







Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. 







0-15







Specifies the repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.







16-23







Specifies the scan code. The value depends on the OEM.







24







Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.







25-28







Reserved; do not use.







29







Specifies the context code. The value is always 0 for a WM_KEYDOWN message.







30







Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up.







31







Specifies the transition state. The value is always zero for a WM_KEYDOWN message.








But passing this as plKeyData does NOT work! Contrary to what MSDN claims the scancode has to be put at offset 0 (instead of 16). So there is no repeat count, whatsoever.

SECOND issue:

Also sometimes the function fails with E_FAIL (someone with same problem: http://stackoverflow.com/questions/1069990/keep-alive-code-fails-with-new-rdp-client) and I'm not sure why.



So I'd like to know
- Where can I find a correct spec of the function?
- Why does SendKey sometimes fail with an Exception?
- Does anyone know how to send keystrokes like alt + f4 using the IMsRdpClientNonScriptable Interface (Form.SendKeys and keybd_event aren't reliable)

httpsendrqeuest returns EROR_FILE_NOT_FOUND while "WorkOffline" is UNchecked

$
0
0

I'm using WinInet to connect to two (unrelated) webservices.

One works like a charm, the other runs into ERROR_FILE_NOT_FOUND on getlastError immediately after httpsendRequest.

The documentation states that this may happen if "Working offline" is checked in Internet Explorer. I checked this: this does work in both connections. However: where one conection works fine if "Working Offline" is unckeched, the other still returns ERROR_FILE_NOT_FOUND;

I cleared the cache of IE (and other browsers) but that doesn't help. The POSTed data however has been accepted...

Can this been caused by the fact that the service doesn't return any data, except for the header? If so, is there a way to bypass this?


Processes killed by Process.Kill still showing up as opened files

$
0
0

We have an executable that is provided by one of our servers and accessed by many remote computers. Every now and then we need to be able to kill all instances of our software that are still running. The obvious solution is to simply use Process.Kill, but for some reason some of the instances remain listed when we check Systems->Shared Folders->Open Files (or whatever the exact names are in English) on our server. This happens only in some of our warehouse on some PCs without any discernible pattern. Mostly it works, but sometimes the executable remains listed in open files.

Process.Kill seems to be applied to all instances though, as they are ended on the remote machines and disappear from task manager. For some reason they remain listed though. For now we have a complicated workaround, but would prefer to know what on Earth is going on or at least find a simpler workaround.

I am currently looking into net file <ID> /close (which might just use kill after all for all I know) or even Process.CloseMainWindow() and then finding a way to make sure the window has actually closed.

Both of these solutions aren't optimal though as they are still workarounds to the much simpler Process.Kill. So has anyone experienced any similar behavior or have any idea how to find the source of the problem?


EDIT: OK, so I've just been informed that we have also had cases where the process was not terminated at all. I will have to look into this as well. I guess I can close open files that aren't actually running with net file /close for now, but I'm still clueless about those that don't get terminated

WMIC invalid XSL format (or) file name

$
0
0

Executing the command wmic LogicalDisk where DriveType=3 get DeviceId,Size,FreeSpace /Format:csv returns the error Invalid XSL format (or) file name.

I have windows 7 64 bit.

Any workarounds?

Intermittent Performance Counter errors

$
0
0

(I know there is a Performance Counter for Windows (PCW) forum but I could not figure out its forum category when asking the question, so please forward to the correct forum for me if needed.)

My application is getting intermittent errors when trying to access some system counters throughPerformanceCounter class. The application runs on Windows Server 2008 R2 Standard as a service. 

Error #1:

EXCEPTION (LEVEL 1): System.ArgumentException
EXCEPTION OUTPUT: PerformanceCounter category Processor does not exist
Parameter name: counterPath

Error #2:

EXCEPTION (LEVEL 1): System.InvalidOperationException
EXCEPTION OUTPUT: The Counter layout for the Category specified is invalid, a counter of the type:  AverageCount64, AverageTimer32, CounterMultiTimer, CounterMultiTimerInverse, CounterMultiTimer100Ns, CounterMultiTimer100NsInverse, RawFraction, or SampleFraction has to be immediately followed by any of the base counter types: AverageBase, CounterMultiBase, RawBase or SampleBase.

STACK TRACE: 
   at System.Diagnostics.CategorySample.GetCounterDefinitionSample(String counter)
   at System.Diagnostics.PerformanceCounter.NextSample()
   at System.Diagnostics.PerformanceCounter.NextValue()
   at System.Collections.Generic.List`1.ForEach(Action`1 action)

The error occurs intermittently every day on various servers, but when I manually start the service it works just fine.

Below are the performance counters my application tries to access:

            _processorUserPercent = new Counter(@"Processor(_Total)\% User Time");
            _processorSystemPercent = new Counter(@"Processor(_Total)\% Privileged Time");
            _memoryAvailableBytes = new Counter(@"Memory\Available Bytes");
            _networkBytesReceived = new Counter(@"Network Interface(*)\Bytes Received/sec");
            _networkBytesSent = new Counter(@"Network Interface(*)\Bytes Sent/sec");
            _diskBytesRead = new Counter(@"PhysicalDisk(_Total)\Avg. Disk Bytes/Read");
            _diskBytesWritten = new Counter(@"PhysicalDisk(_Total)\Avg. Disk Bytes/Write");

The Counter class:

    class Counter
    {
        private readonly List<PerformanceCounter> _counters;
        private readonly string _categoryName;
        private readonly string _counterName;

        public Counter(string counterPath)
        {
            var match = Regex.Match(counterPath, @"^([^()]*)(?:\((.*)\))?\\(.*)$");
            if (!match.Success)
                throw new ArgumentException("Invalid format", "counterPath");

            _categoryName = match.Groups[1].Value;
            _counterName = match.Groups[3].Value;
            var instanceName = match.Groups[2].Value;

            if (!PerformanceCounterCategory.Exists(_categoryName))
                throw new ArgumentException("PerformanceCounter category {0} does not exist".FormatWith(_categoryName), "counterPath");

            if (instanceName.IsNullOrEmpty())
            {
                _counters = new List<PerformanceCounter> { new PerformanceCounter(_categoryName, _counterName) };
            }
            else
            {
                var instanceNames = instanceName == "*"
                    ? new PerformanceCounterCategory(_categoryName).GetInstanceNames()
                    : new[] { instanceName };

                _counters = instanceNames
                    .Select(instance => new PerformanceCounter(_categoryName, _counterName, instance))
                    .ToList();
            }

            // prime NextValue to have non-zero value on first call to CollectValue
            _counters.ForEach(x => x.NextValue());
        }

        public float GetValue()
        {
            var values = new List<float>();

            foreach (var counter in _counters)
            {
                try
                {
                    values.Add(counter.NextValue());
                }
                catch (Win32Exception)
                {
                }
                catch (InvalidOperationException)
                {
                    // Happens when coming out of stand-by on desktop. Shouldn't happen on a production machine.
                }
            }

            return values.Sum();
        }
    }

2709 -- offline join completion information was not found. on Windows 8.1

$
0
0

I have an app that has been running fine on users machines in xp,7, and 8.0

This weekend 3 users purchased new 8.1 machines and are unable to install my app.

The get the message "2709 -- offline join completion information was not found." then the installer stops.

I verified that all anti virus. malware process's are not running. I also verified the installer exe is working correctly by copying to an older machine and running the installer.

Any ideas would be appreciated.


Inserting a file in the clipboard

$
0
0

Hello oh great Microsoft developing community!

I have just started working with C++ and I want to put a file into the clipboard, if possible on demand. I only have a Bytestream of the file and want to build it when its needed.

I want to have the file in the FormatList (actually, I have the file already there), but use delayed rendering. Only when paste is called the file should be build.

What do I have to do? I am more than confused, do I have to use Ole with Ole.SetClipboard (And what kind of cf-format do I have to put into the Formatetc then? Or is a simple Clipboard.SetData(file.xyz) enough?

GetSystemTimeAsFileTime Change

$
0
0

Recently, it seems a Windows 7 update from August of 2014 was responsible for reducing the time resolution accuracy ofGetSystemTimeAsFileTime via API and setting it at milliseconds rather than sub-milliseconds as before.  This is causing issues when reviewing personal application logs that have a sub-millisecond timestamp on them and resulting in randomly sorted records and incorrect investigations.  I was hoping to learn which update explicitly did this, because currently I am only left with a system restore to before Aug1 as my option whereas I would prefer to simply uninstall the aforementioned update.

Thanks!

How-To: Open a new hdc hwnd related screen in VB.NET?

$
0
0

Hi, I'm trying to get a tutorial together that will initialize a HDC to open a new screen.

So far, MSDN has given me this code.

hdc=CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL);

hBmp = CreateCompatibleBitmap(hdc, 400,400);

Is there anything more required (such as screen resolution) to open a new screen in Windows Desktop?

By the way, I *mean* a full screen to draw bitmap data to, not a borderless window in full screen mode.


How can pending input to a edit control be discarded?

$
0
0


I am hunting for an API or method to discard pending keyboard input.

For example,

Suppose the user has rapidly typed   1111\n  2222\n, and my program
is waiting for a \n to process the command.

I want to discard whatever is pending ( which will be 2222\n ) as input
when I see the first \n.


The situation is that I am trying to discard duplicate input that
is accidently generated by a device that simulates a keyboard.
But the duplicate data is valid after a time, just not immediately afterwards.
I especially don't want the 2222\n to be processed just after I do
1111\n

The C++ program is using MFC and a handler for
 ON_EN_CHANGE(IDC_EDIT_MSN, OnEnChangeEditMsn)

Thanks in advance for hints.

How to create a Windows 8.1 Desktop icon from the Metro/Start and/or Search Tool?

$
0
0

I'm a Desktop user, but often find myself needing to go to the Metro/Start and Search Tool to find programs and App(let)s in order to run them.  However, after doing this several times for many programs, I find myself wanting to create Desktop icons to run the programs more easily.  Is there a way to do this from the Metro/Start Icon and/or Search Tool results?



If not, Microsoft, please consider adding the ability to do this.



It would be very nice if this ability supported all of the icon types shown in the Metro/Start, Search Tool, and Control Panel interfaces, e.g.: Metro Apps, Desktop Programs, Charms, and Control Panel Applets.



Currently, there is a way to pin the Metro/Start Icon to the Desktop, but the Taskbar will get very cluttered with even only a handful icons.



It would be very nice if the desktop icon created by this also supported the context options that the program/app(let) now shows as Tasks when the icon is pinned to the Desktop Taskbar.



Additionally, it would be nice if I could also simply drag a Pinned Taskbar icon onto the Desktop area, again, retaining it's Tasks as context menu options when the Desktop Taskbar icon is right clicked.



This ability would be very helpful for people needing to get to programs and App(let)s, without having to resort the Metro/Start and Search Tool, because when there are a lot of Metro/Start icons, I have well over a hundred icons, it can be very hard to find one simply eye-balling lot.  The Search feature is much better, provided I know the name to look for and can remember it.



Finally, this ability would be very helpful, because the kinds of desktop shortcut icons that I can create using the New Shortcut option, assuming that can I find the program/App(let)'s name and path information, do not support the context options that the icons could in Windows 7 when an icon is created while installing the program.



Thanks,

Howard Brown 


hrb

In Windows 8.1 Restore Backups Made in Windows 7 Backup

$
0
0

I have just purchased a Dell Inspiron 3847 desktop computer that has Windows 8.1 installed. That computer replaces an HP laptop (running Windows 7) that died. While using the laptop, I saved regular backups on an external hard drive using Windows Backup. Now, I need to extract some of the backed up files from the external hard drive onto the hard drive on my new computer.

It’s been quite a surprise to see how different Windows 8.1 is from Windows 7. I’m just beginning to find my way around Windows 8.1. From what I’ve seen so far, the backup and restore facilities in Windows 8.1 are quite different from those in Windows 7. Windows 8.1 doesn’t seem to be able to read the backup files created by Windows 7.

Can anyone help me by providing information about how I can use Windows 8.1 to extract backup files created by Windows 7. I’ll appreciate all suggestions.

 

Background Intelligent Transfer Service (BITS) jobs with different priority.

$
0
0

I have one module which can be called to download files using BITS APIs. Here I am providing local path, remote URL and value for BG_JOB_PRIORITY.

In one scenario where I call download module via two different call with different BG_JOB_PRIORITY. 1st one has to download 1GB file with priority BG_JOB_PRIORITY_LOW and another call (when 1st job is active in transferring mode) to download module to download 2GB file with priority BG_JOB_PRIORITY_FOREGROUND.

I verified msdn link http://msdn.microsoft.com/en-us/library/aa362805%28v=vs.85%29.aspx which says that "Lower priority jobs do not receive transfer time until all higher priority jobs are transferred or in an error state.", so based on this my 2nd job should finish first to download 2GB file but this doesn't happens.

Based on my custom logs (in call back interface function JobModification), it seems that transfer time is sliced between these two jobs and lower size file downloaded first.

Please let me know if anyone has/had similar kind of experience and solution. How to complete high priority job first irrespective to size of file associated with it?

Thanks in advance.


OpenGL 4.5

$
0
0

I use NVIDIA graphics cards. Today OpenGL posted some new specs and updates towards the new OpenGL 4.5 which will be used in some upcoming game engines.

OpenGL 4.5 will need a DirectX 11 class GPU from NVIDIA or a HD 5000 series or newer to support it.

NVIDIA released 340.82 which is a beta with OpenGL 4.5 for those who use the GLSL etc

https://developer.nvidia.com/opengl-driver

The latest goodies from NVIDIA work finally with VC++ 2013


Corsair Carbide 300R with TX850V2
Asus M5A99FX PRO R2.0 CFX/SLI
AMD Phenom II 965 C3 Black Edition @ 4.0 GHz
G.SKILL RipjawsX DDR3-2133 8 GB
EVGA GTX 660 Ti FTW Signature 2 (GK104 Kepler)
Asus PA238QR IPS LED HDMI DP 1080p
ST2000DM001 & Windows 8.1 Professional x64
Microsoft Wireless Desktop 2000 & Wacom Bamboo CHT470M

Place your rig specifics into your signature like I have, makes it 100x easier to understand!

Hardcore Games Legendary is the Only Way to Play!

Viewing all 6180 articles
Browse latest View live