473,729 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

wanted: help translating MapVirtualKeyEx to PInvoke

Can someone kindly help me finish my attempt at pinvoke? HKL is a void* and
I don't know how to translate it.
[DllImport("user 32.dll", SetLastError = true)]
//static extern UInt32 MapVirtualKeyEx W(UInt32 uCode, UInt32 uMapType, HKL
dwhkl);

Here is the function:
http://msdn.microsoft.com/en-us/libr...07(VS.85).aspx

Thanks!

Siegfried
Sep 10 '08 #1
3 2995
http://www.pinvoke.net/default.aspx/...tualKeyEx.html

"Siegfried Heintze" <si*******@hein tze.comwrote in message
news:uL******** ******@TK2MSFTN GP03.phx.gbl...
Can someone kindly help me finish my attempt at pinvoke? HKL is a void*
and I don't know how to translate it.
[DllImport("user 32.dll", SetLastError = true)]
//static extern UInt32 MapVirtualKeyEx W(UInt32 uCode, UInt32 uMapType, HKL
dwhkl);

Here is the function:
http://msdn.microsoft.com/en-us/libr...07(VS.85).aspx

Thanks!

Siegfried

Sep 10 '08 #2
Wow! Great tip! I had to search seperately for the MAPVK constants but I
found them!

They were in VB though! I translated them by hand.

How can I search for constant definitions in C#?
How can I search for functions in VB?

Seems like there should be C#/VB checkbox.
Sep 11 '08 #3
The pinvoke site is user driven, meaning people submit the help. If there
is no C# or VB code for a function, then someone needs to submit it. The
constants are constants in any language, but you do have to convert &H0A to
10, for example.

"Siegfried Heintze" <si*******@hein tze.comwrote in message
news:u5******** ******@TK2MSFTN GP04.phx.gbl...
Wow! Great tip! I had to search seperately for the MAPVK constants but I
found them!

They were in VB though! I translated them by hand.

How can I search for constant definitions in C#?
How can I search for functions in VB?

Seems like there should be C#/VB checkbox.
Sep 11 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3712
by: Ted | last post by:
Is it possible to use mailslots in .NET using PInvoke? I have a VC++ 6.0 based app that creates and listens to a mailslot. I have a second VC++ 6.0 based app that opens the mailslot and writes to it successfully. So this stuff works. Additionally, I have a VB.NET app that opens the mailslot successfully using CreateFile() (with PInvoke). What looks like a proper handle is returned and there is no error.
5
2519
by: Carlos Guzmán Álvarez | last post by:
Hello: I'm trying to execute a function of a unmanaged dll using PInvoke, i have definied the function as: public static extern int isc_dsql_prepare( int status_vector, ref int trans_handle, ref int stmt_handle,
3
3466
by: Brett Robichaud | last post by:
I have created a simple background thread to make one pinvoke call into a DLL I've created. My Winforms app spawns the thread in the form load event then go about it's business. The problem is that my form appears to be blocked while the background thread is running. I am very familir with threads in unmanaged code but am just getting into them in C#. Are there issues I need to be aware of with regards to threading a simple pinvoke...
5
2827
by: vertigo | last post by:
Hello I use some win 32 API function for example: HANDLE CreateFile( LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile
2
3339
by: Craig | last post by:
I've seen many examples of how to call SHGetFileInfo in shell32.dll to get a files associated icon, but I can't find anywhere how to get the file information (size, last date modified, etc, etc) out of shell32 using pinvoke. I have however seen how to get this information using COM: Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace("C:\\"); Shell32.FolderItem folderItem =...
5
7881
by: _iycrd | last post by:
After numerous problems, I'm having second thoughts about using C++/CLI to wrap a native DLL. On the other hand, PInvoke seems like it will take a huge amount of work, if it will work at all. The native DLL uses raw data buffers that are normally handed to it (via pointer) from another native function. If I'm piloting this with C#/PInvoke, how could those raw data buffers be created and immobilized? In C++/CLI, there is pin_ptr to...
8
6657
by: Rajesh Soni | last post by:
Hi! I'm getting a PInvoke error while trying to execute the following code... declaration: Structure POINTAPI Dim x As IntPtr
0
1199
by: Benosham | last post by:
I have been playing around with trying to PInvoke GDI+ from C#, I made recently made the transition from C/C++ to C# and I really like the language, however being the old fashioned programmer I am I don't like the idea of the framework slowing down my applications with uncessesary safety checks. So I decided to try and PInvoke into GDI+ directly so tweak some extra performance out of an application I am writing. But every time I try I get an...
14
3787
by: Mohamed Mansour | last post by:
Hey there, this will be somewhat a long post, but any response is appreciated! I have done many PInvoke in the past from C++ to C#, but I did PInvoke within C# not C++/CLI. Can someone explain more why C++/CLI would be better to PInvoke than doing the PInvoke in C#? Because, usually in C# as you already know we use DLLImport and extern
0
8913
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.