winapi

Using WINAPI ReadConsole

I am trying to use the WINAPI ReadConsole() to wait for any keypress at the end of my Win32 console application. CONSOLE_READCONSOLE_CONTROL tControl; char pStr[65536]; DWORD dwBufLen = 1; DWORD dwCtl; tControl_c.nLength = sizeof( CONSOLE_READCONSOLE_CONTROL ); tControl_c.nInitialChars = 0; tControl_c.dwControlKeyState = 0; tControl_c....

Can I get a SOCKET using SChannel?

I'd like to use SChannel or some other Microsoft API to support TLS for my TCP/IP application. Ideally what I'd like to do is use SChannel to create a kind of TLS tunnel within my app so I can pass off a SOCKET handle to another library. Is this something SChannel can do for me or do I have to implement the tunnel myself? ...

Missing Language File or Wrong Language File Version

Hi, I used a win 32 console application application to test a crash reporting mechanism. But when I run the Release exe, I got this error : Missing Language File or Wrong Language File Version. Can someone please explain what is the matter here and how to overcome it??? I use Visual Studio 2008 pro. ...

File Open/Save Dialog

I am using my own Custom View to show the files and folders and also using a search box to jump to a specific folder. In that case How to send a message to File Open/Save dialog to enforce it to change the current displayed folder. e.g. If the dialog shows files and folders of current displaying folder "C:\", I want an API (or any piece...

How to lock file in Windows?

How to lock file in Windows so that this file can be opened/read/wrote only by one process? I found out that file can be locked with CreateFile by giving 0 to dwShareMode flag. It works but only the returned handle can be used to work with file. But I want to be able to lock the file to other processes and at the same time to create mul...

How to stop a MFC/win32 control re-painting

I have a CRichEditCtrl, and an algorithm works on its contents in-place, iterating through the contents and making changes. This seems to cause it to re-paaint every time, which causes flickering and a noticeable time to complete the operation, especially if the control starts scrolling. I wondered if there's a neat way for me to stop it...

Does using wxWidgets only for easier Win32 Programming make sense?

I'm writing a GUI Applikation which needs to use native Windows Controls. I'm also using a very exotic programming language with an otherwise complete runtime library. This means i have to write a GUI toolkit language binding anyway. Without the benefits of being cross platform, C++ and having a lot of other non GUI stuff is it worth u...

HTTP URL Blacklist driver

Hello, how to code HTTP URL blacklisting driver for both XP and Vista/7? I need it for special software for schools any ideas about HTTPS or VPN? I was thinking about firefox, IE,... extension. Not bulletproof, but better than nothing. It's just school. Thanks ...

Get identity-level token for Windows user?

I want to create a WindowsIdentity for a given user. I don't need it for impersonation, just for group membership checks. I need it to work with and without a domain (none of that S4U Kerberos delegation stuff). The constructor for WindowsIdentity that takes a username only seems to work for domain scenarios. Is there any other way I ca...

Tab key support in an IWebBrowser2 control

I have an embedded IWebBrowser2 control using straight C++ (windowed, not windowless) and when someone hits the Tab key to go between fields in the browser, it jumps focus out of the web browser. Any ideas on what I need to implement or what I could be screwing up? Thanks! ...

How to use Mozilla ActiveX Control without registry

I've been using the IE Browser component that is part of Windows. But I'm running into problems with security settings. For example, users get security warnings on pages with Javascript. So I'm looking at using the Mozilla ActiveX control instead. It's especially nice because it has a compatible interface. It works well if I let it inst...

Private heap or manage memory self

Hello all, I know we could take some advantages from creating private heap of Windows especially for frequently allocated and de-allocated small chunks. But I think the normal approach is to allocate a large memory from default heap and manage the allocations and de-allocations ourselves. My question is which way is advantages and disad...

How do I trace a custom allocator using xperf's heap profiling tools?

xperf (part of Windows Performance Analysis Toolkit) is very helpful in tracking memory usage with its heap analysis. However, my app uses a custom allocator -- it grabs chunks via VirtualAlloc directly and manages its own heap. I'd like to generate HeapAlloc/HeapFree/etc. events myself from my own allocation functions, so that I can u...

Manifest or Theme/Style for a IWebBrowser2 control?

The IWebBrowser2 control has password edit boxes which are squares. This happened many years ago if you were on an XP machine, and you had a password edit field without a manifest file, you would get squares (no character found for the * they put in there with that font). My application has a manifest file. However I don't know how to...

How does GetGlyphOutline function work? (WinAPI)

Basically I want to get bezier control points from a ttf font and then draw them. I was basically wondering 2 things. Does it return an array of points or is it more complex? How can you tell the points of 1 contour from another ex: the letter O which has 2 contours? Thanks ...

Cannot launch 16-bit application anymore

I'm trying to debug and resolve some issues with a Win32 macro application written C++ however I'm having the strangest issue. I have to launch a 16-bit program and then simulate entering data into and have been using ShellExecute for over two years now. I haven't touched this actual code at all, but now it doesn't work. I'm doing Shel...

How can I know when dllmain is completed?

I have work I need to complete in a DLL as soon as it is loaded. The work involves synchronization and so can't be done inside dllmain. Is there a way to trigger code to execute as soon as dllmain (or all dllmains) is complete? ...

how come we need not close the handle returned by ShellExecute ?

On success, ShellExecute returns a handle. Do we need to close this handle, and if so, how ? According to examples published my Microsoft, we need not close this handle. But the doc of ShellExecute itself is mute on the subject. Can you confirm we indeed do not need to close this handle ? But then, how can a handle be valid and in no...

What's the difference between PATH_NOT_FOUND and NAME_NOT_FOUND

In Win32 layer, we often meet ERROR_PATH_NOT_FOUND, ERROR_NAME_NOT_FOUND. When does WinAPI(eg CreateFileW, RemoveDirectoryW) return these values? And What's the difference? If I write a file system driver, when do I set STATUS_OBJECT_PATH_NOT_FOUND or STATUS_OBJECT_NAME_NOT_FOUND? How do you determine? I'm so confused. Is there anyon...

WM_NCHITTEST and secondary monitor to left of primary monitor

The described setup with 2nd monitor to left of primary causes WM_NCHITTEST to send negative values which is apparently not supported according to this post. I have a custom control written in win32 that is like a Group control. It has a small clickable area. No MOUSE events are coming to my control when the window containing the cust...