winapi

How may a Window be "pinned" to the desktop surface?

This question is more academic than practical and doesn't involve any one specific language. For the sake of discussion, we'll use Win32 API. What is the most appropriate way to create a window with the following behavior goals: Z-Order is lower than every other window except the desktop surface. Cannot be made to appear on a higher ...

winapi with 64bit number in masm32

Hi! I need determind size of a logical volume and print it. GetDiskFreeSpaceEx is returning size as 64bit number(?). What can i do with it? ...

Closing a secondary delphi form causes the main form to lose focus

When showing a secondary form from the main form and from the second form showing a third form and then closing both forms will cause the main form to lose focus. Using Delphi 2009 with XP SP3 Here are my steps for reproducing the problem: Create a new VCL forms applications Drag a button onto the created form In the click handler cr...

How can I use Perl to start a Win32 program and redirect its output to stdout?

I have a cross-platform Perl program that starts a win32 windows program on win, and a macosx appliaction on the mac. I use system(), which on the mac makes the stdout of the invoked program, be written in the stdout of the Perl program, which is what i want. On Windows, it seems like there is no way to get the stdout a Windows program...

EnumDisplaySettings reports wrong values on Win7 with Nvidia cards

I've been encountering a problem when trying to query all available resolutions on some nvidia cards under Win7. for(int i = 0; EnumDisplaySettings( deviceName.c_str(), i, &dm) != 0; ++i) reports resolution which aren't available like 866 x 650. Most supported resolutions on the other hand are missing. Changing driver/monitor setup di...

All users path?

In C# I can do the following: DirectoryInfo di = new DirectoryInfo(System.Environment.GetEnvironmentVariable("ALLUSERSPROFILE")); Which will get me the path to the all users profile. In C++ I can use the SHGetFolderPath, but it does not seem to have a CSLID for all users. Is there an equlivant function that I can blow the %ALLUSERSPR...

Why not call FreeLibrary from entry point function?

I'm writing a DLL that needs to call a separated DLL dynamically multiple times. I would like to keep the callee loaded and then just unload it when my DLL is unloaded. But according to Microsoft, that's a bad idea. The entry point function should only perform simple initialization tasks and should not call any other DLL loadin...

Wrapping a PropertySheet; how to handle callbacks?

I'm writing an (unmanaged) C++ class to wrap the Windows PropertySheet. Essentially, something like this: class PropSheet { PROPSHEETHEADER d_header; public: PropSheet(/* parameters */); INT_PTR show(); private: static int CALLBACK *propSheetProc(HWND hwnd, UINT msg, LPARAM lParam); }; The constructor just i...

GetOpenFilename api call in Windows 7 won't allow direct access to My Documents

In many of my Access (2002) programs I use the GetOpenFileNameA and GetSaveFileNameA functions from comdlg32.dll. I often set the initial directory to the user's My Documents folder (using calls to SHGetSpecialFolderLocation and SHGetPathFromIDListA from shell32). This all works fine under Windows XP. However, I recently switched to W...

How to call win32 CreateMutex from .Net

Hello, I've been successfully creating a .net mutex like this: SingleIns = new Mutex(true, AppName); for a while. It works in XP, Vista, but apparently not in Windows7. So I need to make an interop call to a Win32 library so other Com components can identify the mutex. I found the following code, but the Win32Calls. is not found... is...

RichEdit / RichTextBox scollbar length, grab handle width, enabled/disabled, etc... How is all this controlled?

I have another question open regarding an error I'm experiencing with the horizontal scrollbar of a RichTextBox not functioning properly and am not getting much response. It came to me that I might be asking the wrong question. My new question is how do the scrollbar properties get set/controlled. I know I can SendMessage to change the...

Is there any way to draw a PNG image on window without using MFC?

I am developing a Windows API application without using MFC. I am using standard Windows libraries. How do I draw a PNG image in a window? Help me with some sample code. I have tried some codes which are available on the Internet, but all are using MFC. ...

Win7: Monitor DC of secondary Monitor gets offset if disabling Aero

Scenario: Screen capturing on multi display machines. Capture screen of secondary monitor [which is the only affected] Turn off Aero: DwmEnableComposition(DWM\_EC_DISABLECOMPOSITION) Create a [new] DC for the secondary monitor via: m_DC->CreateDC(_T("DISPLAY"), _T("\\.\DISPALY2", NULL, NULL); Result: The DC will get an offset w...

Finding WndProc Address

How can I find the address of a WndProc (of a window of another process). Even if I inject a DLL and try to find it with either GetClassInfoEx() or GetWindowLong() or GetWindowLongPtr() I always get values like 0xffff08ed, which is definitely not an executable address. It is according to MSDN: "... the address of the window procedure, or...

How do I prevent my Win32 process starting on WOW64?

I've got a Win32 process that is compiled and packaged in both 32-bit (x86) and 64-bit (x64) variants. I'd like the x86 variant to refuse to run on a 64-bit version of Windows (i.e. WOW64). Is there any way to do this by setting linker flags? If not, what do I need to do? ...

IFileOpenDialog and IFileSaveDialog from VBA

How do you call IFileOpenDialog and IFileSaveDialog from VBA? According to Microsoft, applications written for Windows 7 and later should use IFileOpenDialog/IFileSaveDialog API calls instead of GetOpenFileName/GetSaveFileName (see Using the Common File Dialog). This is especially important for full Library support. ...

Closing a modal popup from vb.net?

Hi, I want to wait for and close a modal form (a popup) from another application, as soon as it appears. I want to do this from VB.NET, but suggestions in C# should be easily translateable. I can hard-code the modal popup's caption in my app, since it's long and unique. What I want to do is simulate either the user clicking on the close...

Why does this program *NEED* MsgBox?

Long story short: I'm trying to write an app that'll dump IE's history to a text file. Because I am lazy, I went searching for a preexisting library and found this beautiful project to build from: http://www.freevbcode.com/ShowCode.asp?ID=6702. Only, I'm stuck... I finally got the program to dump the history, but it ONLY WORKS if I pu...

Flip-3D on WinXP and taking layered screenshot

Hello guys, I have two questions but somehow related: How to implement flip 3d without Aero APIs on Windows XP? Have you guys seen this awesome app on Mac? http://layersapp.com Is there any possibility to have something similar on Windows? If the #1 question is solved I think we can make something like that I know how to take a scree...

Does the caller need to Release the IShellBrowser* obtained via the undocumented WM_GETISHELLBROWSER (WM_USER+7) message?

Several have pointed out that there exists an undocumented message that retrieves the IShellBrowser interface pointer from the common dialog HWND for the file open & save dialogs. But there is conflicting information (or no information) on whether that pointer is AddRef'd, or if it is just the raw address returned, and no Release() shou...