EXAMPLE.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <windows.h>
00035
00036
00037 #include "struct.h"
00038
00039
00040 #include "dstruct.h"
00041
00042
00043 #include "example.h"
00044
00045
00046 #if __X__MIPS__
00047 BOOL WINAPI _CRT_INIT(HINSTANCE ,DWORD , LPVOID );
00048 #endif
00049
00050 static BOOL CALLBACK ExampleDlgProc(HWND hwnd, UINT msg,
00051 WPARAM wparam, LPARAM lparam);
00052
00053 static HWND hParent;
00054 static HINSTANCE hThisInstance;
00055
00056
00057
00058
00059 #if __WATCOMC__
00060 int APIENTRY LibMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00061 #else
00062 BOOL WINAPI DllMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00063 #endif
00064 switch (dwReason) {
00065 case DLL_PROCESS_ATTACH: {
00066 hThisInstance=hDLL;
00067 #if __X__MIPS__
00068 if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00069 #endif
00070 MessageBox ( GetFocus(),
00071 (LPCTSTR) "Process attaching",
00072 (LPCTSTR) " ",
00073 MB_OK | MB_SYSTEMMODAL);
00074 break;
00075 }
00076 case DLL_PROCESS_DETACH:
00077 #if __X__MIPS__
00078 if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00079 #endif
00080 MessageBox ( GetFocus(),
00081 (LPCTSTR) "Process detaching",
00082 (LPCTSTR) "",
00083 MB_OK | MB_SYSTEMMODAL );
00084 break;
00085 }
00086 return TRUE;
00087 }
00088
00089 #if __SC__
00090 #pragma startaddress(DllMain)
00091 #endif
00092
00093
00094
00095 BOOL _Xmodeler
00096
00097 ( HWND parent_window,
00098 HWND info_window,
00099 X__STRUCTURE *lpevi
00100 ){
00101
00102
00103
00104
00105
00106
00107 lpEVI=lpevi;
00108
00109
00110
00111 if(DialogBox(hThisInstance,MAKEINTRESOURCE(DLG_EXAMPLE),GetFocus(),
00112 (DLGPROC)ExampleDlgProc) != OK)return FALSE;
00113
00114
00115
00116 return TRUE;
00117 }
00118
00119
00120
00121
00122
00123 static BOOL CALLBACK ExampleDlgProc(HWND hwnd, UINT msg,
00124 WPARAM wparam, LPARAM lparam){
00125 int i;
00126 BOOL err;
00127 switch( msg ) {
00128 case WM_INITDIALOG:
00129 return (TRUE);
00130 case WM_COMMAND:
00131 switch(LOWORD(wparam)){
00132 case DLG_EXAMPLE_CANCEL:
00133 EndDialog(hwnd,FAIL);
00134 return(TRUE);
00135 case DLG_EXAMPLE_OK:
00136 EndDialog(hwnd,OK);
00137 return(TRUE);
00138 default:
00139 break;
00140 }
00141 break;
00142 default: break;
00143 }
00144 return(FALSE);
00145 }
00146