Menu
  • HOME
  • TAGS

DeleteFile() or unlink() calls succeed but doesn't remove file

c,windows,winapi,win32-process

Assuming that you call your Createfile function, then later call your remove_file function... you still have a handle open to the file. The WinAPI function CreateFile, if it succeeds, keeps a handle open on the file. In your provided code, you don't close that handle. From the documentation on DeleteFile:...

multiple dialog processes to controls? winapi / C++

c++,winapi,win32-process

To change the border color of edit control, you have to subclass the edit control and override WM_NCPAINT. That's a little advanced, and you don't really need it. You can just use WS_EX_CLIENTEDGE flag: CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT" ... Also make sure project manifest is setup so you get modern window's look....

Why HANDLE created by 'CreateEvent' isn't valid in another process?

c++,winapi,handle,win32-process

Handles are kinda like pointers in that they're usually process-specific. It takes special actions (like using DuplicateHandle) to share them. Depending on the situation, it might just be easier to name the object and then have the other process access it that way. See the fourth parameter of CreateEvent....

Is Short File Name us available in both Windows 64 and Windows32

windows,win32com,win32-process

It's present regardless of bitness.

Detect PowerModeChange and wait for execution

c#,winapi,power-management,win32-process

There are some unmanaged APIs that can help with this, specifically ShutdownBlockReasonCreate and ShutdownBlockReasonDestroy. Its important to note that these two functions must be paired, when you call one, you have to make sure you call the other one (for example, in the event of an exception), otherwise the shutdown...