home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / mswindo / programm / tools / 1385 < prev    next >
Encoding:
Text File  |  1992-11-10  |  1.9 KB  |  73 lines

  1. Path: sparky!uunet!dtix!darwin.sura.net!jvnc.net!news.edu.tw!ccds3.ntu.edu.tw!ccms!d9502001
  2. From: d9502001@ccms.ntu.edu.tw (Jih-Chung Lee)
  3. Newsgroups: comp.os.ms-windows.programmer.tools
  4. Subject: VB and Watcom C/386 32 Bits DLL, Help !
  5. Message-ID: <1992Nov10.130927.19256@ccds3.ntu.edu.tw>
  6. Date: 10 Nov 92 13:09:27 GMT
  7. Sender: usenet@ccds3.ntu.edu.tw (USENET PROXY ACCOUNT)
  8. Organization: NTUTaiwan
  9. Lines: 60
  10. Nntp-Posting-Host: ccms.ntu.edu.tw
  11. X-Newsreader: TIN [version 1.1 PL6]
  12.  
  13.  
  14. Hi,
  15.   I intended  to call a 32 Bits DLL that Watcom C/386 created from VB, but
  16. VB responsed with "Error in loading DLL". Since there was a message box DLL
  17. created on screen. So I was quiet sure that the DLL had been loaded and 
  18. executed by windows. My PC run Windows 3.1 ,VB 1.0 and Watcom 9.01/C386.
  19. The following lines are Watcom command line, VB program and releated files.
  20. any comments will be appreciated.
  21.  
  22.  
  23. Watcom C9.01/386 compile, link, bind.
  24.  
  25.     wcc386 dll32 /zw
  26.     wlink @dll32
  27.     wbind dll32 -d -n
  28.  
  29. Visual Basic 1.0 program.
  30.  
  31.     Declare Function Win386LibEntry Lib "dll32.dll"  (ByVal a,ByVal b) As a Integer
  32.  
  33.     Sub Command1_Click()
  34.        v = Win386LibEntry(1,1)
  35.        text1.Text = Str$(v)
  36.     Sub End
  37.  
  38. ********* file dll32.c :  **********
  39. /*
  40.  *  DLL32.C
  41.  */
  42. #include <windows.h>    /* required for all Windows applications */
  43. #include <dos.h>
  44.  
  45. int FAR PASCAL Lib1( WORD w1 )
  46. {
  47.   char buf[128];
  48.  
  49.   sprintf( buf, "Lib1: w1=%hx", w1);
  50.   MessageBox( NULL, buf, "DLL32", MB_OK | MB_TASKMODAL );
  51.   return( 2*w1);
  52. }
  53.  
  54. int PASCAL WinMain( HANDLE hInstance, HANDLE x1, LPSTR lpCmdLine, int x2 )
  55. {
  56.   short i;
  57.   char buf[128];
  58.  
  59.   DefineDLLEntry( 1, (void *) Lib1, DLL_WORD,DLL_ENDLIST);
  60.   sprintf( buf, "DLL32 Started");
  61.   MessageBox( NULL, buf, "DLL32", MB_OK | MB_TASKMODAL );
  62.   return( 1 );
  63. }
  64.  
  65. ******* dll32.lnk ********
  66. debug all
  67. system win386
  68. file dll32
  69. option map
  70. option stack=12K
  71. option maxdata=8K
  72. option mindata=4K
  73.