Gateway and IP routing issue

Hi,

I have deveopled a C++/WMI based application. This application code is running on a
system with multiple network adapters. The problem is caused by assigning static default gateway to a network card. I load DHCP settings on one adapter and static settings on another. When I load a static address for Default Gateway, that takes the metric of 1 and is established as the default gateway. The gateway assigned by DHCP server to other NIC is given the second entry in the IP route table. I would like the default gateway assigned by DHCP to become the implemented or primary gateway. Because of this behavior I am unable to map a network drive.

Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 123.123.3.4 1.3.4.5 1 (entry 1)
0.0.0.0 0.0.0.0 192.68.1.1 192.62.1.3 10 (entry 2)

.......

Default Gateway: 123.123.3.4
===========================================================================

The entry number 2 in the table is assigned by DHCP server and I would like entry number two in the above table to become the default gateway. How can I do that programmatically?

To summarize, in a dual network card system, one network card is assigned to get IP settings from a DHCP server and other is statically assigned. The gateway assigned through static settings becomes the default gateway. However, I want DHCP assigned gateway to become the default gateway. How can I accomplish that? This has been puzzling me for days. This seemed like the best place to post this message. Sorry if I misplaced this post on a wrong forum.

Thanks for help

[1706 byte] By [one-trick-pony] at [2008-1-6]