winapi

How do I convert a stdole.StdPicture to a different Type?

To receive the bounty, please provide an answer with working code. Thanks. I have a stdole.StdPicture Object of the Type vbPicTypeIcon. I need to convert it to Type vbPicTypeBitmap. Due to project contraints, I need to be able to do this using Win32 or VBA. I am trying to load a file's icon to a command bar button. Here is what I have s...

Monitor CPU load on XP programmatically

Is there a way to fetch the system cpu load in windows xp via a DLL call or other means. I would like to embed the call in my program and when the CPU load hits 100% I would like to capture the time. My program is maxes out cpu load every couple of days, and I would like to figure out precisely when so I can do a data dump and analyze th...

Launching win32 native executable from public web site

I've been presented with an architectural challenge and am looking for ideas. Customer has an existing win32 native application that they are pretty resistant to changing in any but trivial ways. It is written in unmanaged c++ and uses at least one 3rd party dll so it is not a stand alone exe. What it is doesn't matter much, think of it...

How can I display +/- icons on my tree view?

I want to make a tree view where items show a "+" icon when closed and a "-" icon when open. Just like the Windows XP explorer. However, I can't find out how to get the icons. Do I get them from the system or do I need to provide my own? ...

Win32 API call through a serivce.

Hi. I have develop a program which turns off the monitor by standard sendmassage api call: public int WM_SYSCOMMAND = 0x0112; public int SC_MONITORPOWER = 0xF170; const int HWND_BROADCAST = 0xFFFF; SendMessage(-1, WM_SYSCOMMAND, SC_MONITORPOWER, 2); My question is I dont want it to be a windows form, but a windows ser...

Notification when a thread is destroyed

Hi! Is there a way to get a notification that a thread no longer runs (has returned) in your application? I know this is possible in kernel mode (using PsSetCreateThreadNotifyRoutine), but is there a way to know this from user mode, using only Win32 API ? The problem is that I can't control the code in the thread, because my module i...

How to restrict proccess to create new processes?

How to restrict proccess to create new processes? ...

C#/.NET - Method for converting character codes to equivalent chars

After extracting a piece of text in my application, I might end up with a string like this: "More kitchen supplies for the people" Which in plain text would be: "More kitchen supplies for the people" Is there a component/method in .NET I can use to "process" the string into its plain text equivalent? I'm able to assume r...

RegQueryValueEx - What code add to this function to show ERROR_SUCCESS

What code add to this function to work good? (ERROR_SUCCESS) I have code, that check value in registry. In function RegQueryValueEx is bug. When oldValue is few letters longer than newValue, function shows ERROR_MORE_DATA, but I want want ERROR_SUCCESS What code add to this function to do this? void function(string newValue, string k...

GetThreadId on pre-vista systems?

Apperantly, GetThreadId is a Vista API. How can I get a thread's id on pre vista systems? ...

What are .NET's uses and limitations?

I have a very shallow idea of .NET and C#/C++.NET. I've used it a few times to create some simple, stand-alone apps. From my simplistic viewpoint, I look at it as another "framework", eg. layer, on top of the OS that can be used to write apps for. Can someone shed some more light on what its limitations are and when it is most useful? I...

Registry - How to rename key in registry using C++ ?

How to rename key in registry using C++? I want rename key "Myapp\Version1" to "Myapp\Version2". I don't see any function in MSDN about renaming keys in registry. ...

How to create some class from dll(constructor in dll)?(с++)

How to create some class from dll(constructor in dll)?(с++) or how to dynamically load class from dll? ...

Impersonation and Registry Manipulation in Vista\Win7

I need to create a program that has access to HKLM when running in a non-admin session. I have access to the admin credentials so impersonation seems to be an option.The sequence of Win32 calls is: LogonUser ImpersonateLoggedOnUser RegOpenKeyEx RegCreateKeyEx The key is successfully created on XP/2003 and fails with 'Access Denied' ...

How to get the full client rect?

The GetClientRect function, according to MSDN, is actaully only good for determining the client width & height, since left & top are always zero. Is there a way to get the complete client coordinates, including left & top (either in screen space, or in window space)? ...

How to launch an external application on BN_CLICKED?

I'm fairly new to Windows programming. I'm doing a simple launcher app for WinCE using VC++ (not MFC). So far I've created the basic interface and buttons and stuff. I just wanted to know the best way to launch an external application when the user clicks the button (on BN_CLICKED). I found some methods such as ShellExecute, CreateProce...

Window moving and resizing interferes with MsgWaitForMultipleObjects

I have an application that message-loops using MsgWaitForMultipleObjects to catch additional events while pumping ui messages. It seems that as soon as a window is being moved or resized, DefWindowProc begins it's own message loop until the mouse is being released. This situation prevents from the outer loop to catch the additional messa...

VerQueryValue and multi codepage Unicode characters

In our application we use VerQueryValue() API call to fetch version info such as ProductName etc. For some applications running on a machine in Traditional Chinese (code page 950), the ProductName which has Unicode sequences that span multiple code pages, some characters are not translated properly. For instance,in the sequence below, 5...

OUT OF MEMORY only when virtual limit is hit?

As I know in win32 every program receives say 4GB of virtual memory. Memory manager is responsible for offloading chunks of memory from physical memory to disk. Does it imply that malloc or any other memory allocation API will throw OUT_OF_MEMORY exception only when virtual limit is hit? I mean is it possible for malloc to fail even i...

Replicate functionality of DbgView in .Net - Global Win32 debug hooks?

Hi, I'm interested in how plausible it would be to capture Win32 debug traces system-wide in the way DbgView does. I'm not interested in Kernel messages thankfully so I don't need any help there. This needs to be in C# but I'm happy with unmanaged/unsafe if necessary. Is there any global hook I can get or am I setting off down a diff...