Ajanth
Ajanth

Reputation: 2515

Using win32 APIs in Windows Forms Projects

I need to use Win32 Functions like GetForegroundWindow(), ShowWindow(), SetForegroundWindow(), SendMessage(), GetWindow().......in my Windows Form Project in Visual C++ 2005 (CLR mode). the error i get when i use these functions is error C3861: 'GetForegroundWindow': identifier not found

Upvotes: 0

Views: 1143

Answers (1)

Hans Passant
Hans Passant

Reputation: 942358

The first version of this question said this is C++/CLI code. You don't need pinvoke to use the winapi, C++/CLI was designed as an interop language. Just #include <windows.h> and directly call the API functions you want to use. Nobody can really help you if you don't document the errors you get.

Upvotes: 2

Related Questions