winapi

What could cause the application as well as the system to slowdown?

I am debugging an application which slows down the system very badly. The application loads a large amount of data (some 1000 files each of half an MB) from the local hard disk.The files are loaded as memory mapped files and are mapped only when needed. This means that at any given point in time the virtual memory usage does not exceed 3...

How to get information from VS_VERSION_INFO inside ActiveX control

HI, Is there a way to extract information from VS_VERSION_INFO (like FILEVERSION fro example) inside the same application? I know, you probably thinking in a path of: 1. GetModuleFileName(...) 2. GetFileVersionInfoSize(...) 3. GetFileVersionInfo(...) 4. VerQueryValue(...) BUT! There is a "twist": I need to make activex contr...

InvalidateRect in WM_CREATE does not work

I want to invalidate the window when it's created. How can I do that? calling InvalidateRect during WM_CREATE doesn't work. The thing is I call SetWindowLongPtr in WM_CREATE and set GWLP_USERDATA. WM_PAINT looks for some pointer in USER_DATA but the first time I receive WM_PAINT the data isn't apparently still there so it doenst paint m...

Balloon Tooltips using Shell_NotifyIcon work on Vista, but not on XP

I have some code that pops up a balloon tip. It works on Vista but not on Windows XP. This is the code so far. It works on Vista but not on XP. I can't understand why. This version does not load the icon so it will show up blank. memset(&m_notifyData, 0, sizeof(NOTIFYICONDATA)); m_notifyData.cbSize = sizeof(NOTIFYICONDATA); m_notifyDat...

change volume win32 c++

How would I go about changing the sound volume in c++ win32? Also how would I mute/unmute it? Thanks for the help! ...

Which comm ports exist? Win32

On win32, using winapi, is there anyway to know which comports (from com0 upwards) actually exist as devices? At the moment I am just attemping to open them all (0 to 9), but I can't figure out the difference of failure between one not existing, and one not simply being available for use because someone else is using it. Both situation...

Is there an un-buffered I/O in Windows system?

I want to find low-level C/C++ APIs, equivalent with "write" in linux systems, that don't have a buffer. Is there one? The buffered I/O such as fread, fwrite are not what I wanted. ...

Need to use win32 api to copy files in c# - how do I do this?

I'm trying to copy some files around, and occasionally the lengths of the names exceeds the length that the System.IO.File.Copy method can accept (260 chars according to the exception that is getting thrown) According to the research I've done, I should be able to use the win32 api's file methods in conjunction with \?\ prepended to pat...

debug vs release build in Visual studio c++ 2008 win32 runtime issue

I have a simple udp listener written in c++ using win32 when I compile and run the program under debug mode it works perfectly, and I'm clearly able to see the information from the packets that I'm receiving. When I run this same code as a release build it compiles fine and seems to run fine, but its not printing out any packet informati...

WTL/MFC/Native Win32 vs. .NET + Native Compilation

I have been working on an WTL UI app lately and tearing my hair out with how absolutely archaic everything is. I went with ATL because I needed to be able to offer the application to users who don't have or don't want to be bothered with the .NET Framework installation. I wanted to be able to distribute it without anyone having to do any...

How can I get user time and sys time in Visual C++?

Is there some API that equivalent with that in the time.h in linux systems? ...

defines from Windows.h in C#?

Is there any easy way to get the defines (at least the WM_ stuff) from windows.h in C#? ...

Is the Win32 Registry 'thread safe'?

If I have two processes accessing a given registry key (off of HKLM), is it a good idea to wrap the logic in a Mutex? ...

Framerate uneven on mouse input in 3D app

I'm writing a 3D application for Windows, using OpenGL. For now it renders a simple test scene with one model of about 50000 polygons and it renders smoothly at 60FPS. However, the framerate gets very uneven whenever the mouse is moved over the application window. It fluctuates from 400 FPS to 20 FPS randomly. Is there any reason for th...

Flush communications handle receive buffer?

In Win32 C is there an API call to flush (dump) the contents of a COM port recieve buffer? I could only find functions to flush the transmit buffers. ...

Generic LDAP base for search?

I'm writing some C++/Win32 code to search for a user in an LDAP directory (really I need to validate a username/password is correct, and then verify group membership). I have the username, so I'm hoping something like the following will work: (&(objectCategory=person)(objectClass=user)(uid={username})) When I call ldap_search with thi...

C++ Windows API over-riding?

In VS9, when i call the GetTickCount() function, it automatically converts it into the GetTickCount64() function upon compilation. This second function only works on Vista+, and thus my program errors when run on XP. How can I 'over-ride' this so that it calls the original GetTickCount() ? Thanks ...

Best method for a Java app to access a windows process, and send commands

Basically I am attempting to control a win32 app (press a button, add stuff to a text field) etc from a java app. Whats the best method of attempting this (i.e are there any toolkits, DDE?) or will I have to attempt to do some sort of FindWindowEx, then send a WM_LBUTTONDOWN or something? Cheers ...

Retrieving joystick name with win32 api

Hi, I have a joystick plugged in. It has a name string "My 50cent Joystick" that shows up if I go to Game Controllers under the Control Panel on Vista. I want to retrieve this string programmatically. After some research I found joyGetDevCaps that can retrieve a lot of information except the name string. Under szPname I get "Microsoft Pc...

WaitForSingleObjects with timeout = 0

Does WaitForSingleObject() with timeout = 0 ms result in thread context switch immediately and the thread to loose its remaining timeslice? ...