winapi

Under what legitimate circumstances might GetVersionEx produce dwMajorVersion == 7 when running under Windows XP?

When GetVersionEx returns successfully on Windows XP, the dwMajorVersion field of the structure it produces is supposed to have the value 5. Under what legitimate circumstances -- running under Windows XP -- might it have the value 7? ...

Getting the dimensions of the bounding rectangle of the specified Windows XP window in screen coordinates in MATLAB

I'm trying to write a MATLAB function to find the position in screen coordinates of an arbitrary window (not just a MATLAB window). The code only needs to work in the current version of MATLAB and on Windows XP. I know I could write a MEX-file or shell out to another program, but I want to do this all with MATLAB code. It should be po...

CreateProcess(...) does not invoke OnLoad event

Hi folks, I am currently working on a C++ programm which calls another C# programm I have code-level access to. However when I call the program using CreateProcess(0, temp2, 0, 0, false, 0, 0, 0, &si, &pi) where temp2 contains the executable including command line parameters the C# program starts but the OnLoad event of the MDIForm (= m...

Mac style menus on Windows, system wide

I'm a Mac user and a Windows user (and once upon a time I used to be an Amiga user). I much prefer the menu-bar-at-the-top-of-the-screen approach that Mac (and Amiga) take (/took), and I'd like to write something for Windows that can provide this functionality (and work with existing applications). I know this is a little ambitious, esp...

Calling Win32 API method from Java

I need to call some methods in Wininet.dll from a Java program. I can find plenty of tutorials on how to call a new DLL that I create from Java, but I can't seem to find any tutorials on how to call an already existing DLL from Java. I know this involves JNI, but how, exactly, do I do this? Do I need to call javah on Wininet.h? Where...

Perl - access user32.dll using Win32::OLE on 64-bit windows

I am using Perl 64-bit on 64-bit windows. Win32::API does not compile on 64-bit windows and I want to use user32.dll on a 64-bit Windows. Is there any way to use user32.dll using Win32::OLE or something similar? ...

Custom control box button

Some Windows applications add buttons to the control box, which apparently is the name for the group of minimize, maximize, and close buttons. One such application is Skype, which has a button for switching from a one-window-that-contains-everything mode to a one-window-per-conversation mode and vice versa: I'd like to know how you ca...

Displaying a pop-up notification window

How do you create a window that pops up from system tray notification area vertically upwards and displays a message? for example - In MSN, it displays it when someone gets online/offline. ...

multithreaded using _beginthreadex passing parameters

Hello, Visual Studio C++ 2008 I am using threads. However, I have this warnings and not sure what I am doing wrong. 1. unsigned int (__stdcall *)(void *) differs in levels of indirection from 'void *(__stdcall *)(void *)' 2. _beginthreadex different types for formal and actual parameters 3 /* Function prototype */ void* WINAPI get_in...

How to get the cursor position

Hello, I want to know how to get the cursor position on Windows in c++, Reasons: I try to move the mouse position on X Y coordinate with the screen information e.g: i want to set the mouse position in the offset x:576 y:854 on the screen. The only method that I found for do that is: mouse_event(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE|...

vertical text won't be bold in win32 GDI c++

I'm trying to draw vertical text in win32 GDI api. I call CreateFont() with 2700 for the angle and 900 for bold. logPxlY = ::GetDeviceCaps (c->_hdc, LOGPIXELSY); _hfont = ::CreateFont (-::MulDiv (point, logPxlY, 72), 0, angle, weight, 0, FALSE, FALSE, FALSE, 0, 0, 0, 0, FIXED_PITCH | FF_MODERN, face); where face is "Courier Ne...

Using TAP-Win32

Hello. I need to port an application (well - library) which uses TAP-Win32 as network interface. Unfortunately library is suppose to be on BSD3 license so I cannot use 'examples' from qemu or openvpn due to licensing issues. PS. As library will not be in C I'm more interested in HL approach like 'get list of keys from registry' rather ...

How to get the Executable name of a window

Hi, I try to get the name of executable name of all of my launched windows and my problem is that: I use the method UINT GetWindowModuleFileName( HWND hwnd, LPTSTR lpszFileName, UINT cchFileNameMax); And I don't understand why it doesn't work. Data which I have about a window are: -HWND AND PROCESSID The error is: e.g: HWND...

Using named pipe to communicate between unicode and non-unicode processes on windows.

If a process with unicode enabled creates a named pipe, it must pass a LPCTSTR for the pipe name, in this case a LPCWSTR. Will a second process wihtout unicode be able to open that pipe by passing a LPCSTR for the pipe name? Also, can I call CreateNamedPipeW or CreateNamedPipeA and ignore whether unicode is enabled, or do I have to call...

How can I shut down Windows?

How can I in a Delphi application (7, trying to port it to 2010) force the system (XP or 7) to shut down? ...

c++ use of winmain()

Hi, I just started learning programming for windows in c++. I had this crazy image, that win32 programming is based on calling windows functions and sending parameters to and from them. Like, when you want to create window, you call some win32 function that handles windows GUI and say "Hi, please, create me new window, 100 x 100 px, with...

Writing to the middle of the file (without overwriting data)

In windows is it possible through an API to write to the middle of a file without overwriting any data and without having to rewrite everything after that? If it's possible then I believe it will obviously fragment the file; how many times can I do it before it becomes a serious problem? If it's not possible what approach/workaround is...

Window deactivation message?

What is the opposite of WM_ACTIVATE (Window deactivation message)? ...

Removing Window border?

I have a window with a solid border around it. How can I remove the border(all of the non-client area) by using SetWindowLong and GetWindowLong? ...

Has anyone used the Win32 API function CredWrite in .NET?

I'm trying to use CredWrite, but get an ERROR_INVALID_PARAMETER 87 (0x57) error. The intent is to have a secure place to save the user's password for my .net WPF application. And my code: public class CredMan { private const string TARGET_PREFIX = "myappname:"; public static void SavePassword(string username, string password)...