Содержание
- 2. Создание библиотеки динамической компоновки, реализующей заглушки IDL - язык определения интерфейса (Interface Definition Language) import "unknwn.idl";
- 3. [ uuid(10C1D956-B61A-4B2C-8795-58CA53298ADB), version(1.0), helpstring("CInput 1.0 Type Library") ] library InputLib { importlib("stdole32.tlb"); importlib("stdole2.tlb"); //Component [ uuid(36C1D956-B61A-4B2C-8795-58CA53298ADB),
- 4. Компиляция .idl файла
- 5. Компоновка и регистрация proxy.dll LIBRARY Proxy.dll DESCRIPTION ‘Proxy/Stub DLL’ EXPORTS DllGetClassObject @1 PRIVATE DllCanUnloadNow @2 PRIVATE
- 6. STDMETHODIMP CInput::input(){ MessageBox(NULL, "Enter data","input Info", MB_OK); return S_OK; } STDMETHODIMP CInput::output(){ MessageBox(NULL, "Output data","output Info",
- 7. Изменения в коде сервера (код приложения input_exe.cpp): #include #include #include #include "guid.h" #include "CInput.h" IClassFactory* g_pClassFactory;
- 8. if (!hPrevInstance) { wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0
- 9. LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ static char str[80] = "It
- 10. BOOL Init(){ HRESULT hr; hr = CoInitialize(NULL); if (FAILED(hr)){ MessageBox(NULL, "CoInitialize failed", "CInput", MB_OK); return FALSE;
- 11. void UnInit() { if (g_dwRegister != 0) CoRevokeClassObject(g_dwRegister); if (g_pClassFactory != NULL) g_pClassFactory->Release(); CoUninitialize(); } Компоновка
- 12. Изменения в коде клиента (test2.cpp): #include #include #include #include "guids.c" #include "root.h" int main(){ ……………………………………………………………. DWORD
- 14. Скачать презентацию