|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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!
|
|
#2
|
||||
|
||||
|
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");
}
|
|
#3
|
|||
|
|||
|
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? |
|
#4
|
||||
|
||||
|
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.
|
|
#5
|
|||
|
|||
|
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!! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Opening ODBC DSN Admin |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|