winapi

How to send AT commands

Hi I Want to send AT commands to wireless device for fetching device details.Is it possible on win32 desktop application ? I want some sample application on win32 ,c/c++ so that i will send that commands to that wireless device. ...

Opening a custom file on-demand

I have a custom file type that is implemented in sections with a header at the shows the offset and length of each section within the file. Currently, whenever I want to interact with the file, I must either load and parse the entire thing up front, or else pick only the sections that I need and load just them. What I would like to do ...

What is fadvise/madvise equivalent on windows ?

On UNIX, I can, for example, tell the OS that the mapping will be needed in the future with posix_fadvise(POSIX_FADV_WILLNEED). It will then read-ahead the data if it feels so. How to tell the access intend to Windows ? ...

How do I see if another process is running on windows?

I have a VC++ console app and I need to check to see if another process is running. I don't have the window title, all I have is the executable name. How do I get the process handle / PID for it? Can I enumerate the processes running with this .exe ? ...

Ruby win32 api interface

I need to access a few functions of the win32 library in ruby. I have found extremely sparse information on the Win32API class online, so I'm asking here. I know that you can do something like this: function = Win32API.new('user32','MessageBox',['L', 'P', 'P', 'L'],'I') But I can't seem to be able to call this function with the curre...

Acquire direct write access to window's backbuffer, yet still allow read access to what is on the screen already

I was wondering; is it possible to acquire write access to the graphics card's primary buffer though the windows api, yet still allow read access to what should be there? To clarify, here is what I want: Create a directx device on a window and hide it. Use the stencil buffer to apply an alpha channel to pixels not written to by my code...

Listing serial (COM) ports on Windows?

Hello, I'm looking for a robust way to list the available serial (COM) ports on a Windows machine. There's this post about using WMI, but I would like something less .NET specific - I want to get the list of ports in a Python or a C++ program, without .NET. I currently know of two other approaches: Reading the information in the HARD...

Can anyone recommend a good book or other resource on NTFS semantics?

I'd like to improve my understanding of NTFS semantics; ideally, I'd like some kind of specification document(s). I could (in theory) figure out the basics by experimentation, but there's always the possibility that I'd be ignoring some important variable. For example, I'm having difficulty finding definitive information on the followi...

What conditions need to be fulfilled for a window message to be posted?

I've successfully registered a window class using RegisterClassEx and created a window using CreateWindowEx: m_hInstance = ::GetModuleHandle(NULL); ... m_hWnd = ::CreateWindowEx(0, "CMyClassName", "Message Window", 0, 0, 0, 0, 0, HWND_MESSAGE, 0, m_hInstance, 0); The associated window procedure receives messages 36, 129, 131, and 1, a...

Enumerating threads in Windows

How can I enumerate all of the threads in a process given a HANDLE to the process (or a process ID)? I'm interested in doing this so I can further do an EnumThreadWindows on each thread. ...

Can I access the TLS of a DIFFERENT thread?

Long story short, I'm working on a .NET profiler that at one point gets a notification that a managed thread is running on a certain native kernel thread, which is not the currently executing thread. In this notification, I'm hoping to record a pointer in the TLS of the target thread. Again, that's not the current thread. I'm not seeing...

Windows 7 Device Stage

Can anyone please provide some information on Device Stage for Windows 7 from a developers perspective? That is how a developer needs to develop his software for a device in order to expose it through Windows 7 Device Stage? Please pardon me if I am wrong somewhere... I know very little about Device Stage. Thanks, Sourabh ...

Communication between two DLLs within the same process

I have an application that loads "aaa.dll". "aaa.dll" loads two other dlls "bbb.dll" and "ccc.dll". aaa.dll is a third party dll not written by myself. But bbb.dll and ccc.dll are written by me. Is there any way for bbb.dll and ccc.dll to communicate with each other? Pointing to any resource will be very helpful. Type of communication...

How to read a call stack?

We have a native C++ application running via COM+ on a windows 2003 server. I've recently noticed from the event viewer that its throwing exceptions, specifically the C0000005 exception, which, according to http://blogs.msdn.com/calvin_hsia/archive/2004/06/30/170344.aspx means that the process is trying to write to memory not within its ...

Is there programmatical way to get short day names in windows?

Is there a way to get a 2 character day-name of the week such as MO/TU/WE/TH/FR/SA/SU? Currently I only know of using FormatDateTime(): "ddd" returns "Fri" "dddd" returns "Friday" The main reason is that I want to obtain localized version of the 1 or 2 character day names: Say FRIDAY in "ddd" would return: French Windows = "Vendre...

What may cause DefWindowProc to stop processing messages ?

Hi, I encountered strange behaviour of my application. I would like to close frame window in MDI application, so I send WM_SYSCOMMAND (SC_CLOSE) to that window. After that, I receive OnSysCommand. Then I call CMDIChildWnd::OnSysCommand to proceed processing. The problem is, that sometimes base implementation of OnSysCommand calls OnCl...

Win32 API to do wildcard string match

Hello, I am looking for a wildcard string match API (not regex match). I cannot use anything other than Win32 APIs. ...

Enforcing DLL Dependencies

Background My solution consists of two projects: A standard Windows application A DLL which my application does not use directly, but instead injects it into a target process Basically, from my application's perspective, the only requirement that the DLL must meet is to be present in the working directory of my application. In short...

Embedding a web browser in a C/C++ Win32 App

Hi, I want to build an app that does the following: 1) Take a user-supplied PHP script and pass it to the PHP interpreter to execute it. 2) Take the output, whether it be from memory or a temp file, and pass it to a Web Browser hosted in the app, to show the HTML 3) Handle the http requests I.E. the user's clicks, so instead of making...

Win32 API analog of sending/catching SIGTERM

Under POSIX OS there is signal API that allows to send a signal to process to shut it down with kill and you can catch it with sigaction and do what you need; However, Win32 is not POSIX system, so: How can I handle shutdown events that may come, for example from "End Process" in "Task manager"? What is the standard API for sending sh...