winapi

GetOpenFileName() does not refresh when changing filter

I use GetOpenFilename() to let the user select a file. Here is the code: wchar_t buffer[MAX_PATH] = { 0 }; OPENFILENAMEW open_filename = { sizeof (OPENFILENAMEW) }; open_filename.hwndOwner = handle_; open_filename.lpstrFilter = L"Video Files\0*.avi;*.mpg;*.wmv;*.asf\0" L"All Files\0*.*\0"; ope...

Win32: Modal dialog not returning focus

Hi, I'm writing a win32 wrapper classes, mainly to learn more about win32 programming. To get around the problem of c-style callbacks, the following method stores/retrieves the pointer using SetWindowLong/GetWindowLong and passes it to the actual winproc. LRESULT CALLBACK WinClass::WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l...

SendMessage from DLL to a window in another process in Vista

I am pulling my hair out on this one. I am trying to send a message to a window in another process. I keep getting Access Denied (0x5) from GetLastError() after calling SendMessage or PostMessage or PostThreadMessage. I have tried turning off UAC. I have also accounted for UIPI by ensuring that the Integrity Levels match accross proc...

problem with NetServerEnum() in c#

I am developing an application which requires to list all the current LAN machines. Inorder to list all the workstations on a LAN, i have used NetServerEnum() after importing it. On running the program, it seemed to work fine. The two existing machines were detected correctly. However, i want the list to be refreshed whenever required ...

Is there a way to detect an alphanumeric Unicode symbol?

I have a Unicode string consisting of letters, digits and punctuation marks. Ho can I detect characters that are digits and letters (not necessarily ASCII) with a C++ standard library or Win32 API? ...

Is it less expensive to dc->DrawLine() a bunch of times or one blit?

I have a control that has a grid. Is it more expensive to draw the horizontal and vertical lines that make up the grid each time using the draw line function in the device context class or would it be faster to draw the grid once to a memory device context and then blit it each time to the window dc? Thanks. ...

Get a Winstation Name from a Process ID

I am trying to get the name of the winstation (for example "winsta0") that a separate process has opened using only its Process ID. I can't find anything that does this on MSDN. They only seem to have GetProcessWindowStation() which only works for your own process. Any ideas? UPDATE: Maybe this is part of the puzzle... BOOL ProcessId...

Drag-able WinForm Problem

I have a windows form that can be moved around by clicking and dragging on any portion of the form. I used the method of overriding WndProc, and setting the result of the NCHITTEST function to be HTCAPTION, in order to fool the form into thinking I clicked the caption - so it enables dragging. The code for this works great, and is be...

ERROR_BAD_INHERITANCE_ACL from SetNamedSecurityInfo?

What does ERROR_BAD_INHERITANCE_ACL returned from SetNamedSecurityInfo imply? In this case I'm adding a user to a directory's ACL. I've looked at the directory in question and its rights seem reasonable before the call. But the calls fails. Any thoughts? Here is the code snippet doing the work (and as I paste it here, I'm wonderin...

Getting the word during mousemove and checking if its a link

I am creating a user control derived from RichTextBox. I have to display a tooltip under a custom hyperlink I have created the cusom hyperlink ,with CFM_LINK . Now when I do a mouse hover on the link , a tooltip should be displayed , with values respective to the link . "I am using [Word2003] , but [Word2007] is the recent version. "...

Is there a painless way to build a Windows UI in C?

edit alright, I guess C is painful in nature--Just, this part, is particularly painful. Also, there isn't a real reason I'm only writing in C, other than, that's the language I want to write in, and be proficient in, for now. I know moving from C to C++ is bad, but whatever. And does anyone know a solution, to my problem with making mo...

How can I disable hittests on a Windows Form?

Is it possible to disable the hittest on a Windows Forms window, and if so, how do I do it? I want to have a opaque window that cannot be clicked. Thanks in advance, Christoph ...

C/C++ USB drive event

Regarding the Windows platform, is their an event I can look for to tell when a USB drive or any type of portable media us plugged in? ...

How to quickly get whether a directory has changed using C++ without a monitoring thread or process?

The change includes adding or removing files in the directory, or changes of its sub-directories. Is there any windows APIs which can get thus changes? I don't have a thread or process to monitor the file system. ...

How to programmatically move a window slowly, as if the user were doing it?

I am aware of the MoveWindow() and SetWindowPos() functions. I know how to use them correctly. However, what I am trying to accomplish is move a window slowly and smoothly as if a user is dragging it. I have yet to get this to work correctly. What I tried was getting the current coordinates with GetWindowRect() and then using the setwin...

How many CRITICAL_SECTIONs can I create?

Is there a limit to the number of critical sections I can initialize and use? My app creates a number of (a couple of thousand) objects that need to be thread-safe. If I have a critical section within each, will that use up too many resources? I thought that because I need to declare my own CRITICAL_SECTION object, I don't waste kerne...

What's a good lightweight programming language that compiles to native windows code?

I'm a .Net developer but I have a situation where I can't guarantee that the .Net Framework will be installed on the target machine. I've seen a few questions (here and here) that suggest using NGen to compile to native code. Both point out that you still need the framework though. I want to write a fairly lightweight app (basic GUI, ...

windows mailslot max size on local computer

After researching windows mailsots for IPC within a local computer I'm a bit confused on what the max size the datagram can be. MSDN says "A mailslot is a pseudofile that resides in memory, and you use standard file functions to access it. The data in a mailslot message can be in any form, but cannot be larger than 424 bytes when sent ...

how to invalidate parent window without sending wm_paint to child window?

the parent and the child window is in the same size. and the the parent listens to the child's repainting when child repainting, the parent repainting. so I cannot use invalidate to clean the parent window, cos this will send wm_paint to child window, then a endless cycle. how can i clean up parent widnow without use invalidateRect,inva...

What is the Windows equivalent to the capabilities defined in sys/select.h and termios.h

I have an application in linux, which is compiled successfully. I want to run the same program in windows. But compilation produces the following errors related to header files. Cannot find sys/select.h Cannot find termios.h How can I fix this? ...