winapi

App started by logged off XP user can seen on desktop of a different user

This is a coding question. Please read it before you flag it as belonging on ServerFault as the last one I wrote got thrown over there in less than 5 minutes. I'm testing my win32/c++ application on XP which has the latest service packs. It contains two administrative user accounts both without passwords. I log in as User1 and start my ...

Is there a way to preserve the BITMAPFILEHEADER when loading a Bitmap as a Windows resource?

I've been working on testing a few things out using SFML 1.4 (Simple and Fast Multimedia Library) with C++ and Visual C++ 2008 Express Edition. To avoid having external images with my graphical programs, I was testing out the sf::Image::LoadFromMemory(const char * Data, std::size_t SizeInBytes) function with Bitmap resources loaded usin...

Need a way to change a remote user password - NetUserChangePassword fails with 2245

I am trying to call NetUserChangePassword to change the passwords on a remote computer. I am able to change the password when I log-in to the machine, but I can't do it via code. The return value is 2245 which equates to the Password Being too short. I read this link: http://support.microsoft.com/default.aspx?scid=kb;en-us;131226 but ...

How to properly use WSAAsyncSelect?

Hello, I've asked here a ton of questions about WSAAsyncSelect and NET.Few months ago I even spent 500 rep on a bounty and answered it myself(I made a wrapper).In the end I got used to the winsock in the framework. Today I'm asking about unmanaged languages,the bad point is that I miss the framework way of doing things with sockets.I'm...

Export contents of a listbox to a textfile

How can the Windows API be accessed in order to find a ListBox control in an application and export its contents to a text-file or an excel file. Are there any applications (of the type of Spy++) that can accomplish such task? ...

WriteProcessMemory to SYSTEM process with SeDebugPrivilege enabled. (C, Vista)

Hi, I'm interested in injecting DLLs into SYSTEM owned processes on my Vista machine. I'm going about this using the traditional method of VirtualAllocEx, WriteProcessMemory and CreateRemoteThread. However, because this will be operating on SYSTEM processes, I enable SeDebugPivilege on the injecting process before opening the target pro...

Getting a key (secret) for a HMAC-MD5 hash

I am looking at the NetUserSetInfo method. It can take a USER_INFO_21 structure that allows me to pass in a "one-way encrypted LAN Manager 2.x-compatible password". I think this means a HMAC-MD5 hash. The class System.Security.Cryptography.HMACMD5 can create one of these hashes, but it needs a key (or shared secret) for that class to ...

CreateProcess doesn't pass command line arguments

Hello I have the following code but it isn't working as expected, can't figure out what the problem is. Basically, I'm executing a process (a .NET process) and passing it command line arguments, it is executed successfully by CreateProcess() but CreateProcess() isn't passing the command line arguments What am I doing wrong here?? int ...

Windows message loop

Theres some reason for this code not reach the first else? I got it exactly the same from vairous sources. Than I did my own encapsulation. Everything goes fine. Window is created, messages are treated, events are generated to keyborad input in the client area, the gl canvas works fine (when I force it to draw). The only problem is that...

Why does windows let you draw on the whole screen?

I've been playing a big with the DC obtained with CreateDC(L"DISPLAY",NULL,NULL,NULL) and I've been wondering why does windows let you draw on the whole screen that easily, cause I think you could do some pretty evil stuff with that like putting a TIMER at 1ms and drawing a black rectangle on the whole screen every time the timer ticks. ...

Producing a list of all classes in a C++ project

I'm using Visual Studio 2008 (C++) and would like to produce a list of all classes that are defined in that project. Does anyone know tools that extract those easily? A simple 'Find in files' will not be sufficient, of course. Edit: The list of classes should be created automatically and the result should be a simple file of class name...

Mixing Carbon and Cocoa and then what about other platforms?

I have a static library that shares a lot of source between the OS X and Windows versions. Both versions use CMAKE. I have thought about a linux version due to recent requests. OS X and uses Carbon. Windows uses straign win32 API, no MFC is in C++ (.cpp) My questions are: For the OS X version Apple is throwing away 64-bit Carbon, s...

Native API window designer

Why isn't there a designer for native api forms in Visual Studio? Similar to Delphi? If there exist some programs, tools etc, please advice. What is the best approach to design complex windows in pure API? ...

Window Sitters - layered windows colorkeying and clickthrough

I made a window sitter in Visual Basic 6 a few years back, which used layered windows colorkeying to painlessly make the form nonrectangular. I tried to rewrite the window sitter in C# earlier this week, judging that the old code was a mess, and noticed that any clicks within the form's client rectangle were caught by the form, while th...

Change highlight color of selected text in RichEdit

How do I change the color of selected text in a RichEdit control, while the text is being selected? SetSysColor() can do it, but that changes the Highlight-color globally. Setting a CHARFORMAT2 with SCF_SELECTION, and sending a EM_SETCHARFORMAT does change the font and background color. But is only visible once you deselect the same ran...

How to put version information in a multi platform program *nix and win32?

I want to know what is the standard way of doing it. currently I'm thinking in add a series of defines in a header file and inlcudie that file in the main resource file win win32 to update the version resource in win32 and in *nix make some global functions to return this information. and in windows make the msi install file also refle...

How can I run my application in place of the default Windows XP shell?

I was having a discussion with a colleague about whether or not the following is possible: Install an MFC application from a USB drive in Windows XP (this installation would be initiated manually by a user with sufficient privileges to install software). After rebooting, this application should start instead of the default Windows XP s...

How can I get notifications from the clipboard?

Is there a way to be notified when the content of the clipboard changes? I looked a class "Clipboard". It has numerous methods to set the clipboard content but no event. ...

Simple video editing application - should I use WPF or MFC?

I am about to start making a simple little video editing application, and I was trying to decide what system to create the GUI in. I know a lot about the Windows API, and actually, all of my programs thus far have been written in it. I would really like to use the new WPF framework though; however, I am a bit concerned about the fact t...

How can I make only a part of the window transparent? (WIN32)

How can I make for example only a rectangle inside the window have opacity like 50% or something like that and for that part to have the effect of WS_EX_TRANSPARENT so that mouse clicks will go through it? ...