winapi

Caching a bitmap

I'm writing a Win32 application using C++. In this application I'm handling the WM_PAINT message: case WM_PAINT: hdc = BeginPaint(hWnd, &ps); GdiplusStartup(&gdiplusToken, &gdiPlusStartup, 0); DrawM(ps.hdc, hWnd); EndPaint(hWnd, &ps); break; And in the DrawM function I'm having something like this: void DrawMap(HDC hdc, HWND hW...

GDI+ Bitmap Save problem

Bitmap bff(L"1.jpg"); bff.Save(L"2.jpg", &Gdiplus::ImageFormatJPEG, NULL); This creates a new file 2.jpg with zero-bytes length. Isn't it supposed to write an image file that is identical to 1.jpg? Why I'm having zero-bytes length files? I'm doing this test because writing other Bitmaps to files end the same way. ...

detect Windows Explorer copy operation

Is there any way to detect whenever a copy operation starts in Windows Explorer. kind of like in SuperCopier : SuperCopier Website ? and log files involved in the operation ? and such ? I've browsed through Supercopier code and I can't find the part which deals with detecting the copy operation, as I'm not fluid in Delphi. P.S : it s...

Checking if a Socket has closed in C++

I have a small application that redirects the stdout/in of an another app (usually command prompt or bash for windows). The problem is that if the connection is interrupted the my process has no idea and it never closes because of this line: WaitForSingleObject(childProcess.hThread, INFINITE) I was thinking of having a loop with somet...

Keep windows trying to read a file

I'm working in a sort of encapsulation of the windows filesystem. When the user request to open a file, windows calls to my driver to provide the data. In normal operation the driver return the file contents which is cached, However, in some cases the real file is not cached and I need to download it from the network. The question is i...

How can I get the IP address of a network printer given the port name using the Win32 API?

How can I get the IP address of a network printer given the port name, using win32 API? I tried looking into the PRINTER_INFO_* structs, but it seems it is not present there. ...

How to read out the boot order ?

Is there any way to get the boot order programmatically, on Windows ? ...

How can I detect if there is a webcam connected to the PC?

I have the source code for taking a picture via webcam, but I need to know if there's a webcam connected to the PC. If there's no webcam, the program won't call the function for taking photos. If necessary, I need to know which window's Api I have to use in this case. Language: Visual Basic 6 using windows Apis. ...

Which APIs can be used to display different desktop wallpapers on a multi-monitor system?

It seems Windows is unable to display different background images on different monitors on a multi-monitor system out of the box. But I noticed there are quite a few commercial applications available which provide this feature. Which APIs can be (mis-)used to provide this functionality? If there's no special API for this feature, can it...

Hook into the Windows File Copy API from C#

Is there a way to hook into the Windows File Copy API from C#? I'm aware this would require unmanaged code, but a code sample or starter would be helpful. I've already seen the C++ code, but it's all greek. UPDATE: I apologize, I should have been more clear about my intentions. I wish to actually change the copy feature of Windows to...

How to recieve feedback from a Windows MessageBox? (C++)

I know its possible to do something like this with Windows: MessageBox(hWnd, "Yes, No, or Cancel?", "YNCB_YESNOCANCEL); But how do I react to what the user pressed (like closing the window if they clicked "yes")? ...

Is it possible to change a background color of an edit control inside edit?

Hi! I am writing a GUI wrapper for windows api right now ( i can't use qt or mfc ). The library itself is extremely basic. After subclassing windows common controls ( and wrapping them into the classes ) i have faced a problem. As far as i know (and i hope i am wrong), only parent control can handle a message like WM_CTLCOLOREDIT and the...

What is a good, free solution for Richtext editor and convertion to HTML?

Simple situation. I'm trying to write my own blog with a minor twist. Part of the blog will be controlled from a client application instead of a web interface. Basically, I'm still in the design phase and haven't written a single line of code. But I'm trying to combine several techniques into an interesting exercise in software developme...

CryptEncrypt() API

is it normal to get the junk bytes at end of buffer when this function returns? ...

Creating a Windows Forms Control (C++)

trying to run this basic form control example on msdn. At step 1 of the portion "To add a custom property to a control" we place the ClickAnywhere code in the public section of the class. First error: "error C2144: syntax error : 'bool' should be preceded by ';'" Is this syntax correct in C++? (see below) (removing the ClickAny...

COMException when using Windows API Code Pack

I downloaded Windows® API Code Pack for Microsoft® .NET Framework from http://code.msdn.microsoft.com/WindowsAPICodePack/Release/ProjectReleases.aspx?ReleaseId=3077 ERROR On testing the solution on VS 2008,I get error in line IKnownFolderManager knownFolderManager = (IKnownFolderManager)new KnownFolderManagerClass(); knownFolderMan...

develop an application similar to windows explorer

Is it possible to use windows api and c# to develop an application similar to windows explorer [treeview,listview]. ImageList imageList = new ImageList(); if (folder != null && System.IO.Directory.Exists(folder)) { try { string[] arrImageName...

Can't read global mutex created with Createmutex

I created a mutex in one app; the code is: HANDLE global_mutex = CreateMutex(NULL, FALSE, "mcdonalds"); if(global_mutex) { wxLogMessage("created successfully."); } else { wxLogFatalError("Unable to create the mutex"); } then I read it from my other program Public Declare Function GetLastError Lib "kernel32" () As Long Public...

ImageList and BltBit - ting

Hi I am having trouble in CE BltBit from a previously created compatable hdc to device's hdc. The following code works: hdc = pdis->hDC; FillRect(hdc, &(pdis->rcItem), (HBRUSH)GetStockObject(BLACK_BRUSH)); ImageList_Draw(himl, imageIndex, hdc, 15 , 30, ILD_NORMAL); However the following just draws the black rectangle and does n...

Cross platform COM development ...

COM as we know is language and platform independent standard, but all the time I see only articles on developing COM components on Windows. Could you share your thoughts on how to develop a true cross-platform application. ...