home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4729 < prev    next >
Encoding:
Text File  |  1993-01-07  |  1.9 KB  |  54 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!agate!rsoft!mindlink!a4185
  3. From: Steve_Goyette@mindlink.bc.ca (Steve Goyette)
  4. Subject: Undefinied Dynalink ... The Sequel
  5. Organization: MIND LINK! - British Columbia, Canada
  6. Date: Fri, 8 Jan 1993 01:09:05 GMT
  7. Message-ID: <19351@mindlink.bc.ca>
  8. Sender: news@deep.rsoft.bc.ca (Usenet)
  9. Lines: 43
  10.  
  11. Sorry, but I think that my editor screwed up the code fragment, so here it is
  12. again:
  13.  
  14.         char szPrinter[64],
  15. szSysDir[128],szFullDriver[256],*szDriver,*szDevice,*szOutput;
  16.         HANDLE hDriver;
  17.         DEVMODE DevMode;
  18.         LPFNDEVMODE lpDeviceMode;
  19.  
  20.         GetProfileString("windows","device","",szPrinter,64);
  21.         szDevice = strtok(szPrinter,",");
  22.         szDriver = strtok(NULL,",");
  23.         szOutput = strtok(NULL,",");
  24.  
  25.         GetSystemDirectory(szSysDir,128);
  26.         lstrcpy(szFullDriver,szSysDir);
  27.         lstrcat(szFullDriver,"\");
  28.         lstrcat(szFullDriver,szDriver);
  29.         lstrcat(szFullDriver,".DRV");
  30.  
  31.         hDriver = LoadLibrary(szFullDriver);
  32.         if (hDriver != NULL)
  33.         {
  34.  
  35.                 lpDeviceMode =
  36. (LPFNDEVMODE)GetProcAddress((HINSTANCE)hDriver,"ExtDeviceMode");
  37.                 if (lpDeviceMode)
  38.                         (* lpDeviceMode)
  39. (HWindow,(HINSTANCE)hDriver,&DevMode,szDevice,szOutput,NULL,NULL,DM_PROMPT |
  40. DM_UPDATE);
  41.         }
  42.         else
  43.                 MessageBox(HWindow,"Could not load driver
  44. file.","Error",MB_OK | MB_ICONEXCLAMATION);
  45.  
  46. --
  47. ------------------------------------------------------------------------------
  48.  
  49. Steve Goyette                    |       Email : Steve_Goyette@MindLink.BC.CA
  50. Software Engineer                |       Cserve: 71763,1435
  51. Abstract Automation Limited      |       Phone : (604) 421-8864
  52.                                  |       Fax   : (604) 421-7722 (Call first)
  53. -------------------------------------
  54.