windows

Is KillTimer necessary?

Hi All! I use SetTimer API and I see a lot of code like this: case WM_DESTROY: // Destroy the timer. KillTimer(hwnd, IDT_TIMER); PostQuitMessage(0); break; Do I have to call KillTimer or the system will automatically free resources on the process exit? Does forgetting to call KillTimer lead to resource leaks? I u...

How to generate a local user profile for a new user account in Windows?

I have created a new local Windows account and want to modify some of the personal data for this new created profile. But if this account was never logged in, the profile data is not generated and so I cannot modify it. I want to modify things like the NTUSER.dat to customize the Current User Registry and prepare things in the user’s per...

Override Drag and drop for Shell Extension

Hi All, I am working on a ShellExtension code in C++. I am creating a Virtual Drive. Which represents a repository somewhere in the Network. What I want now is to enable Drag-Drop functionality to this Drive. I want to enable user to drag the file to that Virtual Drive and then I must be able to Grab that event, so that I can perform my...

asp.net mvc with ioc --> avoiding constructor soup with BaseController

Hi, I have a BaseController that I'm using to house my cross cutting concerns for an MVC project. However, this means that my Controller has 3 dependencies: public BaseController (IUserService u, ITenantDetailsService t, ISiteConfiguration c) The side effect of this is that my constructors for each derived controller are awash with...

redraw combobox items when expanded

I have a .net 3.5 windows application with a bound combobox. I have overridden the DrawItem event to color the background of individual items based on certain conditions. I have asynchronous threads running which update the condition values and call Invalidate() to get the combobox to redraw. This all works very well, except when the co...

App Shutdown C# Windows

hi, my C# app is still in RAM after executing Application.Current.Shutdown(); (db connection is closed before) (Application.Current.Exit += new ExitEventHandler(Current_Exit); is also used ) is there another statement to use ? the problem occurs on different Windows Xp systems and on Server 2008. kind regards, jeff ...

How to delete network executable files in use during NAnt Build

Related: How to force delete a file? I have a NAnt script that does a full build and deployment to our Dev environment. Deploying the C#.Net Win exe and its used DLLs involves moving them to a network location, where our testers and other developers run them. <copy todir="${dest.dir}" overwrite="true" failonerror="false" > ...

How do I create a bitmap with an alpha channel on the fly using GDI?

I am using layered windows and drawing a rounded rectangle on the screen. However, I'd like to smooth out the jagged edges. I think that I'll need alpha blending for this. Is there a way I can do this with GDI? ...

TerminateProcess vs Ctrl+C

I have a console-mode program that uses SQLite3 to maintain a database file. It takes a while to execute, but it should be safe at any point to cancel, assuming that the database writes happen. (This is all under Windows) Is it any safer, from the point of a running program, to hit CTRL+C in the console than to have another program ca...

Batch Delete Files From File On Cmd Line

I have a long list of file names in a txt file, which I generated using findstr /M "string here" *.* > c:\files.log The file is about 3mb. Now i want to delete all of those files. I tried del < c:\files.log but that doesn't work. What should I use? ...

parsing bytes (C Windows)

I have a DWORD value that in Hex might look like: DWORD Val = 0xFF01091A How can I read each byte? What I mean is, how can I read FF, 01, 09 and 1A? Thanks! ...

How to implement a kill switch in a native windows program

We've got issues with our program potentially hanging in certain situations, is there a way to search and destroy your own program with windows calls without using task manager. It probably wouldn't make sense to include this in the program itself, but as a bundled thing no one would see. What's the best way to go about doing this, h...

How to read installer shortcuts with C# (WPF)

Background: I've decided to teach myself C# through WPF, and I'm writing a small application that needs to get a list of Start Menu shortcuts and their targets and store them. Basically, I'm trying to take all the shortcuts and put their target applications' paths into memory. However, I've run into a problem trying to read Windows Insta...

How to set LANG variable in Windows?

I'm making an application that supports multi language. And I am using gettext and locale to solve this issue. How to set LANG variable in Windows? In Linux and Unix-like systems it's just as simple as $ LANG=en_US python appname.py And it will automatically set the locale to that particular language. But in Windows, the C:\>SET LA...

Word Ifilter installed on Windows 2k3 Server?

Does anyone know if the iFilters for MS Word are installed by default on a vanilla Win 2k3 server? ...

Deterministic builds under Windows

The ultimate goal is comparing 2 binaries built from exact same source in exact same environment and being able to tell that they indeed are functionally equivalent. One application for this would be focusing QA time on things that were actually changed between releases, as well as change monitoring in general. MSVC in tandem with PE ...

Programmatically compute the start time of a process on Windows

Hi, I'm writing c/c++ code on Windows using Visual Studio. I want to know how to calculate the start time of my process effectively. Can I just use gettimeofday()? I've found the following code from google but I don't understand what it's doing really : int gettimeofday(struct timeval *tv, struct timezone *tz) { FILETIME ft; uns...

Component disabling and enabling at runtime in Delphi 2K9. Weird problem...

Here is code: procedure DisableContrlOL(const cArray : array of string; ReEnable : boolean = False); // can be called from VKP / RAW / Generation clicks var AComponent: TComponent; CompListDis, CompListEna : TStringList; begin CompListDis := TStringList.Create; CompListEna := TStringList.Create; for i := Low(cArray) to High(cA...

Dynamic modules with DLLs on Windows

I'm writing an application in C that can be extended at runtime by means of modules / shared objects / DLLs. Those modules may use the API of the existing program but may also provide new functions for use in later loaded modules, so there is the possibility for modules to have dependencies on each other. My current approach under Linux...

%~$PATH:1 expansion issue

So I recently stumbled on the (potentially) useful %~$PATH:1 expansion, however I seem to be unable to make it work correctly. I tried to use it to make a cheap Windows version of the which command, however the syntax seems to be defeating me. My batch file looks like this: @echo off echo %~$PATH:1 However when I run this with for exa...