Disable virtual com port (arduino software)


I have a Pro Micro (from Sparkfun) that i use in combination with the Arduino IDE.

In my code i am using the Keyboard.write('...') function to send characters to my computer. This is a function of the Arduino library. The microcontroller identifies itself as a HID Keyboard over USB. This all works fine but...

My problem is that de microcontroller also creates a virtual com port. I want to disable the virtual com port so when you plug in the USB cable, the computer only installs the HID driver en not the virtual com port driver. To program the Pro Micro, i enter the bootloader mode manually (with the reset button). So i don't need the virtual com port that is always on in normal usage. How can i disable it?

[u]To make some things clear:[/u] When i plug in the Pro Micro, my computer shows COM port 9. When i enter bootloader mode (to upload the software), COM port 9 goes away, and a new COM port 5 is showed. I want to remove the COM port 9. When i upload a blank sketch to the Pro Micro, it will also show the COM port 9 in normal mode. But when i upload a blank project with AVR studio, the Pro Micro will not show the COM port 9. So this com port is programmed somewhere in the Arduino "hidden" code.

Thanks for your help :)

I want to revive this thread because I'm looking for the same thing.

The initialization of the Virtual COM Port has to be found in the arduino-libraries because I assume it's actively implemented into the binaries. If anyone please could tell us where the specific code is hidden, that would be great ;)

Edit: @cs123 It might work for you to use USBDevice.detach(); Because it deactivates the COM Port. But I don't know if it's gonna affect your Keyboard-communication.