winapi

How to autodetect urls in RichEdit 2.0?

When we have a RichEdit control and send it an EM_AUTOURLDETECT message with WPARAM set to TRUE, it nicely hightlights the detected URLs and sends the EN_LINK notifications. But it does this only for text that is entered into the control. I haven't found the way to do it for text that's loaded into the control with SetWindowText or EM_ST...

C++, win32, gdi Printing: DrawEdge does not reach as far as DrawText?

I am trying to print (using a printer, on paper, not on a screen) lines and text, using the the function DrawEdge and DrawText (http://msdn.microsoft.com/en-us/library/ms534882.aspx and http://msdn.microsoft.com/en-us/library/ms533909.aspx). They work quite fine, however, when I try to reach the bottom of my paper (about 35 milimeter awa...

How do I use GetThemeFont to read font data?

I am trying to use GetThemeFont to read the font data from a visual style, but I can't seem to get it to return anything. Here is how I'm using it: IntPtr h = OpenThemeData(this.Handle, "Button"); LOGFONT font = new LOGFONT(); int r = GetThemeFont(h, IntPtr.Zero, 1, 1, 210, out font); CloseThemeData(h); The return value is always "-21...

How to change the name of a thread

I have a server application that uses "a lot" of threads. Without wanting to get into an argument about how many threads it really should be using, it would be nice to be able to see some descriptive text in the debugger "threads" window describing what each one is, without having to click through to it and determine from the context wha...

WPF equivalent of Application.AddMessageFilter (Windows Forms)

Hello. I was using Application.AddMessageFilter() in my WinForms applications (when working with unmanaged code). Now I'm switching to WPF and can't find this functionality. Please advice where it can be found or implemented. Thank you. ...

How to get size and position of window caption buttons (minimise, restore, close)

Is there an API call to determine the size and position of window caption buttons? I'm trying to draw vista-style caption buttons onto an owner drawn window. I'm dealing with c/c++/mfc. Edit: Does anyone have a code example to draw the close button? ...

Get active window text (and send more text to it)

I'm creating a small utility in C#, that will add some text to an active textbox when a global hotkey is pressed, it's a type of auto complete function. I have my global hotkey working, but now I don't know how to get the current text in the active textbox (if the active window is a textbox that is.) What I've tried so far is to use a. ...

How to filter windows messages from a managed DLL

How can I get UI framework independent (WinForms, WPF, other frameworks) way to filter windows messages? Thank you. ...

How to find if native dll is compiled as x64 or x86?

Hi I want to if native assembly is complied as x64 or x86 from a managed code application (c#). I think it must somewhere in the PE header since the OS loader needs to know this info but I couldn't find it. I prefer of course to do it in managed code but if it necessary I can use native C++. Thanks in advance for any help. ...

Retrieving graphics/sound card information on Windows

Hello everyone, I'm working on a bug reporting tool for my application, and I'd like to attach hardware information to bug reports to make pinpointing certain problems easier. Does anyone know of any Win32 API functions to query the OS for information on the graphics and sound cards? Thanks, Rob ...

GDI Leak Problem

Hi all, I noticed using task manager that the following code has a GDI leak in it. The count of GDI object in the process executing this code increases by 1 each time it executes however I can't seem to find the problem. Any help would be appreciated. // create new DC based on current HDC hDC = CreateCompatibleDC(GetDC()); // sele...

DBus equivalent for Windows

Anyone know of a Linux/DBus sort of mechanism for Windows? Thanks ...

Vista live thumbnail issue with SetWindowRgn

I know I am probably missing something, but I can't seem to get windows to show the live thumbnail preview correctly when using a window that has a region. When hitting the minimize button the preview will clip to the minimized size (160x25) rather than showing the full preview (like it does with other windows). Few points to make: ...

Best way to create a timer on screen

Hey! I had this idea of creating a count down timer, like 01:02, on the screen (fullsize). One thing is that I really don't have a clue on how to start. I do know basic c/c++, win32 api and a bit of gdi. Anyone have any pointers on how to start this? My program would be like making the computer into a big stopwatch (but with added fe...

How to call an external program with parameters?

I would like to call a windows program within my code with parameters determined within the code itself. I'm not looking to call an outside function or method, but an actual .exe or batch/script file within the WinXP environment. C or C++ would be the preferred language but if this is more easily done in any other language let me know ...

Variable height items in Win32 ListView

Is it possible to have variable size (owner draw) items in the Win32 ListView, if yes, how? ...

How to send mail on windows (other than MAPI)

When viewing the MSDN MAPI documentation page it says the API is now deprecated. If that's the case, what is the suggested API for sending mail these days? http://msdn.microsoft.com/en-us/library/dd296734.aspx Edit: Thanks for all the suggestions, the managed route isn't suitable for me as we're using MFC. ...

MS Outlook CDO/MAPI Blocking Python File Output?

Here is an example of the problem I am running into. I am using the Python Win32 extensions to access an Outlook mailbox and retrieve messages. Below is a script that should write "hello world" to a text file. I need to grab some messages from an Outlook mailbox and I noticed something weird. After I attach to the mailbox once, I can...

How do you check if a user has access rights for a file with the windows api

I am trying to write a simple function for windows that answers the following question. Does user (U) have rights (R) on file (F)? Where,    R is some combination of (GENERIC_READ, GENERIC_WRITE, GENERIC_EXECUTE)    U does not have to be logged in or impersonated The code that I wrote is shown below. The application calls the fir...

How do I create a GUI for a windows application using C++?

I am deciding on how to develop a GUI for a small c++/win32 api project (working Visual Studio C++ 2008). The project will only need a few components to start off the main process so it will be very light weight (just 1 button and a text box pretty much...). My question is this: I don't have experience developing GUIs on windows but I c...