winapi

How to select an item in a TreeView using Win32 API

Hello, I am trying to automate a sequence of user inputs to a compiled application in C# using Win32 API. I do not have any source code for the application I am trying to control and it is running while I am trying to control it. In my code, I have a single button that, when clicked, needs to make a sequence of 3 inputs to the applicat...

How to set the area/rectangle in which the cursor is allowed to move?

E.g. when you hit the side of your monitor your cursor can't go any further, and more of an example is when in microsoft paint, and your choosing a colour from the RGB table, it won't allow your mouse to go outside of the rectangle while your mouse is down.. my question is how would you implement that in c++ with win32 api? ...

IHTMLDocument2->open not working as expected from within activex control

Hi folks. Unfortunately I'm a complete novice when it comes to this kind of native windows programming. I have been tasked with attempting to figure this out within our group alas. Essentially I need an activex control to open a new browser window. In addition to this I would like to have a reference to the new windows hwnd when its done...

Disable MessageBeep on Invalid Syskeypress

Simple problem, normally a program will produce a MessageBeep if the user presses Alt+Whatever and there's no hotkey associated with it. What API functions can I call to avoid this? Handling WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, and WM_SYSKEYUP all with return 0; on my main WndProc does not work. ...

is WinINET reentrant?

I see that WinHTTP is not reentrant (1,2). Is WinINET reentrant? We have an ActiveX control that does synchronous HTTP with WinINET. If the browser (in javascript) fires an asynchronous http request (ajax) and then immediately calls the ActiveX operation (same IE process), it seems like the two operations are interleaving, perhaps reent...

NetUserGetInfo/NetLocalGroupGetInfo returning error 1722

I have the following code (VB.NET) which is designed to determine if a given account name refers to a local group or a user account. This will only be called for accounts/groups on a machine, not a domain. Module netapi Private Declare Function NetUserGetInfo Lib "Netapi32.dll" ( _ ByVal ServerName As String, _ By...

Partial unmap of Win32 memory-mapped file

I have some code (which I cannot change) that I need to get working in a native Win32 environment. This code calls mmap() and munmap(), so I have created those functions using CreateFileMapping(), MapViewOfFile(), etc., to accomplish the same thing. Initially this works fine, and the code is able to access files as expected. Unfortuna...

How to get disk usage statistics for remote network share?

If I have a network share say \\myfileserver\documents, can I find out programmatically how much disk space it is using (used/free space) using any API of some sort? Please note it could be hosted by samba or it could be on a san storage device which means I won't be able to install anything on that machine to check the local disk usage...

Problem with window subclassing: endless cycle

I have an application written on MS VC++ 6. It performs subclassing for several windows of controls (I needed this for custom skinning mechanism). New window procedure calls window procedure (its address was saved during the subclassing operation) in the end of its body - using CallWindowProc, of course. It worked Ok for years until one...

Need a better way to valid Computer name using C++ code.

I am not trying to set the local hostname. In my app using a edit control need to accept a host name (fully qualified with DNS / without). We do know we cannot use chars a (\ / ! @ # $ % ^). Is there a better way than programmatically parsing the user input. Code needs to work in all languages (multi byte char set) Thanks AnilG ...

How to implement asynchronous write in c/c++?

WriteFile( tmp_pipe, &Time, sizeof(double), &dwWritten, NULL ); The above is synchronous, if buffer of tmp_pipe is used up, it'll wait there. How to make the above finish instantly, maybe just ignore the data if the buffer is full? ...

How to stop windows narration?

Hi, Is there a way to tell the windows accessibility framework to stop saying whatever it is currently trying to say? Not disabling the feature all together, just stopping the current reading? Thanks, -Andrew ...

GetTokenInformation() first call. What for?

Looking at MSDN documentaion for GetTokenInformation() and the Getting the Logon SID example, GetTokenInformation() needs to be called twice. The first call is to get the buffer size. So, buffer size of what? Just say I use TokenUser as its second parameter, I see that the dwReturnLength returned by first call is not the size of TOKEN_U...

Crop function BitBlt(...)

Hi, I want to create a crop function in an existing engine. This is what I already have: bool Bitmap::Crop(RECT cropArea) { BITMAP bm; GetObject(m_Handle, sizeof(bm), &bm); HDC hSrc = CreateCompatibleDC(NULL); SelectObject(hSrc, m_Handle); HDC hNew = CreateCompatibleDC(NULL); HBITMAP hBmp = CreateCompatibleBitmap(hNew, bm.bmWidth, bm...

How can I get the DOS path name of a running process in C# / Win32?

To sum it up, I need to do this: 12345(hWnd) -> "C:\setup.exe" Right now, I am using GetProcessImageFileName to retrieve the Kernel Device Path of a process handle. I'm retrieving the handle using OpenProcess, passing it the PID. The PID (which I also need) is being retrieved using GetWindowThreadProcessId. However, this gets ...

c++ get other windows messages

im learning to make things to other windows like resize the ie or any type of window. the only problem i don't know how i can get or give messages to other windows. so like i pressed a key in ie i would like to get that message to my program too! any idea ...

c++ create program runs in the background

i wanna make a program runs in the background and shows an icon in tray bar. I'm using win32. What api should i use? Do you know any good tutorials? ...

WriteFile for a symbolic link which points a network volume's file.

I made a symbolic link file. mklink C:\LinkFileToPointNetworkFile.txt Z:\NetworkFile.txt Then I opened and read the file. Good. It works well. The target file's data has been read. -Of course, I didn't use FILE_FLAG_OPEN_REPARSE_POINT But if I try writing to the file, I get a 'access is denied'. This is not what I expected. Why ...

wxWidgets display bitmap from an 8 bit array

I have a function generating an array that I need to draw to the screen. The array is in the form of an 8 bit grayscale image. How can I draw the array to the screen properly? I have a working version of this app in with win32 code which uses StretchDIBits to draw the image. My question is, can I/how can I do something similar in wxWidge...

How can we know that an event generated with keybd_event has been recieved/processed by a window /application

Hi I m generating some keyboard events on my application using keybd_event(). But I want to check that my application actually got my previous KEYDOWN and KEYUP before i do next set of keydown and keyup (for synchrnization ) Is there any api that will let me know that the my application has actually recieved /processed the event. thank...