Questions tagged [winapi]

The Windows API (formerly called the Win32 API) is the core set of application programming interfaces available for the Microsoft Windows operating systems. This tag is for questions about developing native Windows applications using the Windows API.

The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. It was formerly called the Win32 API; however, the name Windows API more accurately reflects its roots in 16-bit Windows and its support on 64-bit Windows. Almost all Windows programs interact with the Windows API. You can find more help on the Windows API Documentation.

The Windows API (Win32) is primarily focused on the C programming language in that its exposed functions and data structures are described in that language in recent versions of its documentation. However, the API may be used by any programming language compiler or assembler capable of handling the (well defined) low level data structures along with the prescribed calling conventions for calls and callbacks.

42239 questions
10
votes
2 answers

Can you limit the CPU usage on a .NET Process Object?

An application I'm contributing to fires up a component written in C. The C process does some pretty heavy crunching and if your not careful can really hammer your CPU. Is there a way to set a limit to external processes spawned by .NET? I've seen…
Daniel Upton
  • 5,561
  • 8
  • 41
  • 64
10
votes
1 answer

What is difference between _SH_SECURE and _SH_DENYWR

_SH_DENYWR denies any other attempt to open a file with write permissions (share violation) _SH_SECURE Sets secure mode (shared read, exclusive write access) The _SH_SECURE seems to be newer, based on the fact that the docs seem to gloss over it or…
Mordachai
  • 9,412
  • 6
  • 60
  • 112
10
votes
2 answers

Does winapi's bcrypt.h actually support bcrypt hashing?

This may sound like a strange question, and it feels a bit bizarre that I actually have to ask this, but after spending a couple hours looking over the MSDN documentation for the bcrypt routines that were added in Vista, I've almost reached the…
Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
10
votes
3 answers

Creating window in another thread(not main thread)

I've got a function: HWND createMainWindow(P2p_Socket_Machine * toSend){ HWND hMainWnd = CreateWindow( L"Class",/*(LPCWSTR) nameOfConference.c_str()*/L"Chat", WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU, CW_USEDEFAULT, 0,…
knightOfSpring
  • 359
  • 2
  • 3
  • 11
10
votes
2 answers

SetWindowsHookEx creates a local hook. How to make it global?

In a Delphi XE application I am trying to set up a global hook to monitor focus changes. The hook is created in a dll: focusHook := SetWindowsHookEx( WH_CBT, @FocusHookProc, HInstance, 0 ); // dwThreadId (the last argument) set to 0 should create a…
Marek Jedliński
  • 7,088
  • 11
  • 47
  • 57
10
votes
1 answer

IO Other Operations Performance Counter Explanation

I have received perfmon counters from customer site. We noticed unusual values in \\COMPUTERNAME\Process(PROCESS_NAME)\**IO Other Operations/sec**. The best explanation for the counter I came up with is:- The average rate at which the process is…
Boris
  • 1,311
  • 13
  • 39
10
votes
3 answers

How can I display the "open with" dialog for an unregistered file extension?

I want to let the user select an association (open with) for an currently unregistered file extension. Currently I'm telling the API to open the file by using ShellExecute and it returns an ERROR_NO_ASSOCIATION error code. Is there a way to tell the…
Tobias R
  • 928
  • 8
  • 22
10
votes
2 answers

How do I compile a Window API program using cl?

I am trying to compile a simple C Windows API program using the Windows SDK Command Prompt. Here an excerpt from the program: #include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int…
AndreKR
  • 32,613
  • 18
  • 106
  • 168
10
votes
6 answers

Why comment parameter names rather than leave it as it is

Sometimes I see code like this: LRESULT OnPaint(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) Why comment parameter names rather than leave it as it is?
EFanZh
  • 2,357
  • 3
  • 30
  • 63
10
votes
4 answers

Why using IntPtr for handle?

When using PInvoke, I noticed that we need to use IntPtr to refer to Windows handles. I am wondering why not just use int for the handle? My understanding of a handle is that it is just an integer value.
user705414
  • 20,472
  • 39
  • 112
  • 155
10
votes
2 answers

How to Call Windows API

Possible Duplicate: Windows API and .net languages I want to call native Windows API from .NET Framework. I want to have an easy way where I can call native API from high-level layer like other .NET APIs. Please refer to any resource which you…
Uzair Anwaar
  • 225
  • 1
  • 4
  • 16
10
votes
1 answer

How to share memory between services and user processes?

I have a set of Win32 applications that share information using a shared memory segment created with CreateFileMapping() and MapViewOfFile(). One of the applications is a system service; the remainder are started by the logged-in user. On Windows…
Clay
  • 1,159
  • 1
  • 9
  • 20
10
votes
1 answer

IPC between Processes with ShellExecute

I'm working in the win32 api in C++. I have a parent process, and I'm using it to run a new program through a call to ShellExecute. I'd like for the child process to be able to talk to the parent process (Communication only needs to go one way). I…
keefertaylor
  • 185
  • 4
10
votes
2 answers

Win32 API functions vs. their CRT counterparts (e.g. CopyMemory vs. memcpy)

In writing Win32 C/C++ code, is there any advantage (e.g. performance?) in using Windows-specific functions like lstrcpyn or CopyMemory instead of the corresponding CRT functions (aside from portability of CRT functions)?
user1149224
10
votes
2 answers

How to create rich tooltips and rich balloons in notification area

I've been wondering, whenever you call the ShowBalloonTip method of the NotifyIcon class, you get a balloon tooltip like this: Fig1: Standard Balloon Tooltip Some applications and Microsoft products are able to display more than those 'simple'…
Alex Essilfie
  • 12,339
  • 9
  • 70
  • 108