winapi

How to lookup obscure windows message codes?

I'm receiving a windows message with code 1092 (0x444) and I don't know what it is. It's higher than WM_USER but I searched our code base and found no reference so I don't think it's one of ours... does Windows use custom messages above 0x400 and if so how can I look this up? ...

Catching EM_SETCHARFORMAT and modifying the CHARFORMAT data in EN_PROTECTED

I am receiving a EM_CHARFORMAT message in my message handler when SetFont() is called on my custom control. But when I change the data in the CHARFORMAT structure pointed to in the LPARAM, it isn't being used. void CMyRichEdit::OnProtected(NMHDR* pNMHDR, LRESULT* pResult) { ENPROTECTED* pEP = (ENPROTECTED*)pNMHDR; *pResult = 1; ...

How can I make another application's window transparent?

I know how to make my own application transparent using Layered Windows but I want to make a different application transparent (for example notepad). I wrote code like this but it doesn't work with other windows except my app main window: SetWindowLongPtr(WindowFromPoint(p), GWL_EXSTYLE, GetWindowLongPtr(hWnd, GWL_EXST...

Windows Command Line History

I need to programmatically mount a WebDAV volume in Windows using C, and I think I'm going to use system() to achieve this (via the 'net use' command)... However, since net use requires that the password be written in plain text, I just wanted to make sure there's no logging of commands run in the Windows command line shell... I know in ...

Reading a process memory

I'm trying to read the process memory of a console program using ReadProcessMemory() API function. Updated Code: HWND hWnd = FindWindow(NULL, "Read Memory Window"); DWORD ProcessId; ProcessId = GetProcessId(hWnd); GetWindowThreadProcessId(hWnd, &ProcessId); HANDLE hProcess = OpenProcess(PROCESS_VM_READ,FALSE, Proce...

Win32 PlaySound: How to control the volume?

I'm using the Win32 MultiMedia function PlaySound to play a sound from my application. I would like to be able to dynamically adjust the volume of the sound that is being played without modifying the system volume level. The only suggestions I could find for manipulating the volume of sounds played via PlaySound was to use waveOutSetVo...

Image Upload to rackspace cloud files using PHP

I am trying to upload file to rackspace cloud file using the following code: Upload.html <form action="upload.php" enctype="multipart/form-data" method="POST"> File: <input name="upload" type="file" /> <input name="submit" type="submit" value="Upload To Rackspace!" /> </form> Upload.php <?php // include the API requir...

Delphi Drawing Focus

I'm using the following code to make my form entirely transparent so that clicks can go "through" it to other windows. SetWindowPos( handle, HWND_TOPMOST, 0, 0, 0,0, SWP_NOSIZE or SWP_NOMOVE ); SetWindowLong(form1.handle,GWL_EXSTYLE,WS_EX_TOPMOST or WS_EX_LAYERED); SetLayeredWindowAttributes(form1.handle,RGB(0,0,0),2...

Blocking all Windows Internet access from a Win32 app

What would be the simplest way for an application I'm writing to block all Internet access on a Windows machine? More details: Windows: XP or higher Application: A basic Win32 app written in C/C++. Blocking: It needs to be able to block and unblock at will, ideally in a way that the user can't easily reverse. (By, say, right clickin...

How to flash the desktop when I'm receiving an email ?

Hi, I'm developing a email client and I want the screen to flash briefly when I receive a mail. I searched anywhere I could in .NET documentation, but the only way I found to achieve it was to use DirectX functions which is of course impossible : I don't want my users to install DirectX only for a mail client :) Is there a way to do th...

EM_GETLINE fails when Spy++ is running

There is an edit box in some dialog in my application, which is running on Windows XP. When I issue EM_GETLINE on this control, it returns its contents and it's ok, but when I start Spy++ the control suddenly starts behaving incorreclty and always returns an empty string. What might be a problem? ...

What happens when I DllImport a function that is not available on the runtime platform?

I previously asked, How to determine the target of a symbolic link or Reparse Point? ...and got an answer that suggested the use of the Win32 function GetFinalPathNameByHandle, a function first available on Vista. What happens if I build the .NET Assembly and then attempt to run it on WinXP, or WS2003, which does not have the GetFin...

Drag and Drop like Winspector Spy

I was wondering if anybody could give insight on how to implement the window selector in Winspector Spy. Basically, I would want to provide a panel that I could mouse down on, drag over to another processes window (or sub window) and get something like the HWND out of it. Ideally, I would do this in C#, but if it's only possible by wra...

How to deploy a commercial portable application?

Hi, We plan to sell a Windows portable application. By 'portable' I mean that it can be run from any Windows computer without installing it. For example from an USB stick etc. However the application while (theoretically) it can work anywhere, is targeted to LAN environments. What solutions do you see that while keeping this advantage ...

How do I determine if a path is relative or absolute with VB Scripting Host

Hello How do I determine if a path is relative or absolute in Visual Basic Script. In VBA, I'd call the Win32 Api function PathIsRelative Private Declare Function PathIsRelative Lib "shlwapi" _ Alias "PathIsRelativeA" _ (ByVal pszPath As String) As Long However, it's not possible to call into a DLL from VBS, so I cannot use t...

Launch "background" Windows application

On Windows/.NET can you think of a way of somehow launching an existing application in the background so the user can not see it but I can interact with it with regular API calls (clicking buttons and such)? This would come in really useful for "wrapping" old applications that I cannot modify. ...

MoveFileEx with MOVEFILE_DELAY_UNTIL_REBOOT have no effect on Win2008

I'm using the MoveFileEx function of the Windows API on Windows 2008 with the MOVEFILE_DELAY_UNTIL_REBOOT option when trying to move a file: C:\a.txt to C:\b.txt. I can see, when using regedit.exe, that the entries are inserted in the correct registry location (System\CurrentControlSet\Control\Session Manager\AllowProtectedRenames) as pe...

Use DrawText to update label

Hey folks, I am currently writing a program in c++ (no MFC) and want to update a label (win32 static control) using the win32 DrawText function. However when i call the function nothing is written to the label. I use the following code: HDC devCon = ::GetDC(GetDlgItem(IDC_TITLE).m_hWnd); RECT rect = {10, 10, 100, 15}; ::Dra...

Raising or lowering RTS on serial port (C++)

I have a piece of code that can read current state of serial port CTS line, and application then goes into appropriate mode bases on value there. Using null-modem cable described here: http://www.lammertbies.nl/comm/info/RS-232_null_modem.html#full i can detect RTS line on some other port that is connected via that null-modem cable. ...

How to iterate around unresponsive programs in windows?

I am creating an application that monitors a select group of programs and restarts them if required. With this group of programs if something has 'gone wrong' (i.e. they need restarted) the program will appear in task manager as 'not responding'. Is there any way to iterate around non-responding programs in windows using an api? Or al...