winapi

Timer message in MFC/Win32

I was just trying the SetTimer method in Win32 with some low values such as 10ms as the timeout period. I calculated the time it took to get 500 timer events and expected it to be around 5 seconds. Surprisingly I found that it is taking about 7.5 seconds to get these many events which means that it is timing out at about 16ms. Is there a...

Is it necessary to use InitCommonControlsEx() and InitCommonControls() ?

I'm completely new to win32. I have been working on it the last 48 hours. I'm trying to build a "grid", and I got examples of a List-View control and a Header control on msdn.microsoft.com . The first one calls the InitCommonControls() function (besides I read this function is obsolete). HWND DoCreateHeader(HWND hwndParent, HINSTAN...

How do you convert a Visual Studio project from using wide strings to ordinary strings.

When I created my visual studio project it defaulted to forcing me to use wide strings for all the functions which take character strings. MessageBox() for example, takes a LPCWSTR rather than a const char*. While I understand that it's great for multi-lingual and portable applications, it is completely unnecessary for my simple little a...

What happens when GetTickCount() wraps?

If a thread is doing something like this: const DWORD interval = 20000; DWORD ticks = GetTickCount(); while(true) { DoTasksThatTakeVariableTime(); if( GetTickCount() - ticks > interval ) { DoIntervalTasks(); ticks = GetTickCount(); } } Eventually, ticks is going to wrap when the value doesn't fit in a ...

Why is my file-loading thread not parallelized with the main thread?

My program does file loading and memcpy'ing in the background while the screen is meant to be updated interactively. The idea is to have async loading of files the program will soon need so that they are ready to be used when the main thread needs them. However, the loads/copies don't seem to happen in parallel with the main thread. The ...

What's the difference between kernel object and event object in Windows?

As far as I know , both of them are pointed by a HANDLE which can be manipulated by user. What is the difference? ...

How to programmatically check Internet bandwidth in VC++?

I need to find the bandwidth available at a particular time. The code must be developed in Visual C++ or in .Net family . If anyone knows how, please help me out. ...

Overhead associated with OutputDebugString in release build.

Is there a significant overhead associated with calling OutputDebugString in release build? ...

System Idle Time calculation using vc++

I need to get the sytem idle time.It must be developed in vc++ and the code should not use hooks is there any possible way of getting SystemIdleTime from taskmanager ...

How to get/set the scrollbar location of the browser (IE/Firefox/...)?

Hello, Is there a way to get/set the location of the scrollbar in Internet Explorer/Firefox? I am not looking to do that from inside the HTML/ASP/Javascript code, but from an application outside the browser (using WinAPI for example), and without using BHO. From the search I've done right now it seems impossible, so I'm dropping a ques...

Using 64-bits driver from 32-bits application

I have a Windows application that HAS to run as 32-bits (because of other limitations out of my control). However, my application has to call and access a driver which may be 32-bits or 64-bits depending on the system where it is installed. I access the driver through DeviceIoControl() calls, exchanging data structures declared in an in...

Win32 Commport Sniffing

Using C winapi, how can you capture receieved data from a commport that is open exclusively by another program. I know there are programs that do this, but I want to code my own monitoring software for a specific purpose and was wondering how is it done? ...

Getting Default browser

How can i which is the default browser in my system programatically. the codes must be developed using vc++ Is there any API for this Where in the registry is the default browser value changed can somebody help me out. ...

Visual C++: How to get the CPU time?

How can I programatically find the CPU time which is displayed in System Idle Process (in Task Manager) using Visual C++? ...

Password Information

I want to get the various user account passwords which are stored in my computer programatically using Visual C++. Are there any APIs to help me do this? ...

InitiateSystemShutdown call not working

I'm writing an application that will need to reboot the Windows machine the code is running on. There didn't appear to be an API within .NET to do this, so I looked up the the Win32 API for this and it is called InitiateSystemShutdown. The extern declaration is given below: [DllImport("advapi32.dll")] public static extern bool Initiate...

Creating a win32 modal window with CreateWindow

Hi, I create a window with CreateWindow() and show it with ShowWindow(). But the parent window on which this was created should be disabled until user returns from this window, i.e. it should simulate modal dialog box. Any help is appreciated. Thanks ...

Is it possible to set the parent of a .NET WinForm to a native app?

Is it possible to set the parent of a .NET WinForm to a native app? So it acts like its child window? ...

A C++ Application Compiled With VS2008 Doesn't Run In Other Computer

Hi, I have created a wn32 project with Visual Studio 2008 and Visual C++ language, it uses the ws2_32.lib library and then I compiled in Release mode. It runs very good in the same computer, but when I copy the exe file to other computer (that doesn't have installed Visual Studio), it doesn't run. The message I see is: This applicati...

Win32 LB_GETTEXT returns garbage.

Hello, I have a problem which is most likely a simple problem, but neverthe less still a problem for me. I am using the Listbox in Win32 / C++ and when getting the selected text from my listbox the string returned is just garbage. It is a handle to a struct or similar? Below is the code and an example of what I get. std::string Listbox...