C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 12th, 2002, 08:47 AM
JillyT JillyT is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 0 JillyT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Opening ODBC DSN Admin

I'm new to Visual C++ and would like to know if there is a way to open the ODBC data source administrator from a button in a dialog box. Or to open an arbitrary .exe from a VC++ app in general cause I know the Admin can be opened using c:\WINNT\System32\odbcad32.exe on a Windows 2000 box. Any hints would be much appreciated!

Reply With Quote
  #2  
Old July 12th, 2002, 10:39 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 36 m 16 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
to execute any command that you would do from the command line can be done with the system() function.
It should be in the stdlib.h header.
i.e.
Code:
#include <stdlib.h>

int main () {
    return system("c:\WINNT\System32\odbcad32.exe");
}

Reply With Quote
  #3  
Old July 16th, 2002, 09:09 AM
JillyT JillyT is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 0 JillyT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks sooooooo much...don't know how many days I went searching on the net for that. So simple too. Problem now is...I'm using Visual C++ and calling the function when a button is pressed:

void CDBManager::OnOdbc()
{
system("c:\\WINNT\\System32\\odbcad32.exe");

}

This works great except that a DOS window also opens behind the ODBC Data Source Admin window for the cmd.exe system call. Know how to prevent this or close it?

Reply With Quote
  #4  
Old July 16th, 2002, 09:13 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 36 m 16 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
No, not right off hand, you might want to search msdn about how to get an applications handle. I know it is possible, but just don't remember all the specifics about it. But you would get the cmd windows handle and then you can close it.

Reply With Quote
  #5  
Old July 16th, 2002, 09:23 AM
JillyT JillyT is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 0 JillyT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile

For anyone else who is interested, you can also use:

HWND screen = ::GetDesktopWindow();

ShellExecute(screen, "open", "c:\\WINNT\\System32\\odbcad32.exe", NULL, NULL, SW_SHOWNORMAL);

And there is no DOS window displayed. Thanks for everyone's help!!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Opening ODBC DSN Admin


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT