winapi

Trying to Create a ToolBar with an ImageList, not working.

I am trying to get my toolbar to work with an ImageList. The images are individual PNGs, so I was adding them in the ImageList in succession, Bbt it wasn't working. Here is the code to add the Image to the ImageList: HIMAGELIST CreateToolBarImages(HINSTANCE hInst) { HIMAGELIST v_ImageList = NULL; // IMAGE_LIST v_Img; HICON h...

How to localize win32 dialogs?

I am working on Win32 dialogs with various controls like Static Text , Checkbox etc and all the strings need to be localized for different languages. I have designed the dialogs for US intl . But when I put localized strings those, not fitting properly and I have to change layout for each intl. Is there a better way to do this? Can I c...

Creating a MiniDump of a running process

Im trying to make a tool for my end users that can create a MiniDump of my application if it hangs (i.e. external to the app). Im using the same code as the internal MiniDumper but with the handle and processid of the app but i keep getting error code 0xD0000024 when calling MiniDumpWriteDump. Any ideas? void produceDump( const char* ex...

gethostbyname replacement for IPv6 addresses

Hi, I have a program that uses gethostbyname (in Windows) in order to convert IP address to hostname. But, it works only for IPv4... What is the correct replacement for IPv6? Thanks. ...

How to set Win32 window as owner of WPF window?

I want to use WPF windows in a legacy win32 application. I'd like to behave them in a similar way, like the WPF window always being displayed on top of the win32 window. For this I'd like to set the owner of the WPF window to the win32 windows, but I got no idea how to achieve this. Any help here? Since the answer is hidden behind so...

How can I retrieve monitor information?

I am trying to retrieve the monitor ID's as shown in the Windows display properties (#1, 2... etc), but I can't seem to find a way. I have tried using EnumDisplayMonitors as well as EnumDisplayDevices. They both return something like "\.\DISPLAY1". However, this number doesn't always match the number shown by Windows, especially when 2 v...

Capturing window image in windows server 2008

I am capturing output of windows program using following function: public static Bitmap Get(IntPtr hWnd, int X1, int Y1, int width, int height) { WINDOWINFO winInfo = new WINDOWINFO(); bool ret = GetWindowInfo(hWnd, ref winInfo); if (!ret) { return null; } int curheight = height; if (curheight <= 0 |...

Fullscreen Window in Windows - Remove Border?

Many Windows applications (games, web browsers, some editors, etc.) support fullscreen mode, in which the application's client area covers the entire screen. As a Win32 developer, I have always implemented full-screen by removing the window's frames and title bar, and setting the window's position to (top, left, width, height) = (0, 0...

Localizing Task Links for a Control Panel Item on Windows Vista

I'm having a problem localizing the Task Links for a Control Panel applet on Windows Vista (http://msdn.microsoft.com/en-us/library/cc144188(v=VS.85).aspx#localizing_links). This is the part of my XML file where I define the task: <sh:task id="{3DC35DFB-B037-4148-B351-7959EE034D92}"> <sh:name>@MyApplet.cpl,-101</sh:name> <sh:keywor...

How to Disable the Move System Menu Item?

In Microsoft Windows, this works: mnu := GetSystemMenu(h, false); EnableMenuItem(mnu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED); But this does not work: mnu := GetSystemMenu(h, false); EnableMenuItem(mnu, SC_MOVE, MF_BYCOMMAND or MF_GRAYED); Hence I know how to disable the "Close" system menu item of a window, but not the "Move" ite...

Using the Proxy pattern with C++ iterators

Hello everyone :) I've got a moderately complex iterator written which wraps the FindXFile apis on Win32. (See previous question) In order to avoid the overhead of constructing an object that essentially duplicates the work of the WIN32_FIND_DATAW structure, I have a proxy object which simply acts as a sort of const reference to the sin...

When binding a client TCP socket to a specific local port with Winsock, SO_REUSEADDR does not have any effect

I'm binding a client TCP socket to a specific local port. To handle the situation where the socket remains in TIME_WAIT state for some time, I use setsockopt() with SO_REUSEADDR on a socket. It works on Linux, but does not work on Windows, I get WSAEADDRINUSE on connect() call when the previous connection is still in TIME_WAIT. MSDN is...

Windows API GUI programming

Hi! I'm working on a Project with outdated, very old looking GUI (the used GUI framework is more than 10 years old) Since the used programming language is Eiffel, there are almost no good libraries for GUI development. Although Wrappers for C libraries exist, it's not that easy to wrap something like Qt with them. The current GUI frame...

Any way to make dialogs appear/disappear with a transition in MFC?

For instance I have a main dialog, when I click a button a smaller dialog appears next to it. But it would be neat if the small one could somehow transition in, rather than simply appear. For instance using transparency, or zooming in, or sliding in from width=0 -> full-width. Making an actual dialog do such things isn't too hard, but w...

Any Win32 APIs to get the screenshots?

Hi all, I am writing an app, which needs to take the screen shots automatically (just like pressing PrintScreen button). So please suggest me how to get this done. A raw 24 bit BMP image would suffice. PLEASE NOTE: My app is in C, so any win32 APIs that can be called from my code is what I am looking for. (Sometimes back I had got an e...

Windows equivalent of inb(), outb(), low level i/o

I have some Linux code that monitors our hardware by collecting temperatures, voltages, and fan speeds, from the motherboard using inb(), outb(), inl(), etc. low level i/o functions. My challenge is to port that code over to run under Windows as a simple console app. But am puzzled in what functions Win32 (or .NET) provide that allow m...

Cannot change the height of a combo box in the VS Dialog Editor

Any combo box I create seems to be stuck at 12 dialog units in height. Microsoft's guidelines for spacing and sizing of controls in dialog boxes state that a combo box should be 14 dialog units high. I have even tried editing the resource file in notepad and recompiling in Visual Studio without opening the resource editor - but the com...

How can I effectively test against the Windows API?

I'm still having issues justifying TDD to myself. As I have mentioned in other questions, 90% of the code I write does absolutely nothing but Call some Windows API functions and Print out the data returned from said functions. The time spent coming up with the fake data that the code needs to process under TDD is incredible -- I lite...

Enumerating File Handles in C#

I would like to know whether it is possible to enumerate file handles in c#, maybe using Win32API. This is easily done for window and process handles, but it seems that it is not possible for file handles. While some functionality is offered by NtQuerySystemInformation, this is being phased out and therefore it is not recommended to us...

GetVersionEx Not Working on Windows 7?!

On my Windows 7 system, the GetVersionEx Windows API function returns "6.0", indicating Windows Vista, when it should return "6.1". If it matters, I used the following Delphi code: function winver: string; var ver: TOSVersionInfo; begin ver.dwOSVersionInfoSize := SizeOf(ver); if GetVersionEx(ver) then with ver do result...