winapi

WinAPI File In-/Output with std::strings instead of char arrays?

Hi, due to performance reasons I didn't feel like using fstream for just one time. Seems like a very bad idea to use WinAPI functions with a std::string instead of a plain char array. All in all I would like you to tell me why the following snippet just won't work (empty stBuffer stays empty) and what I'd need to do to get it fixed. Th...

How to find out which Win API functions are called from a compiled c/c++ dll

Hi I have a compiled C/C++ Dll. I would like to know which external API function is called by this Dll. Do you know any tools which can provide these informations. Thanks. ...

What's the ATL way to open a named pipe in windows in c++?

hPipe = CreateFile( lpszPipename, // pipe name GENERIC_READ | // read and write access GENERIC_WRITE, 0, // no sharing NULL, // default security attributes OPEN_EXISTING, // opens existing pipe 0, // default attributes N...

Why does Win32 API function CredEnumerate() return ERROR_NOT_FOUND if I'm impersonated?

I've written some sample code which when I call from the windows command prompt under the context of a normal user account, dump's all the user's saved credentials using CredEnumerate(). However, I really want to be able to do this from SYSTEM user context so I've tested my program from a SYSTEM cmd prompt. When I running my program a...

Issue with callback method in SetTimer Windows API called from C# code

Hi all I'm currently involved in a project that is migrating some old VB6 code to C# (.Net Framework 3.5). My mandate is to just do the migration; any functional enhancements or refactoring is to be pushed to a later phase of the project. Not ideal, but there you go. So part of the VB6 code makes a call out to the Windows API SetTimer ...

How to cap memory usage by Extensible Storage Engine (JetBlue)?

I have an app that every so often hits a ESE database quite hard and then stops for a long time. After hitting the database memory usage goes way up (over 150MB) and stays high. I'm assuming ESE has lots of cached data. Is there a way to cap the memory usage by ESE? I'm happy to suffer any perf hit the only way I've seen to drop the...

How do I check if a VB6 application is running (and not hung on a system error) from C#?

I need to monitor a legacy application written in vb6 from a C# service and force-quit/relaunch it whenever it hangs. How do I check if a VB6 application is running (and not either hung on a system error or crashed completely) from C#? Thanks! ...

pywin32 CreateEvent and Apache

Hello all, I have a website in Django1.1.1 deployed in Apache2.0. In the backend I have a launcher script that starts three python processes that interact with the frontend. One of these processes uses a Windows Event (using CreateEvent) that communicates with Apache. My problem is that when I run the launcher script first and then sta...

How can I change the workbook icon in Excel?

I managed to write some code to change the Excel application icon. See this post. As a follow up how can I change the icon that sits directly below the Excel application icon? I want to change the workbook icon as well. Any ideas? Thanks! ...

designing a game c++

ok im gonna be using directx maybe 9. I have designed two other games they were too simple im asking how game is designed like they make one file that includes menu codes and the all level codes......... thanks ...

Putting window inside the desktop

Hi, I am trying to make a kind of desktop widgets using C#. So far, I've managed to create a window that gets added to the WorkerW window containing SHELLDLL_DefView. This way, my main form is inserted inside the desktop window over the wallpaper. This is exactly what I want except that I have a little problem. It seems like there is an...

How to hide window from "Applications" tab in task manager?

Hi guys, I have question regarding the CreateWindowEx function. I have 2 windows, a main one and a popup one. I want a popup window to hide everywhere. It is currently not displayed in taskbar and it is not even visible in alt+tab menu. However it is visible on "Applications" tab in task manager. What flags do I need to use in CreateWin...

NetServerEnum returns 58, can't find this error code in the documentation

NetServerEnum returns error code 58, can't find this error code in the documentation. What does it means? ...

possible heap corruption (win 32, native c++)

I'm working with a single-threaded native c++ application. There is a very hard to reproduce bug that I cannot reproduce locally. I enabled full page heap and debug information in the release executable, and obtained dumps from a client (which has to use the application many days to get the bug). What the client reports: the applicatio...

Combobox style edit control in winAPI

Hi again, In my winAPI project done in C++ (no MFC, no .net...), I am creating comboboxes in place of edit controls, because of the nice blue border. In many windows forms and dialogues, edit controls also have this look. There are two problems: This doesn't seem like like "proper" way to make an edit control look that way. What if I ...

Problem with combobox

Whenever I resize my controls in my window, in resopnse to a WM_SIZE message, they resize and redraw themselves fine. But my combobox control (a dropdown list) disappears whenever I give it a resize message, until I hover over it to bring it back. There are two possibilities, either it is not redrawing when I resize it, or it is being h...

How do you read the user's display (first and last) name on all versions of Windows reliably?

I have found that on Windows 7 64 bit, on a machine with a domain name, GetUserNameEx( 3, .... ) which should get the extended name format DisplayName (==3), into a buffer, works fine. However, it does not work on Windows 7 32 bit, vm that is on a workgroup, rather than on a domain, it returns ERROR_NONE_MAPPED. How do you read the per...

Why is cleanup necessary if both OpenThreadToken and OpenProcessToken fail?

In the IsMemberOfAdministratorsGroup example in MSDN, there is code like this: if (!OpenThreadToken (GetCurrentThread(), TOKEN_QUERY|TOKEN_DUPLICATE, TRUE, &hToken)) { if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY|TOKEN_DUPLICATE, &hToken)) { lastErr = GetLastError(); goto CLEANUP; } } .... CLEANUP: if (hToken...

Printing debug output in Windows programs

I am starting to do some work with the Windows API. However, I noticed that you can not use functions like printf if you have a windowed application. What is the standard way of printing debug and logging information? Sorry if this is an obvious question. ...

How to fix this "First-chance exception" in c/c++?

It reports An invalid handle was specified. for the code below: if(hPipe) CloseHandle(hPipe); What can I do? ...