Начал разбираться с .Net вообще и Clarion# в частности.
Даже книжку присмотрел, может быть даже куплю за деньги ...
Возник главный вопрос - принцип изоляции приложения в .Net в принципе исключает доступ к WinApi. Т.е. все что наработано с WinApi (HTTP, FTP, CryptoApi и т.д.) можно начинать делать заново ?! Старый код работы с WinApi под .Net работать не будет ?! Если это так - то это кошмар .... или я сам себя без причины пугаю ?
Все что нажито непосильным трудом .... ?
Модератор: Дед Пахом
Правила форума
При написании вопроса или обсуждении проблемы, не забывайте указывать версию Clarion который Вы используете.
А так же пользуйтесь спец. тегами при вставке исходников!!!
При написании вопроса или обсуждении проблемы, не забывайте указывать версию Clarion который Вы используете.
А так же пользуйтесь спец. тегами при вставке исходников!!!
- Игорь Столяров
- Ветеран движения
- Сообщения: 7409
- Зарегистрирован: 07 Июль 2005, 10:19
- Откуда: г. Ростов-на-ДоМу
- Благодарил (а): 16 раз
- Поблагодарили: 49 раз
- Admin
- Администратор
- Сообщения: 3962
- Зарегистрирован: 05 Июль 2005, 15:59
- Откуда: Хабаровск
- Благодарил (а): 27 раз
- Поблагодарили: 22 раза
- Контактная информация:
Platform Invocation Service Support (PInvoke)
Смотрим справку в Clarion.Net
Platform Invocation Services (PInvoke) allows managed code (code executed by the Common Language Runtime) to call unmanaged functions (i.e., COM components, ActiveX components, Win32 API, etc.) that are implemented in a DLL.
Calling external functions that reside in a DLL uses the Platform Invoke service. It locates and invokes an exported function and marshals (e.g., arranges in a methodical order) its arguments (integers, strings, arrays, structures, and so on) across the interoperation boundary as needed.
To call external procedure you should specify the DLL name and entry point with .NET's DllImportAttribute attribute in the MAP. It uses the default PInvoke marshaling mechanisms, as result, you can only use .Net data types as parameters. There is no specific marshaling behavior support for Clarion-specific types (i.e. CLADECIMAL, CLASTRING, CSTRING, PSTRING, ASTRING).
To customize the default marshaling behavior you can use MarshalAsAttribute (see .Net Framework documentation for details).
Calling external functions in a DLL with Platform Invoke service can be done in two ways:
Clarion# includes support for the .NET's DllImportAttribute attribute:
Or using Clarion syntax:
Platform Invocation Services (PInvoke) allows managed code (code executed by the Common Language Runtime) to call unmanaged functions (i.e., COM components, ActiveX components, Win32 API, etc.) that are implemented in a DLL.
Calling external functions that reside in a DLL uses the Platform Invoke service. It locates and invokes an exported function and marshals (e.g., arranges in a methodical order) its arguments (integers, strings, arrays, structures, and so on) across the interoperation boundary as needed.
To call external procedure you should specify the DLL name and entry point with .NET's DllImportAttribute attribute in the MAP. It uses the default PInvoke marshaling mechanisms, as result, you can only use .Net data types as parameters. There is no specific marshaling behavior support for Clarion-specific types (i.e. CLADECIMAL, CLASTRING, CSTRING, PSTRING, ASTRING).
To customize the default marshaling behavior you can use MarshalAsAttribute (see .Net Framework documentation for details).
Calling external functions in a DLL with Platform Invoke service can be done in two ways:
Clarion# includes support for the .NET's DllImportAttribute attribute:
Код: Выделить всё
[DllImportAttribute("user32.dll", EntryPoint = "MessageBoxW")] MessageBox PROCEDURE(UNSIGNED hWnd, STRING Text, STRING Caption, UNSIGNED Type),SIGNED
Код: Выделить всё
MODULE('user32.dll')
MessageBox PROCEDURE(SIGNED h,ClaString msg,String cpt,SIGNED tp),SIGNED
END
Рай совершает ошибки ничуть не реже чем ад. Просто у него хорошая пресса