winapi

Blocking queue for thread producer/consumers for win32/C

I'm trying to replace some thread communication with a custom queue, producer is currently using PostThreadMessage, consumer is using WaitForSingleObject/PeekMessage. http://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html would be what I needed, but boost nor C++ is not an optio...

How to execute some code everytime an application window (other processes) is opening?

I am trying to track visible windows from all currently running processes. My program interacts with these windows and the faster it can detect them the better. My goal is to move visible windows to a certain location on screen before they even draw in the default position if that is possible. If not I want to move them as quickly as p...

Why could DwmRegisterThumbnail fail?

I am trying to capture screen of a child window and render it on parent surface in Windows 7. HTHUMBNAIL thumbnail = NULL; HRESULT hr = S_OK; hr = DwmRegisterThumbnail( hWnd, visualHwnd, &thumbnail ); if( SUCCEEDED( hr ) ) { ... } This fails all the time. visualHwnd is the child window and hWnd is the parent. I also tried it with...

Downloading a File Protected by NTLM/SSPI Without Prompting For Credentials Using Python on Win32?

The title says it all, even if it is a mouthful! I need to download a file on a corporate Sharepoint site using CPython. Existing codebase prevents me from using Ironpython without porting the code, so .NET's WebClient library is out. I also want to download the file without prompting the user to save and without prompting the user for ...

Are there open source Common Lisp COM wrappers?

I have an application that is written in SBCL and is deployed as an executable on Windows. The need has arisen for it to interact with Excel via COM and another application via DDE (I know, I know). DDE is simple enough for me to have quickly wrapped what I needed in a very small, simple to maintain C library. COM, on the other hand, se...

How does GetProcAddress work

I've done some googling but haven't really found much. How does GetProcAddress work? What goes on behind the scenes? Do the method names and their corresponding address get stored in meta data somewhere? ...

Setting Registry key write permissions using .NET

I'm trying to grant Write access to my application's registry settings to everyone or all users of a machine during the install process. My application does not have the appropriate permissions directly after install without requiring an administrator to grant them even though the keys and values exists, they cannot be updated? I've ...

WinInet C++ ftp template?

Starting from scratch, would like to create an ftp application using WinInet. Looking for a real basic example in C++ that will compile and get me started. Thanks. ...

Could 16bit .com executables call win32 APIs?

Any minimal example of 16bit .com display a window GUI using Win32 API on Windows? ...

FilgraphManagerClass taking up lots of memory resource

I'm using FilgraphManagerClass, which is contained in this dll : QuartzTypeLib.dll. it's using up a lot of memory resource and CPU. How do I clean it up and make it eat up less resources ? or how do I dispose of it after using it ? ...

How to get the Monitor Screen Resolution from an hWnd?

How to get the Monitor Screen Resolution from an hWnd? I am using an hWnd because the window could be located on any one of multiple monitors. i.e. the hWnd top/left coordinate is on a Monitor that has a Screen Resolution of 800 x 600. I program in a language called PL/B and it allows calling Windows API. What Window APIs can be used...

How do I wrap CFtpFileFind example, in C++?

Trying to wrap this short example in C++. (and its been a while since I did this). int main(int argc, char* argv[]) { //Objects CFtpConnection* pConnect = NULL; //A pointer to a CFtpConnection object ftpClient UploadExe; //ftpClient object pConnect = UploadExe.Connect(); UploadExe.GetFiles(pConnect); ...

How do I set the 'always on top' flag/setting on a window that is external to my application?

Is there a managed way to set the always on top flag/setting on a window that is external to my application or will I need to P/Invoke a native function? And if P/Invoke is the only way what is the function call required and from which dll? ...

Create a "virtual" file and execute it

Hello everyone! My google search has led me to here: http://stackoverflow.com/questions/2080892/how-to-create-a-virtual-file In that article, people suggested the author to extract the file to a temp directory and work with it from there. Actually, what I would like to do, is something similar to what the author was originally asking -...

What is a robust method for capturing screen of child window in Windows 7?

Pardon my frustration. I've asked about this in many places and I seriously don't think that there wouldn't be a way in Windows 7 SDK to accomplish this. All I want, is to capture part of a 'child window' ( setParent() ) created by a parent. I used to do this with bitblt() but the catch is that the child window can be any type of applic...

How do I get specific error information from GetFile()?

void GetFtpFile(LPCTSTR pszServerName, LPCTSTR pszRemoteFile, LPCTSTR pszLocalFile) { CInternetSession session(_T("My FTP Session")); CFtpConnection* pConn = NULL; pConn = session.GetFtpConnection(pszServerName); //get the file if (!pConn->GetFile(pszRemoteFile, pszLocalFile)) { //display an error } delete ...

Why is FormatMessage() failing to find a message for WinINet errors?

I'm running this to test FormatMessage: LPVOID lpMsgBuf; errCode=12163; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM , 0, errCode, 0, (LPTSTR) &lpMsgBuf, 0, NULL ); However, when it returns lpMsgBuf contains NULL... I was expecting something like ERROR_INTERNET_DISCONNECTED....

How do I render the scrollable regions of a canvas with IViewObject::Draw?

Hi, I've been trying to render the entire canvas in an IWebBrowser2 control to a bitmap. IViewObject::Draw seems to be the most promising approach, but I can't get it to render anything that would requires a scroll to show. While I could automate the scrolling and stitch the images together, this would look weird with any fixed positi...

Application wide periodic tasks with Dialog Based MFC application

In Single Document Interface (SDI) or Multiple Document Interface (MDI) MFC application, I created an application wide timer in the View. The timer will tick as long as the application is running and trigger some periodic actions. How can I do the same with Dialog Based MFC application? Should I create Thread's Timer (SetTimer with NU...

SendInput after EnableWindow in Windows 7

I have a child window that is maximized within a parent. It needs to be disabled so that it doesn't receive inputs until I press a key. When I press key 'A' for instance, I want the child window to be enabled, receive inputs sent with SendInput() and disable again. So I do this: EnableWindow( hwnd, TRUE ); SetForegroundWindow( hwnd); ...