winapi

Application settings with WinAPI

Is there any standard way to work with application settings in WinAPI? What I'm doing currently is this: if(!ReadKey(some_setting)) WriteKey(some_setting, some_setting_setting_default_value) when the settings dialog is initialized. Then I set the widget states to the corresponding values read from the registry. The problem is that...

Good tutorial to create Win32 toolbar?

I want to add a toolbar and know which tool was clicked. I'd also like to be able to change the toolbar's buttons' bitmap after theyve been created MSDN is fairly breif on all of this. Thanks ...

Make MessageBox stay on top of other windows

I have a TimerProc which calls MessageBox. I want the MessageBox to stay on top of other windows. So for example, the parent window sets the timer, then I move another window on top of that. When the timer fires, I want to MessageBox to appear on top of the window that is covering the app. Is this possible, and how should I go about doin...

SendMessage with TDM_CLICK_BUTTON return value is always zero

In my C# application I'm trying to use the TDM_CLICK_BUTTON message to click a button in a TaskDialog. This basically works just fine. What I expect to happen, happens. I even receive the TDN_BUTTON_CLICKED notification. But the documentation says, that the return value of SendMessage would be nonzero if the call succeeds. But it always...

How to share COM objects between 2 processes?

I want Application1.exe to instantiate an instance of its Item class. I want Application2.exe to call GetPrice() on this object. I have followed steps 1-7 on the following website: http://www.codeguru.com/Cpp/COM-Tech/activex/tutorials/article.php/c5567/ This is what I have so far. Application1's main looks like this: CoInitialize( N...

How to know whether I have admin authority in windows?

Is there any APIs in windows to detect whether the current user(current now) has the admin authority? BOOL IsHasAuthority() { } Many Thanks! ...

why can I not get access to my DLL function

I'm trying to load a DLL dynamically using LoadLibrary(), which works, however I cannot then get the address of the function in the DLL that I'm trying to call. DLL function: (in CPP file) _declspec(dllexport) void MyDllFunc() { printf("Hello from DLL"); } Calling code: typedef void (*MyDllFuncPtr)(); int _tmain(int argc, _TCHA...

Creating a custom context menu Window (WinAPI)

I'm wondering how to create windows like these I'm refering to the one that says Marquee selection tool... these ones. I'm also not referring to the skin. I know how to do my own drawing and what not, this is not the issue. It's because windows usually need a parent which means it should not be possible for these windows to overlap int...

RegOpenKeyEx return ERROR_SUCCESS but it shouldn't (windows 7)

Hi, I've got a problem about RegOpenKeyEx, the code: #include <tchar.h> #include <stdio.h> #include <windows.h> #pragma comment (lib, "Advapi32.lib") int main () { TCHAR *keyName = _T("SOFTWARE\\foobar2000\\capabilities"); HKEY key = NULL; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, KEY_ALL_ACCESS, &key) != ERROR_SUC...

Dialog of my Word add-in not using visual styles

I have written a Word add-in in C++ using plain Win32 API. It opens some dialogs but these are always shown without commctl6 visual styles on Vista+. The manifest is in place as RT_MANIFEST and resource ID - 2 (as shown below). When I invoke the same functionality/dialogs from my own test app, visual styles are OK. Any idea how Word is ...

Registering Windows Programs to Installed Programs List

As you know, Windows has a "Add/Remove Programs" system in the Control Panel. Let's say I am preparing an installer and I want to register my program to list of installed programs and want it to be uninstallable from "Add/Remove Programs"? Which protocols should I use. Any tutorials or docs about registering programs to that list? I ...

Making Vista / 7 User Frame control? (WinAPI)

I notice Vista/7 uses this type of control as well as Windows Live Messenger. This is the control: How can this control be programably added to a WinAPI application? Thanks ...

Window Style for shading?

When a menu item or context menu is made, it has a shadow, if I create a window with WS_POPUP instead of WS_CHILD it has no shadow. How can I get the shadow? Thanks ...

Ways to parse XML in C++ (Win32)

Hi, I'm looking for a way to parse XML in C++ in Windows and I've found a few such as MSXML, Xerces, TinyXml etc but I'm wondering which is best in terms of performance and features. My requirements are that it must be able to be static linked or have the source included in the project itself and must not require any additional toolits ...

C++ TLS, somethings wrong...

I'm learning about Thread Local Storage... (TLS) Here is my TLS Alloc code: //global variable DWORD g_dwTlsIndex; //inside DLLMain: int val= 5; switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: g_dwTlsIndex = TlsAlloc(); if ((g_dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES) { printf("No more indexes available"); } ...

Ampersand accelerators cause a beep in a Win32 dialog

I have a dynamically created toolbar on a plain Win32 dialog. My buttons are added with & shortcuts which correctly puts underscore to characters following ampersand but pressing Alt+(char) causes a beep and the button is not clicked. It has been a while since I have done Win32 API development. Is there something that needs to be done t...

Debug Break on Win32 Api functions

I would like to have a break on the SetTimer function in order to see which components register what timers with what values. Is this possible? ...

VS2010 thread data stack

I just found out how to break into the SetTimer function inside a windows dll (user32.dll). link text However i need to know what arguments its called with. I think that the arguments are pushed onto the data stack right before calling the function, but I have found no way to display a threads data stack in visual studio 2010. ...

24 Bit Toolbar Button Images? (WinAPI)

I'm using pure win32. How can I use 24 bit images instead of 8 bit? Thanks ...

using UpdateLayeredWindow in NETCF (Windows Mobile 6.5 only)

guys, have you tried using UpdateLayeredWindow API? am not sure why it doesn't work. meaning.. just a blank layered window .. public void MakeEXLAYERED(IntPtr hWnd) { // add WS_EX_LAYERED and WS_EX_TRANSPARENT extended style in our form int _initialexstyle = Win32.GetWindowLong(hWnd, Win32.GWL_EXSTYLE); Win32.SetWindowLong(hWnd, W...