winapi

How to create a ellipse shaped window with VC++ using win32 API

I am creating a window program using VC++ through win32 API. I wanted to create a ellipse shaped window how this can be achived. ...

How can I detect the installed Sun JRE on Windows?

I tried googling the answer, but all I found was tips on how to detect Java from a browser or the very generic way of just starting Java and see if it runs, which introduces a possibly long delay in my application. (~ two seconds when started the very first time on my machine) I hope there is a faster way, if the following restrictions ...

Transparency to text in GDI

Hi , i have created a Bitmap using GDI+.I am drawing text on to that bitmap using GDI Drawtext.Using Drawtext i am unable to apply tranparency. Any help or code will be appreciated. ...

How to tell if a file has no associated icon

I am using the SHGetFileInfo api to get a handle to and display the icon associated with a particular file. If the file has no icon associated with it Windows will return you the default one that it uses in explorer for unknown file types. In this case I don't want to display the icon. How can I tell if the file has no associated icon...

C#/WINAPI: SetWindowPos()

Hi, I am using SetWindowPos() to try and send Windows to back/front of the z-order. It seems to work for the most part however I am noticing for certain windows it just won't work although the function will return success. For example Window Task Manager seems to work perfectly fine but the other windows aren't responding properly to th...

Does SHGetPathFromIDList() (and similar) put a terminating 0 in its argument?

This is actually a question about a huge number of winapi functions. A typical MS documentation says (from http://msdn.microsoft.com/en-us/library/bb762194%28VS.85%29.aspx ): BOOL SHGetPathFromIDList( PCIDLIST_ABSOLUTE pidl, LPTSTR pszPath ); pidl [in] The address of an item identifier list that specifies a file or direc...

Checking if a registry key exists

I am looking for a clean way to check if a registry key exists. I had assumed that RegOpenKey would fail if I tried to open a key that didn't exist, but it doesn't. I could use string processing to find and open the parent key of the one I'm looking for, and then enumerating the subkeys of that key to find out if the one I'm interested ...

How do I open a directory with CreateFile in C# to examine deleted entries?

How do I open a directory with CreateFile in C# to examine entries of deleted files? Or is it now impossible? I remember way back when being able to open a directory on an NTFS partition using CreateFile or possibly CreateFileEx, but that was using C++ under an older OS. So far I've got the Windows API calls (to kernel32.dll) working ...

Calling unexported functions in Win32 C++

How would I go about calling an unexported function in Win32 C++? ...

What is the value of OPEN_EXISTING in the Windows API?

What is the value of OPEN_EXISTING in the Windows API? I'm trying to open directories directly so I can examine the entries for deleted files, and I need to specify that value, but the C# environment doesn't include that under the FileMode enumeration. related question: CreateFile to view a directory ...

How to detect the amount of stack space available to my program?

My Win32 C++ application acts as an RPC server - it has a set of functions for processing requests and RPC runtime creates a separate thread and invokes one of my functions in that thread. In my function I have an std::auto_ptr which is used to control a heap-allocated char[] array of size known at compile time. It accidentially works w...

How can I add controls to Skins in win32 API.

I have created a skin in VC++ through the win32 API. Now I want to add controls to the skins. How can this be achieved? ...

how to prioritize user define messages in a thread?

I have an only one thread (Windows app) which receives windows and user-defined messages. Right now, when user clicks the mouse and keep pressed the application locks. How can I resolve this? I have the restriction of one thread. ...

Why does this window subclassing code crash?

I am trying to subclass the window that currently has focus. I do this by monitoring for HCBT_ACTIVATE events using a CBT hook, and set and unset the WndProc of the focused and previously focused windows. The problem is that it only works whenever I have a breakpoint set somewhere in the code. If there is no breakpoint, once my applic...

Network logon from an impersonation token

In a service impersonating a client (using ImpersonateNamedPipeClient), I try to call CreateProcessAsUser. The executable filename is a UNC path located on a third computer (neither the server, nor the client connected to the pipe). The call fail with the error code 5 (ACCES DENIED). I tried to use WNetAddConnection2 to authenticate the...

Python change screen resolution virtual machine

In virtualbox, the screen resolution can be anything - even something strange like 993x451, etc. I tried changing it using pywin32 but I failed:: >>> dm = win32api.EnumDisplaySettings(None, 0) >>> dm.PelsHeight = 451 >>> dm.PelsWidth = 950 >>> win32api.ChangeDisplaySettings(dm, 0) -2L which ends up being: DISP_CHANGE_BADMODE any he...

PostQuitMessage() Wont close my app???

Im trying to write hello world in win32 but when i close the main window, the app continues to run My window procedure: LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch (msg) { case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hWnd, msg, wparam, l...

How can i draw a window content into a bitmap (using Win32 C++)

I need this for some animation effects and i remember there is a window message for doing this. Something like WM_PAINT but it deliveres a device context with the message. But i can't find it anymore on MSDN. ...

how to unlock or log in windows by app itself

As we all know,we can use such api as "LockWorkStation()" in "user32.dll" to lock windows. But how to unlock it? For example, if i run an app at first, I want the app to unlock windows by itself after 30 second. How to do it? In another word, if auto-logging in, windows will read the username and password from regedit and then use an a...

Subclassing a window with a functor (Win32)

Quick sanity check: Is it possible to subclass a window using a functor? I'm running into a situation where I want to have some data available in the win proc, but GWLP_USERDATA is already being used. A functor seems like a good alternative, but I'm having trouble getting it to work. Here's the basics: class MyWinProc { // Win Proc Fun...