winapi

Execute another program in C++

Hey folks, I want to remotely execute another application from my C++ program. So far I played along with the CreateProcess(...) function and it works just fine. The problem however is that I need the full path of the other program but I do not know the directory of it. So what I want is that I just have to enter the name of the other ...

Win32 GUI: dialog in dialog

Hello, I just started to use dialogs and I really like the possibility to define the layout in resource file. But is it possible to set up one dialog and embed it into another (i.e., no floating dialogs)? With plain windows, I created the main window with one child window. Then, I created even more windows (like "edit", "static", ...) ...

How might I obtain an IShellFolder from the active IShellView?

I'm trying to enhance a CFileDialog, and we're using the older version of it (the non-vista one that doesn't use IFileDialog). The older one does allow me to obtain an IShellBrowser, as well as (from that) the active IShellView. What I cannot seem to come up with is a way to get "What IShellFolder does that IShellView refer to?" Equal...

File system support for FindFirstFileEx, limit to directories.

I am using the Windows API function FindFirstFileEx because it provides the capability to return just the sub-directories of a given directory (ignoring files). However when I call this function with the required flag, I still receive both files and directories. The MSDN documentation for the FindExSearchLimitToDirectories flag used b...

GetLastError returning ERROR_SUCCESS after calling ConnectNamedPipe

When I call ConnectNamedPipe with an OVERLAPPED structure and check GetLastError afterwards, I often see GetLastError return ERROR_SUCCESS. The way I'm reading the documentation, that should never happen. My understanding is that if a client has already connected, ERROR_PIPE_CONNECTED should be set, not ERROR_SUCCESS. Has anyone else se...

How to draw vertical text in Windows GUI?

I need to draw a column of vertical text (in Japanese language - it is drawn top-to-bottom instead of left-to-right) in my native C++ Win32 GUI application. I've looked through MSDN and only found how to draw right-to-left text. How do I output top-to-bottom text except drawing each character separately? ...

Transparent non-client area

Hi. I am creating a TextBox control subclass using Windows Forms. I am using the WM_NCCALCSIZE to change the client area (to enlarge the non-client area) but I have not found any solution on how to make the non-client area transparent. Is there any simple way to paint to non-client area in WM_NCPAINT in transparent way to duplicate the ...

What's the correct way to create a subclass of a MFC control?

We layout dialogs using the resource editor. So say I have a RichEditCtrl called IDC_RICH. And I want to link it to an instance of a custom class CMyRichEditCtrl : CRichEditCtrl, without losing the ability to set properties on it in resource editor. What's the right way? You can certainly get some functionality by creating a DDX-linked ...

How do I get the selected text from the focused window using native Win32 API?

My app. will be running on the system try monitoring for a hotkey; when the user selects some text in any window and presses a hotkey, how do I obtain the selected text, when I get the WM_HOTKEY message? To capture the text on to the clipboard, I tried sending Ctrl + C using keybd_event() and SendInput() to the active window (GetActiveW...

Setting CTreeCtrl item's checkbox to partial state

First I add TVS_EX_PARTIALCHECKBOXES to the CTreeCtrl's extended styles: TreeView_SetExtendedStyle(tree->GetSafeHwnd(), TVS_EX_PARTIALCHECKBOXES, TVS_EX_PARTIALCHECKBOXES); Now how do I actually set any item to this state? There doesn't appear to be any documentation about that. I guessed that since checking and unchecking works by ch...

Managing windows API differences between Windows XP and Vista/Server 2008

I am trying to create a single executable of a simple Win32 application that has to be able to run on both Windows XP and Windows Vista/2008. Due to some changes in the way Vista works some extra Win32 API calls have to be made to make the program function correctly as it did on XP. Currently I detect if the application is running on a...

Reading Firefox Bookmarks

Apparently, latest Firefox versions stores its bookmarks in a file called 'places.sqlite'. Like a browser can import the bookmarks from another browser, I would want to import the bookmarks to a file, but I need to know what would you need to do it? ...

Windows Installer/RunAs shortcut

I have an application on a server in our domain; it's written in C# and uses the Word API. (The app runs through a list of medical reports, each a separate Word document, extracts information which it uses to alphabetize the patient on whom the report is made, and pushes the report content into a PDF.) The app appears to run fine when ...

How can I work around the GetParent/EnumChildWindows asymmetry?

I recently inspect a GUI with Microsoft's Spy++ and noticed a strange structure; it looked like this (warning, ASCII art ahead): | + 002004D6 "MyRootWindow1" FooClassName | | | + 001F052C "MyChildWindow" ClassOfChildWindow | \ 001D0A8C "MyRootWindow2" SomeOtherClassName There are two root windows, 002004D6 and 001D0A8c, the...

IProgressDialog with a custom dialog or information about how the animation is performed

There are basically two questions here, an answer to either is fine. 1) Is there a way to add items into an IProgressDialog? Such as drawing more text (than the few lines provided) or an image or adding a button? Is there a class that overrides this that provides extra functionality? (Since I'm not doing a file operation, the IFileOp...

Client CPU goes almost 100% when stop service..

Hi, We have a service which is hosted as windows service. netTcpBinding with message security type without reliable session. On the client side we have a proxy collection cached in a list as channel creation and dispose is costly operations. My client is connecting to server and get the data from server. Now if I stop the server, then ...

Force Application to Wait Until WinExec Has Completed

How do I force my application to wait until WinExec has completed? ...

How bad is code using std::basic_string<t> as a contiguous buffer?

I know technically the std::basic_string template is not required to have contiguous memory. However, I'm curious how many implementations exist for modern compilers that actually take advantage of this freedom. For example, if one wants code like the following it seems silly to allocate a vector just to turn around instantly and return ...

VB6 - Windows API call to DnsQuery - Function and Pointer Question

In VB6 I'm making a call to the Windows API DnsQuery. Private Declare Function DnsQuery Lib "dnsapi" Alias "DnsQuery_A" ( _ ByVal lpstrName As String, _ ByVal wType As Integer, _ ByVal Options As Long, _ ByVal pServers As Long, _ ppQueryResultsSet As Long, _ ByVal pReserved As Long) As Long Private Type VBDnsRecord ...

What API/SDK to use for this Windows Application?

I'm going to create a utility with GUI that will run on Windows operating systems. It should require minimum (or zero!) amount of additional libraries, files or DLLs to run because it will be executed from an installer. Because of this, i don't want to use .NET for it will require user to install .NET Framework. I know today, most of Wi...