winapi

c++ repaint part of window

i want to repaint part of the window not the whole thing. i have no idea how to. im using win32 please no mfc........ thanks in advance // create rect structure RECT rect2; rect2.left=0; rect2.top=0; rect2.right=225; rect2.bottom=300; // calling invalidateRect when left mouse button is donw case WM_LBUTTONDOWN: InvalidateRect(hWnd, ...

Sound for Installation Complete

I am making my own installer and it's almost complete. The only thing lacking is the sound when installation is complete. Is that a windows API call or I will need to find that audio file and play that from the source code? ...

How to swallow crash report when using Win32::CreateProcess

In a unittest sequence I'm testing if a data corruption error is caught or not (deliberately feeding corrupt data). In order to treat a program crash (e.g. corrupt data + poor buffer management) as a regular fail-condition I run the program in a child process with CreateProcess. My problem is that if it crashes I get a crash report dia...

GlobalAddAtom() returns 0 and GetLastError = 0x5 on Win7, works on XP

Simple code: ATOM atom = GlobalAddAtom(L"TestCpp1"); It returns 0 and GetLastError returns 0x5 (Access Denied). Nothing on MSDN about it. This is on Win7. Admin rights make no difference. Same code works on XP. AddAtom (local) works on Win7. What's causing this? ...

How to discover the method that is called by a Windows Context Menu item?

When you click the right mouse button on your clean desktop it opens a context menu. Each item there is a call to a method. To programmatically call those methods, first I need to know which one I want. IIRC there is a tool that helps with that, but I can't remember its name. ...

How do I create a secondary message loop in vb.net?

I've got an app working semi-background stuff in the GUI thread. Another thread won't work and a timer won't work. But I want the app to be responsive while I'm going my 'background' work. I cound use application.doevents - but that gives me 3 bad choices: loop with no sleeps - end peg an entire CPU (my task waits on stuff besides cal...

How to repaint a push button in Win32?

I have a window with a button that paints the entire window red when clicked, but my code paints the whole window, even the button. When I resize the window or cause the part of the window where the button is to repaint, the button will return. I've only been able to paint the button a solid color after painting the window, but that only...

How to achieve pushbutton type effect using bitmaps

Hello there I have a issue related to the usage of the bitmap enabled Dialog window.I have created a keyboard type layout and i wish to get the input through keyboard also.When i use the mouse I am able to get the button(s) pressed and also all the buttons are working fine - the other images DEFAULT,SELECTED,DISABLED ..all get loaded and...

Why does this code compile?

Last night, being too tired, I wrote this strange line: ::TerminateThread(::TerminateThread, 0); To my surprise, the compiler does not complain (It even run...) Since TerminateThread() is defined as BOOL WINAPI TerminateThread(HANDLE hThread, DWORD dwExitCode); I'm no sure why I am able to compile it. Any explanation? ...

The service did not respond to the start or control request in a timely fashion.

I have created a service in win32,c++ . I am able to create the service , but when I try to start it, it gives following error. [SC] StartService FAILED 1053: The service did not respond to the start or control request in a timely fashion. What is the best way to get to the root cause, since this error message is not conveying anything...

Registry problem - deleting key/values with C++

The following piece of code seems to unreliably execute and after and undeterministic time it will fail with error code 234 at the RegEnumValue function. I have not written this code, I am merely trying to debug it. I know there is an issue with doing RegEnumValue and then deleting keys in the while loop. I am trying to figure out f...

WS_CLIPCHILDREN does not work when in fullscreen.

Hello guys, I have a main window created with : if (!fullscreen) { wStyle = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_CLIPCHILDREN; wExStyle = WS_EX_TOPMOST; } else { wStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; wExStyle = WS_EX_TOPMOST; } I have also a child window created runtime w...

Win32 ReadFile() refuses to read more than 16Mb at once?!

I've got very strange problem on my Windows XP in VirtualBox. ReadFile() function refuses to read more than 16Mb of data in single call. It returns error code 87 (ERROR_INVALID_ARGUMENT). Looks like data length is limited to 24 bits. Here is the example code allowed me to find out exact limit. #include <conio.h> #include <stdio.h> #in...

How to turn off beeping when pressing ENTER on a single-line EDIT control under Windows CE?

Hello, I'm developing an application targeted to a POCKET PC 2003 (Windows CE 4.2) device using C++ and native WINAPI (i.e. no MFC or the like). In it I have a single-line edit control which part of the main window (not a dialog); hence the normal behaviour of Windows when pressing ENTER is to do nothing but beep. I've subclassed the w...

Make Windows let me map 1 GB of virtual memory

I am using CreateFileMapping and MapViewOfFile to try and map an almost 1 GB file. I was having some problems with extending the file so I thought that I would try using CreateFileMapping with a 1 GB size. That is larger than the actual file, but it works well on smaller files. It seems that I can get almost to a 1 GB mapping, but not a...

The "Default Zoom Level" Mouse Button

Many mice and keyboards have "zoom" buttons on them. These almost always generate Ctrl+Mouse Wheel messages to the applications, so they are easily accounted for by us programmers. But my current Logitech mouse has an additional feature. The zoom wheel indeed sends Ctrl+Mouse Wheel messages when scrolled (or, actually, tilted), but when...

How does regedit.exe create empty binary values

I opened up regedit and made an empty binary value monitoring it using ProcessMonitor.exe. I set up a filter so that it included anything mentioning the registry path of the empty binary value's key and excluded everything else. When making a new binary value, it creates the unnamed one, then when I rename it to something else it deletes...

Are Extended-Lenght Paths safe to use?

I just stumbled on this article on MSDN that says a path can be 259 characters + NUL termination, but if you prefix it with "\\?\" WinAPI allows you to use the maximum total path length of 32,767 characters. Eager to see it working I tried using that prefix from Explorer (On XP SP3) but it doesn't work at all (on any path). If you...

How to compare 2 volumes and list modified files?

I have 2 hard-disk volumes(one is a backup image of the other), I want to compare the volumes and list all the modified files, so that the user can select the ones he/she wants to roll-back. Currently I'm recursing through the new volume and comparing each file's time-stamps to the old volume's files (if they are int the old volume). Ob...

Draw on DeviceContext from COLORREF[]

Hi, I have a pointer to a COLORREF buffer, something like: COLORREF* buf = new COLORREF[x*y]; A subroutine fills this buffer with color-information. Each COLORREF represents one pixel. Now I want to draw this buffer to a device context. My current approach works, but is pretty slow (== ~200ms per drawing, depending on the size of th...