View Single Post
Old 07-25-2003, 03:29 PM   #5 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,712
redhead is on a distinguished road
Quote:
Originally posted by sde
i want this app to catch the exceptions it throws out when it can't find the dll , or the dll successfully registers .. but i'm too n00b to know where to start.
Code:
#include <stdio.h>
# include <windows.h> 
#include <unistd.h>

int main()
{
   int ret=-5;
   if(!access("C:\\Program Files\\program\\file.dll", F_OK))
      ret=system("regsvr32 \"C:\\Program Files\\program\\file.dll\"");
   switch(ret)
   { 
     case -5:  
       printf("Dll file does not exist\n");
       return -1;
     case 0:
       printf("Successful return\n");
       return 0;
     default:
       printf("system call returned with errno: %s\n, WEXITSTATUS(ret));
       return ret;
   }
}
Quote:

if it can't put find the dll, i'd like to allow the user to define the path to the file.
Dont know if there is any way to get a dialogue with the user without some interaction from the lower level runtime machine in .NET, else just make it a dos like app, asking on stdout and reading from stdin..
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote