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
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
  • 16
  • 3
313
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
  • 48,060
  • 27
  • 100
  • 130
309
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
  • 15,543
  • 22
  • 76
  • 91
262
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
  • 24,950
  • 13
  • 65
  • 102
241
votes
20 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
  • 26,279
  • 16
  • 79
  • 95
232
votes
14 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,236
  • 13
  • 46
  • 64
220
votes
12 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,772
  • 5
  • 26
  • 22
187
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
176
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
  • 67,400
  • 20
  • 54
  • 64
166
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…
Second Person Shooter
  • 14,188
  • 21
  • 90
  • 165
159
votes
16 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? How can I use…
akshay
  • 1,641
  • 2
  • 11
  • 7
157
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
  • 15,098
  • 21
  • 65
  • 96
153
votes
9 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
  • 33,000
  • 75
  • 203
  • 299
149
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,340
  • 6
  • 28
  • 45
142
votes
6 answers

How to convert std::string to LPCWSTR in C++ (Unicode)

I'm looking for a method, or a code snippet for converting std::string to LPCWSTR
Toran Billups
  • 27,111
  • 40
  • 155
  • 268
1
2 3
99 100