windows

Can't send key to window with SendMessage

I'm writing a C program under Windows that should send an ENTER key to a dialog box to close it automatically. I retrieve the handle to the top level window I'm interested in (by means of EnumDesktopWindows()) and then try to send an ENTER key using SendMessage (note also that closing the window by sending WM_CLOSE works fine). None of...

Setup.exe files downloading without cab files over poor connections

We have customers who are trying to download a setup.exe file over mobile connections that appear to be very slow. They have reported that when they click on the downloaded setup.exe, the install wizard starts up, but part way through the wizard they get an error message indicating that a cab file is corrupt or missing. They couriered ...

Concatenate text files with Windows command line, dropping leading lines

I need to concatenate some relatively large text files, and would prefer to do this via the command line. Unfortunately I only have Windows, and cannot install new software. type file1.txt file2.txt > out.txt allows me to almost get what I want, but I don't want the 1st line of file2.txt to be included in out.txt. I have noticed that...

Processing Semicolon on Command line

I have two batch files which is used to run a large c+_+ build, the first one starts the processes, creating directories and figuring out what to send to the second script. If certain information is presented to the first script, I have a routine that pops up a window and asks for a password. This is passed to the second script by callin...

Audio out (What I Hear) to an UPnP device

I don't understand why this hasn't been addressed before, can't seem to find much info on this on the interwebs. I am sometimes listening to something on my computer and I want to play it to my XBOX 360 or Sonos (Multi-Room Music Manager) and I can't do that in a simple one-click way. I would want to simply be able to select the UPnP d...

Hide an access violation on another application

Hi, I have an application that sometimes causes an access violation on exit. This is quite unpredictable and all attempts to locate the bug have been unsuccesful so far. The bug is harmless, as no data is lost, so I was thinking if it might be possible to just hide it. Is it possible to have another app launch the buggy one and catch t...

Need some pointers/hints in writing a Windows Application

Hi, I want to create applications in windows that has complete portability (within windows OSes of course). I have tried using one application written in Visual C++ but I had a real tough time in making it run in other windows OS (like it required .net framework libraries to be installed). This put me on the back foot because I had to c...

Exporting static data in a DLL

I have a DLL which contains a class with static members. I use __declspec(dllexport) in order to make use of this class's methods. But when I link it to another project and try to compile it, I get "unresolved external symbol" errors for the static data. e.g. In DLL, Test.h class __declspec(dllexport) Test{ protected: static int d;...

perfmon counters on 64 bit windows

I'm trying to have perfmon counters to work both in 32bit and 64bit modes of the perfmon. I have two builds of my coutners dll, one in c:\windows\system32, the other in c:\windows\syswow64 folder. I can't get both of them to work at the same time though, only one at a time. As a matter of fact I can't even figure out what determines w...

How can I read piped input in Perl on Windows?

I am trying to create something in Perl that is basically like the Unix tee command. I'm trying to read each line of STDIN, run a substitution on it, and print it. (And eventually, also print it to a file.) This works if I'm using console input, but if I try to pipe input to the command it doesn't do anything. Here's a simple example: ...

Eclispe RCP SWT menus for Windows and Mac OS

Hi, how do I configure an Eclipse RCP command style menu to match the different menu structures on Windows and on Mac OS? Mac OS X menu example http://images.apple.com/macosx/refinements/images/services_menu_20090902.jpg Windows menu example http://www.flamingpear.com/images/psp8menu.gif In the example you see, the differences in the...

Portable Device Path on Windows

I've actually got an Windows/Java Question. I've got a plugged-in device which I want to access via Java. Normally you can access an e.g. USB-Stick via the Drive letter... but this tablet is displayed by Windows as a "Portable Device"... which means, that the Path is something like "Computer\Archos 5S" and there is no Drive letter. I ...

Is it possible to get the name of current active application

User can switch active application by Alt+Tab or by clicking on their icons in TaskBar. Is it possible to get the name (or other unique characteristic) of current active application? I want to write a program which collects statistic of the applications usage. ...

How to implement a password change check in Powershell?

I've created a set of virtual machines (Windows Server) with a specific admin password; these VMs have been assigned to users, and may be in use. I want to know if the user changed the admin password, and do the check so the user doesn't notice. What are good solutions in powershell? ...

Reading a directory

I'm trying to solve exercise from K it's about reading directories. This task is system dependent because it uses system calls. In the book example authors say that their example is written for Version 7 and System V UNIX systems and that they used the directory information in the header < sys/dir.h>, which looks like this: #ifndef DIRS...

deleting HBITMAP causes an access violation at runtime.

Hi, I have the following code to take a screenshot of a window, and get the colour of a specific pixel in it: void ProcessScreenshot(HWND hwnd){ HDC WinDC; HDC CopyDC; HBITMAP hBitmap; RECT rt; GetClientRect (hwnd, &rt); WinDC = GetDC (hwnd); CopyDC = CreateCompatibleDC (WinDC); //Create a bitmap compatible with the DC hBitmap = Cre...

How to read registry correctly for multiple values in c?

Hi! I created a .dll which should work like the RunAs command. The only difference is, that it should read from registry. My problem is, that i need to reed 3 values from the registry, but i can't. It reads the first, than it fails at the second one (Password) with error code 2, which means "The system cannot find the file specified". I...

How do I prevent flickering on CListCtrl?

I'm using a CListCtrl/CListView report view (LVS_REPORT) in virtual mode (LVS_OWNERDATA) with LVS_EX_DOUBLEBUFFER enabled and I encounter ugly flickering. Double buffer have a real effect but it doesn't stop all flickering (without it very slow). I'm not looking for switching to other controls that would require a high amount of rework ...

Memory allocation problem C/Cpp Windows critical error

Hi! I have a code that need to be "translated" from C to Cpp, and i cant understand, where's a problem. There is the part, where it crashes (windows critical error send/dontSend): nDim = sizeMax*(sizeMax+1)/2; printf("nDim = %d sizeMax = %d\n",nDim,sizeMax); hamilt = (double*)malloc(nDim*sizeof(double)); printf("End hamilt alloc. ...

Block windows shutdown

Hi! I need execute some code before Windows shutdown process each time. So, I want block Windows shutdown process for some time. How can i do it from Java or C++ Builder ? Thanks. ...