winapi

Protecting Content Files

Hello, I want a simple layer of protection for my content (resource) files in my application. For example, I have various sound and image files used in my application. I think, I can wrap them in a SFX archive (Probably packed with WinRAR), then in my application, start the SFX exe with some parameters, like, -silent. But this may not b...

Set window to stays always on desktop on windows7

Hi, I'm trying to set my window a child of the desktop, and i'm doing this like this: HWND ProgmanHwnd = ::FindWindowEx( ::FindWindowEx( ::FindWindow(L"Progman", L"Program Manager"), NULL, L"SHELLDLL_DefView", ...

How to access webbrowser object on this code? C++

I found this example http://www.mvps.org/user32/webhost.cab that host an Internet Explorer WebBrowser object, and it uses this code to access the object void webhostwnd::CreateEmbeddedWebControl(void) { OleCreate(CLSID_WebBrowser,IID_IOleObject,OLERENDER_DRAW,0,&site,&storage,(void**)&mpWebObject); mpWebObject->SetHostNames(L"Web ...

Given a volume (eg Z:), how to tell if that volume is on a device that is "removable"?

Hello, I want to know whether the disk that a given volume resides on is removable (CM_DEVCAP_REMOVABLE). Looking for pointers on win32. Clarify: What I am really trying to find out is whether the disk that the volume resides on is connected on a port (eg. USB) that is external to the computer. ...

Showing a progress bar while SFX archive is extracting

Hello, I'm writing a program with C++ and by native Win32 API. I'm creating a process from a SFX archive EXE in silent mode that no GUI is shown to user. But I want to show a progress bar in my application, while the SFX archive extracting. How can I do that? Thanks. ...

How to preselect Administrator when running an application using ShellExecuteEx with verb "runas"? (Windows XP)

I have an application which runs another application (mine) using the WinAPI "ShellExecuteEx" with the verb "RunAs" so that the other application should start with "Administrator" credentials. My OS is Windows XP. (Do not bother about other operating system, as I have specific code in place) The only problem with this thing is that the...

Antialiased fonts in emacs 23.2 on Windows

I'm having trouble getting antialiased fonts to work correctly in emacs 23.2, to the extent that it appears that it doesn't actually support antialised fonts. If I do the following in emacs 23.1: (set-face-font 'default "DejaVu Sans Mono-9.0:antialias=subpixel") (describe-font nil) Then this reports the full name as "DejaVu Sans Mono...

Windows message when mouse leave a control?

I have created a control and the mosemove for that control makes it change color, but I want to change it back to default when my mouse moves out of that control. I would have thought WM_MOUSELEAVE would do it but it didn't. Thanks ...

Suggestions on error handling of Win32 C++ code: AtlThrow vs. STL exceptions

In writing Win32 C++ code, I'd appreciate some hints on how to handle errors of Win32 APIs. In particular, in case of a failure of a Win32 function call (e.g. MapViewOfFile), is it better to: use AtlThrowLastWin32 define a Win32Exception class derived from std::exception, with an added HRESULT data member to store the HRESULT correspo...

win32 - How do I capture a screen as an 8-bit or 16-bit bitmap?

I am just starting out with win32 GDI programming and finding good references hard to come by. I have a simple application that captures the screen by doing the following: UINT32 x,y; x = GetSystemMetrics(SM_CXSCREEN); y = GetSystemMetrics(SM_CYSCREEN); HDC hdc = GetDC(NULL); HDC hdcScreen = CreateCompatibleDC(hdc); HBITMAP hbmp = C...

Help me understand this C code

INT GetTree (HWND hWnd, HTREEITEM hItem, HKEY *pRoot, TCHAR *pszKey, INT nMax) { TV_ITEM tvi; TCHAR szName[256]; HTREEITEM hParent; HWND hwndTV = GetDlgItem (hWnd, ID_TREEV); memset (&tvi, 0, sizeof (tvi)); hParent = TreeView_GetParent (hwndTV, hItem); if (hParent) { // Get the parent ...

C++ Multi Monitor - Find All Visible/Open Windows

I'm trying to find all the windows of ANY kind that are open (and have a taskbar 'button'). I have no problems finding the list processes/hWnd's, and then cycling through those, but how do I determine if a process/hwnd has a window open? (even if minimized). I've tried doing different combinations of the window parameters (such as WS...

How do I tell if a font is a symbol font?

Given an HFONT, how do I tell if it's a symbol font? A pdf library I'm using needs to treat symbol fonts differently, so I need a way to programatically tell if any given font is a symbol font or not. ...

How to determine development tools used to make a Windows application?

I've got a working proprietary application (windows exe) and would like to know which particular toolkit was used to make it. The reason is that I like the widgets it uses and seek to use same library in my project (to buy it if it's proprietary as well). ...

STL member variable initalization issue with windows API

I am creating a windows app that uses a vector of stings as a member variable. For some reason, I can compile but when it tries to get at any of the vectors members is crashes. the error is 0xC0000005: Access violation reading location 0xcdcdcdd9. in the member function of the vector class. this is the size() function where it breaks...

Get newly created window using Win32 API hooks

This may be a long short or not even possible but no harm in asking. What I am trying to do is monitor an application for any new windows it creates in its MDI control. I have implemented hooking in C# and can capture the MDICREATE window message but because I need to get information about the window after is has been created the MDI...

Is it possible to enumerate menu items of other programs on Windows?

Hi Folks, Is it possible to enumerate all main menu items of other programs on Windows? How? And how to click any of those menu items after getting the menu item list? Thank you very much! ...

Determine if the current thread has low I/O priority

if (reader.is_lazy()) goto tldr; I have a background thread that does some I/O-intensive background type work. To please the other threads and processes running, I set the thread priority to "background mode" using SetThreadPriority, like this: SetThreadPriority(GetCurrentThread(), THREAD_MODE_BACKGROUND_BEGIN); However, THREAD_MODE...

DeferWindowPos and SWP_SHOWWINDOW/SWP_HIDEWINDOW

I am writing a virtual desktop application which utilises the DeferWindowPos API functions. The current method I am using is moving the windows off the screen if they're not on the current virtual desktop. However I know wish to also hide the windows that are off-screen so they do not appear on the task bar. I have attempted this by also...

Should I 'delete' this CDC?

Folks, I'm trying to track down an intermittant bug that's showing up on site. I've a feeling it's in some GDI code I'd to cobble together to get a tally printer working. I'm connfused over how to delete this CDC, my code looks OK to me, but is this correct. // Create a device context for printing CDC* dc = new CDC(); if(! dc-...