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.

38350 questions
377
votes
12 answers

Windows 7 SDK installation failure

I seem to be completely unable to install the Windows 7 SDK onto my machine, and the only solution I've found on the web is to make a swathe of registry changes. I've done this - still no success. This is the reported error: A problem occurred…
Guy Davidson
  • 3,771
  • 2
  • 14
  • 3
272
votes
16 answers

Is it possible to "decompile" a Windows .exe? Or at least view the Assembly?

A friend of mine downloaded some malware from Facebook, and I'm curious to see what it does without infecting myself. I know that you can't really decompile an .exe, but can I at least view it in Assembly or attach a debugger? Edit to say it is not…
swilliams
  • 44,959
  • 24
  • 94
  • 129
255
votes
17 answers

How do you configure an OpenFileDialog to select folders?

In VS .NET, when you are selecting a folder for a project, a dialog that looks like an OpenFileDialog or SaveFileDialog is displayed, but is set up to accept only folders. Ever since I've seen this I've wanted to know how it's done. I am aware of…
OwenP
  • 23,410
  • 13
  • 62
  • 95
251
votes
9 answers

What exactly are DLL files, and how do they work?

How exactly do DLL files work? There seems to be an awful lot of them, but I don't know what they are or how they work. So, what's the deal with them?
stalepretzel
  • 14,150
  • 19
  • 71
  • 88
230
votes
13 answers

Objective-C for Windows

What would be the best way to write Objective-C on the Windows platform? Cygwin and gcc? Is there a way I can somehow integrate this into Visual Studio? Along those lines - are there any suggestions as to how to link in and use the Windows SDK for…
Luther Baker
  • 7,016
  • 12
  • 44
  • 62
225
votes
18 answers

Bring a window to the front in WPF

How can I bring my WPF application to the front of the desktop? So far I've tried: SwitchToThisWindow(new WindowInteropHelper(Application.Current.MainWindow).Handle, true); SetWindowPos(new…
Factor Mystic
  • 24,253
  • 15
  • 78
  • 91
206
votes
11 answers

How to provide user name and password when connecting to a network share

When connecting to a network share for which the current user (in my case, a network enabled service user) has no rights, name and password have to be provided. I know how to do this with Win32 functions (the WNet* family from mpr.dll), but would…
gyrolf
  • 3,552
  • 5
  • 24
  • 22
159
votes
8 answers

What is __stdcall?

I'm learning about Win32 programming, and the WinMain prototype looks like: int WINAPI WinMain ( HINSTANCE instance, HINSTANCE prev_instance, PSTR cmd_line, int cmd_show ) I was confused as to what this WINAPI identifier was for and found: #define…
Tristan Havelick
  • 58,645
  • 19
  • 52
  • 64
158
votes
11 answers

How to get the error message from the error code returned by GetLastError()?

After a Windows API call, how can I get the last error message in a textual form? GetLastError() returns an integer value, not a text message.
Jena
149
votes
5 answers

When do we need to set ProcessStartInfo.UseShellExecute to True?

// // Summary: // Gets or sets a value indicating whether to use the operating system shell // to start the process. // // Returns: // true to use the shell when starting the process; otherwise, the process is // created directly…
xport
  • 6,665
  • 11
  • 46
  • 86
143
votes
8 answers

Cannot open include file 'afxres.h' in VC2010 Express

I'm trying to compile an old project using VS express 2010 but I get this error: fatal error RC1015: cannot open include file 'afxres.h'. from this code ///////////////////////////////////////////////////////////////////////////// // // Generated…
clamp
  • 30,396
  • 73
  • 193
  • 291
139
votes
9 answers

ImportError: no module named win32api

I am using Python 2.7 and I want to use pywin32-214 on Windows 7. I installed pywin32-214 by using the msi installer. But when I import win32api in my Python script, it throws the error: no module named win32api. What should I do? Can I use…
akshay
  • 1,441
  • 2
  • 10
  • 6
138
votes
12 answers

How to find if a native DLL file is compiled as x64 or x86?

I want to determine if a native assembly is complied as x64 or x86 from a managed code application (C#). I think it must be somewhere in the PE header since the OS loader needs to know this information, but I couldn't find it. Of course I prefer to…
Ohad Horesh
  • 4,190
  • 5
  • 25
  • 45
138
votes
4 answers

Why in C++ do we use DWORD rather than unsigned int?

I'm not afraid to admit that I'm somewhat of a C++ newbie, so this might seem like a silly question but.... I see DWORD used all over the place in code examples. When I look up what a DWORD truly means, its apparently just an unsigned int (0 to…
dreadwail
  • 13,965
  • 21
  • 60
  • 91
134
votes
17 answers

Windows threading: _beginthread vs _beginthreadex vs CreateThread C++

What's a better way to start a thread, _beginthread, _beginthreadx or CreateThread? I'm trying to determine what are the advantages/disadvantages of _beginthread, _beginthreadex and CreateThread. All of these functions return a thread handle to a…
Kiril
  • 37,748
  • 29
  • 161
  • 218
1
2 3
99 100