I am needing to make a custom window with WindowStyle.None, AllowsTransparency = true, etc.
One requirement is a custom ResizeGrip control.
I have this working with ResizeMode.CanResizeWithGrip, taking some code from an open source project found here: Fluid Kit
See the "GlassWindow" class if you're interested.
To do the work, I'm cal...
Probably a noob question but interop isn't one of my strong points yet.
Aside from limiting the number of overloads is there any reason I should declare my DllImports like:
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
And use them like this:
IntPtr lParam = Marshal...
I am using GetOpenFileName with multiple select capabilities. The files picked are returned in a LPSTR. Inside this LPSTR, the files selected are separated by NULL bytes. I want to split the LPSTR into an array and then loop over that array.
In PHP I would do:
$array = explode("\0", $string);
But since I am new to C, I have no idea ...
In Windows, there seems to be at least two ways to get to the frame buffer: GDI and DirectX.
The problem is that in order to use GDI or DirectX, it seems that you must be running a GUI application, and then from this application you can call the appropriate GDI and DirectX functions. For example:
#include <windows.h>
int WINAPI WinMai...
I'm attempting to shrink a file in place.
I'm replacing the contents of one file with those of another and when I'm done I want to make sure if the source file is smaller than the dest file, the dest file shrinks correctly.
(Why: because the dest file is a backup and writing to the media is very expensive, so I only write the deltas to ...
Hello All,
I am using the CheckTokenMembership Windows API to check if the user is an Administrator.
Here's the code:
Option Explicit
Private Const SECURITY_BUILTIN_DOMAIN_RID As Long = &H20
Private Const DOMAIN_ALIAS_RID_ADMINS As Long = &H220
Private Declare Function AllocateAndInitializeSid Lib "advapi32.dll" (pId...
I have an icon identified by an HICON handle that I want to draw centered on a custom control.
How do I determine the size of the icon so that I can calculate the correct drawing position?
...
To reduce flickering I create my parent windows using the WS_CLIPCHILDREN flag and I call InvalidateRect during the WM_SIZE event. This approach has worked well in Windows XP. However, I recently started programming on Windows 7 and I'm now experiencing rendering issues when resizing windows. When resizing a window its contents is not re...
I want to create an environment like UAC. i.e. my dialog should appear to the user and unless he responds to it, i want to disable the background. User should not be able to carry out any activity.
For this purpose I created a new desktop and display my dialog on the new desktop. But i want something like UAC where the background seems...
My application is crashing on Bitmap* image = new Bitmap(hicon) in a old Win XP installation. The stack trace is showing it is in gdiplus.dll, the version of the dll in this system is 5.1.3097.0. I tried with a newer version of dll (5.1.6001.0) and it was working fine. Is this a bug with GDI Plus? or am I doing something wrong.
What is ...
I've got a Windows service that needs to do certain things periodically. Should I use waitable timer objects or timer queues?
What are the pros and cons of the two approaches? Is this a false dichotomy? Is there a third way?
...
I need to know (preferably with the least latency) when foo.exe is launched.
Right now, I have a thread that sits in a light loop (~10 Hz) and walks the process tree looking foo.exe.
This is less than elegant and I was wondering whether I could register with some part of the Windows API to get a callback when any process starts.
If n...
I am currently writing a very lightweight program so I have to use C++ since it is not bound to .NET framework which drastically increases size of the program.
I need to be able to terminate process and to do that I need to get a process handle. Unfortuanately I haven't figured how to do that yet.
P.S. I know that to kill a process yo...
Is there a simple/small framework (Other than .NET) which allows you to create windowed applications with C++ under Win32. Just like a little DLL I can include with my app.
It should have basic functions like creating a window , buttons , text edits and handling them.
...
I'm writing a GUI driven by dialog boxes using Win32 and MSVC 6.0, and I'm struggling to understand the usage of WM_INITDIALOG.
It's my understanding that WM_INITDIALOG will be called by the dialog process prior to painting it to the screen. The issue I'm having is that WM_INITDIALOG is being called only when I am stepping through the ...
Is there a way to get all the API (Export) functions from a DLL file?
I know that programs such as Depends and PE Explorer can do that but none of them retrieve the argument list.
...
I have some code that does custom drawing. Basically it is form fill program that has a WYSIWYG editor. The editor allows a zoom level to be set. I am having problems with the width of my labels jumping to different sizes relative to everything else on the form.
An example of the code I am using to output the text is below. I'm pret...
I need to prevent application's memory pages from being swapped out of RAM on Windows. Is there a WinAPI function equivalent of POSIX mlockall() to achieve that?
...
I'm writing a Win32 DLL with a function that adds a directory to the Windows PATH environment variable (to be used in an installer).
Looking at the environment variables in Regedit or the Control Panel after the DLL has run shows me that my DLL has succeeded in adding the path to *HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Sess...
The Windows API provides critical sections in which a waiting thread will spin a limited amount of times before context switching, but only on a multiprocessor system. These are implemented using InitializeCriticalSectionAndSpinCount. (See http://msdn.microsoft.com/en-us/library/ms682530.aspx.) This is efficient when you have a critic...