全然更新しないブログ
HSPメモ帳
mod_HostCLR.hsp
mod_HostCLR.hsp
#ifndef MOD_HOSTCLR_HSP_ #define global MOD_HOSTCLR_HSP_ #ifndef CLRCreateInstance #uselib "MSCorEE.dll" #func global CLRCreateInstance "CLRCreateInstance" var,var,var #func global CorBindToRuntimeEx "CorBindToRuntimeEx" int,int,int,var,var,var #func global GetCORRequiredVersion "GetCORRequiredVersion" var,int,var #func global GetCORSystemDirectory "GetCORSystemDirectory" var,int,var #func global GetCORVersion "GetCORVersion" var,int,var #func global GetRequestedRuntimeInfo "GetRequestedRuntimeInfo" int,int,int,int,int,var,int,var,var,int,var #endif #ifndef ICorRuntimeHost #define global IID_ICorRuntimeHost "{CB2F6722-AB3A-11d2-9C40-00C04FA30A3E}" #define global CLSID_CorRuntimeHost "{CB2F6723-AB3A-11d2-9C40-00C04FA30A3E}" #usecom global ICorRuntimeHost IID_ICorRuntimeHost CLSID_CorRuntimeHost #comfunc global ICorRuntimeHost_CreateLogicalThreadState 3 #comfunc global ICorRuntimeHost_DeleteLogicalThreadState 4 #comfunc global ICorRuntimeHost_SwitchInLogicalThreadState 5 var #comfunc global ICorRuntimeHost_SwitchOutLogicalThreadState 6 var #comfunc global ICorRuntimeHost_LocksHeldByLogicalThread 7 var #comfunc global ICorRuntimeHost_MapFile 8 int,var #comfunc global ICorRuntimeHost_GetConfiguration 9 var #comfunc global ICorRuntimeHost_Start 10 #comfunc global ICorRuntimeHost_Stop 11 #comfunc global ICorRuntimeHost_CreateDomain 12 wstr,int,var #comfunc global ICorRuntimeHost_GetDefaultDomain 13 var #comfunc global ICorRuntimeHost_EnumDomains 14 var #comfunc global ICorRuntimeHost_NextDomain 15 int,var #comfunc global ICorRuntimeHost_CloseEnum 16 int #comfunc global ICorRuntimeHost_CreateDomainEx 17 wstr,int,int,var #comfunc global ICorRuntimeHost_CreateDomainSetup 18 var #comfunc global ICorRuntimeHost_CreateEvidence 19 var #comfunc global ICorRuntimeHost_UnloadDomain 20 int #comfunc global ICorRuntimeHost_CurrentDomain 21 var #endif #ifndef ICLRMetaHost #define global IID_ICLRMetaHost "{D332DB9E-B9B3-4125-8207-A14884F53216}" #define global CLSID_CLRMetaHost "{9280188D-0E8E-4867-B30C-7FA83884E8DE}" #usecom global ICLRMetaHost IID_ICLRMetaHost CLSID_CLRMetaHost #comfunc global ICLRMetaHost_GetRuntime 3 wstr,var,var #comfunc global ICLRMetaHost_GetVersionFromFile 4 wstr,var,var #comfunc global ICLRMetaHost_EnumerateInstalledRuntimes 5 var #comfunc global ICLRMetaHost_EnumerateLoadedRuntimes 6 int,var #comfunc global ICLRMetaHost_RequestRuntimeLoadedNotification 7 int #comfunc global ICLRMetaHost_QueryLegacyV2RuntimeBinding 8 var,var #comfunc global ICLRMetaHost_ExitProcess 9 int #endif #ifndef ICLRRuntimeInfo #define global IID_ICLRRuntimeInfo "{BD39D1D2-BA2F-486a-89B0-B4B0CB466891}" #usecom global ICLRRuntimeInfo IID_ICLRRuntimeInfo "{}" #comfunc global ICLRRuntimeInfo_GetVersionString 3 var,var #comfunc global ICLRRuntimeInfo_GetRuntimeDirectory 4 var,var #comfunc global ICLRRuntimeInfo_IsLoaded 5 int,var #comfunc global ICLRRuntimeInfo_LoadErrorString 6 int,var,var,int #comfunc global ICLRRuntimeInfo_LoadLibrary 7 wstr,var #comfunc global ICLRRuntimeInfo_GetProcAddress 8 wstr,var #comfunc global ICLRRuntimeInfo_GetInterface 9 var,var,var #comfunc global ICLRRuntimeInfo_IsLoadable 10 var #comfunc global ICLRRuntimeInfo_SetDefaultStartupFlags 11 int,wstr #comfunc global ICLRRuntimeInfo_GetDefaultStartupFlags 12 var,var,var #comfunc global ICLRRuntimeInfo_BindAsLegacyV2Runtime 13 #comfunc global ICLRRuntimeInfo_IsStarted 14 var,var #endif #ifndef _AppDomain #define global IID__AppDomain "{05F696DC-2B29-3663-AD8B-C4389CF2A713}" #define global CLSID__AppDomain "{5FE0A145-A82B-3D96-94E3-FD214C9D6EB9}" #usecom global _AppDomain IID__AppDomain CLSID__AppDomain #comfunc global _AppDomain_ToString 7 int #comfunc global _AppDomain_Equals 8 int,int,int,int,var #comfunc global _AppDomain_GetHashCode 9 var #comfunc global _AppDomain_GetType 10 var #comfunc global _AppDomain_InitializeLifetimeService 11 var #comfunc global _AppDomain_GetLifetimeService 12 var #comfunc global _AppDomain_Evidence 13 var #comfunc global _AppDomain_add_DomainUnload 14 int #comfunc global _AppDomain_remove_DomainUnload 15 int #comfunc global _AppDomain_add_AssemblyLoad 16 int #comfunc global _AppDomain_remove_AssemblyLoad 17 int #comfunc global _AppDomain_add_ProcessExit 18 int #comfunc global _AppDomain_remove_ProcessExit 19 int #comfunc global _AppDomain_add_TypeResolve 20 int #comfunc global _AppDomain_remove_TypeResolve 21 int #comfunc global _AppDomain_add_ResourceResolve 22 int #comfunc global _AppDomain_remove_ResourceResolve 23 int #comfunc global _AppDomain_add_AssemblyResolve 24 int #comfunc global _AppDomain_remove_AssemblyResolve 25 int #comfunc global _AppDomain_add_UnhandledException 26 int #comfunc global _AppDomain_remove_UnhandledException 27 int #comfunc global _AppDomain_DefineDynamicAssembly 28 int,int,var #comfunc global _AppDomain_DefineDynamicAssembly_2 29 int,int,int,var #comfunc global _AppDomain_DefineDynamicAssembly_3 30 int,int,int,var #comfunc global _AppDomain_DefineDynamicAssembly_4 31 int,int,int,int,int,var #comfunc global _AppDomain_DefineDynamicAssembly_5 32 int,int,int,int,var #comfunc global _AppDomain_DefineDynamicAssembly_6 33 int,int,int,int,int,int,var #comfunc global _AppDomain_DefineDynamicAssembly_7 34 int,int,int,int,int,int,var #comfunc global _AppDomain_DefineDynamicAssembly_8 35 int,int,int,int,int,int,int,var #comfunc global _AppDomain_DefineDynamicAssembly_9 36 int,int,int,int,int,int,int,int,var #comfunc global _AppDomain_CreateInstance 37 int,int,var #comfunc global _AppDomain_CreateInstanceFrom 38 int,int,var #comfunc global _AppDomain_CreateInstance_2 39 int,int,int,var #comfunc global _AppDomain_CreateInstanceFrom_2 40 int,int,int,var #comfunc global _AppDomain_CreateInstance_3 41 int,int,int,int,int,int,int,int,int,var #comfunc global _AppDomain_CreateInstanceFrom_3 42 int,int,int,int,int,int,int,int,int,var #comfunc global _AppDomain_Load 43 int,var #comfunc global _AppDomain_Load_2 44 int,var #comfunc global _AppDomain_Load_3 45 int,var #comfunc global _AppDomain_Load_4 46 int,int,var #comfunc global _AppDomain_Load_5 47 int,int,int,var #comfunc global _AppDomain_Load_6 48 int,int,var #comfunc global _AppDomain_Load_7 49 int,int,var #comfunc global _AppDomain_ExecuteAssembly 50 int,int,var #comfunc global _AppDomain_ExecuteAssembly_2 51 int,var #comfunc global _AppDomain_ExecuteAssembly_3 52 int,int,int,var #comfunc global _AppDomain_FriendlyName 53 var #comfunc global _AppDomain_BaseDirectory 54 var #comfunc global _AppDomain_RelativeSearchPath 55 var #comfunc global _AppDomain_ShadowCopyFiles 56 var #comfunc global _AppDomain_GetAssemblies 57 var #comfunc global _AppDomain_AppendPrivatePath 58 int #comfunc global _AppDomain_ClearPrivatePath 59 #comfunc global _AppDomain_SetShadowCopyPath 60 int #comfunc global _AppDomain_ClearShadowCopyPath 61 #comfunc global _AppDomain_SetCachePath 62 int #comfunc global _AppDomain_SetData 63 int,int,int,int,int #comfunc global _AppDomain_GetData 64 int,var #comfunc global _AppDomain_SetAppDomainPolicy 65 int #comfunc global _AppDomain_SetThreadPrincipal 66 int #comfunc global _AppDomain_SetPrincipalPolicy 67 int #comfunc global _AppDomain_DoCallBack 68 int #comfunc global _AppDomain_DynamicDirectory 69 var #endif #ifndef AppDomainSetup #define global IID_IAppDomainSetup "{27FFF232-A7A8-40DD-8D4A-734AD59FCD41}" #define global CLSID_AppDomainSetup "{3E8E0F03-D3FD-3A93-BAE0-C74A6494DBCA}" #usecom global AppDomainSetup IID_IAppDomainSetup CLSID_AppDomainSetup #comfunc global AppDomainSetup_GetApplicationBase 3 var #comfunc global AppDomainSetup_SetApplicationBase 4 int #comfunc global AppDomainSetup_GetApplicationName 5 var #comfunc global AppDomainSetup_SetApplicationName 6 int #comfunc global AppDomainSetup_GetCachePath 7 var #comfunc global AppDomainSetup_SetCachePath 8 int #comfunc global AppDomainSetup_GetConfigurationFile 9 var #comfunc global AppDomainSetup_SetConfigurationFile 10 int #comfunc global AppDomainSetup_GetDynamicBase 11 var #comfunc global AppDomainSetup_SetDynamicBase 12 int #comfunc global AppDomainSetup_GetLicenseFile 13 var #comfunc global AppDomainSetup_SetLicenseFile 14 int #comfunc global AppDomainSetup_GetPrivateBinPath 15 var #comfunc global AppDomainSetup_SetPrivateBinPath 16 int #comfunc global AppDomainSetup_GetPrivateBinPathProbe 17 var #comfunc global AppDomainSetup_PrivateBinPathProbe 18 int #comfunc global AppDomainSetup_GetShadowCopyDirectories 19 var #comfunc global AppDomainSetup_SetShadowCopyDirectories 20 int #comfunc global AppDomainSetup_GetShadowCopyFiles 21 var #comfunc global AppDomainSetup_SetShadowCopyFiles 22 int #endif #ifndef _ObjectHandle #define global IID__ObjectHandle "{EA675B47-64E0-3B5F-9BE7-F7DC2990730D}" #define global CLSID__ObjectHandle "{ABEB0459-03B9-35AF-96E1-66BB7BC923F7}" #usecom global _ObjectHandle IID__ObjectHandle CLSID__ObjectHandle #comfunc global _ObjectHandle_ToString 7 var #comfunc global _ObjectHandle_Equals 8 int,int,int,int,var #comfunc global _ObjectHandle_GetHashCode 9 var #comfunc global _ObjectHandle_GetType 10 var #comfunc global _ObjectHandle_GetLifetimeService 11 var #comfunc global _ObjectHandle_InitializeLifetimeService 12 var #comfunc global _ObjectHandle_CreateObjRef 13 int,var #comfunc global _ObjectHandle_Unwrap 14 var #endif #ifndef _Object #define global IID__Object "{65074F7F-63C0-304E-AF0A-D51741CB4A8D}" #define global CLSID__OBJECT "{81C5FE01-027C-3E1C-98D5-DA9C9862AA21}" #usecom global _Object IID__Object CLSID__OBJECT #comfunc global _Object_ToString 7 var #comfunc global _Object_Equals 8 int,int,int,int,var #comfunc global _Object_GetHashCode 9 var #comfunc global _Object_GetType 10 var #endif #ifndef _Assembly #define global IID__Assembly "{17156360-2F1A-384A-BC52-FDE93C215C5B}" #define global CLSID__Assembly "{28E89A9F-E67D-3028-AA1B-E5EBCDE6F3C8}" #usecom global _Assembly IID__Assembly CLSID__Assembly #comfunc global _Assembly_ToString 7 var #comfunc global _Assembly_Equals 8 int,int,int,int,var #comfunc global _Assembly_GetHashCode 9 var #comfunc global _Assembly_GetType 10 var #comfunc global _Assembly_CodeBase 11 var #comfunc global _Assembly_EscapedCodeBase 12 var #comfunc global _Assembly_GetName 13 var #comfunc global _Assembly_GetName_2 14 int,var #comfunc global _Assembly_FullName 15 var #comfunc global _Assembly_EntryPoint 16 var #comfunc global _Assembly_GetType_2 17 int,var #comfunc global _Assembly_GetType_3 18 int,int,var #comfunc global _Assembly_GetExportedTypes 19 var #comfunc global _Assembly_GetTypes 20 var #comfunc global _Assembly_GetManifestResourceStream 21 int,int,var #comfunc global _Assembly_GetManifestResourceStream_2 22 int,var #comfunc global _Assembly_GetFile 23 int,var #comfunc global _Assembly_GetFiles 24 var #comfunc global _Assembly_GetFiles_2 25 int,var #comfunc global _Assembly_GetManifestResourceNames 26 var #comfunc global _Assembly_GetManifestResourceInfo 27 int,var #comfunc global _Assembly_Location 28 var #comfunc global _Assembly_Evidence 29 var #comfunc global _Assembly_GetCustomAttributes 30 int,int,var #comfunc global _Assembly_GetCustomAttributes_2 31 int,var #comfunc global _Assembly_IsDefined 32 int,int,var #comfunc global _Assembly_GetObjectData 33 int,int #comfunc global _Assembly_add_ModuleResolve 34 int #comfunc global _Assembly_remove_ModuleResolve 35 int #comfunc global _Assembly_GetType_4 36 int,int,int,var #comfunc global _Assembly_GetSatelliteAssembly 37 int,var #comfunc global _Assembly_GetSatelliteAssembly_2 38 int,int,var #comfunc global _Assembly_LoadModule 39 int,int,var #comfunc global _Assembly_LoadModule_2 40 int,int,int,var #comfunc global _Assembly_CreateInstance 41 int,var #comfunc global _Assembly_CreateInstance_2 42 int,int,var #comfunc global _Assembly_CreateInstance_3 43 int,int,int,int,int,int,int,var #comfunc global _Assembly_GetLoadedModules 44 var #comfunc global _Assembly_GetLoadedModules_2 45 int,var #comfunc global _Assembly_GetModules 46 var #comfunc global _Assembly_GetModules_2 47 int,var #comfunc global _Assembly_GetModule 48 int,var #comfunc global _Assembly_GetReferencedAssemblies 49 var #comfunc global _Assembly_GlobalAssemblyCache 50 var #endif #ifndef _Module #define global IID__Module "{D002E9BA-D9E3-3749-B1D3-D565A08B13E7}" #define global CLSID__Module "{128191C5-B188-3054-81B7-E4F588EACF0E}" #usecom global _Module IID__Module CLSID__Module #endif #ifndef _Type #define global IID__Type "{BCA8B44D-AAD6-3A86-8AB7-03349F4F2DA2}" #define global CLSID__Type "{6C9863DC-7207-327F-A048-C3BB63474BFC}" #usecom global _Type IID__Type CLSID__Type #comfunc global _Type_QueryInterface 0 var,var #comfunc global _Type_AddRef 1 #comfunc global _Type_Release 2 #comfunc global _Type_GetTypeInfoCount 3 var #comfunc global _Type_GetTypeInfo 4 int,int,int #comfunc global _Type_GetIDsOfNames 5 var,var,int,int,var #comfunc global _Type_Invoke 6 int,var,int,int,var,int,int,int #comfunc global _Type_ToString 7 var #comfunc global _Type_Equals 8 int,int,int,int,var #comfunc global _Type_GetHashCode 9 var #comfunc global _Type_GetType 10 var #comfunc global _Type_MemberType 11 var #comfunc global _Type_name 12 var #comfunc global _Type_DeclaringType 13 var #comfunc global _Type_ReflectedType 14 var #comfunc global _Type_GetCustomAttributes 15 int,int,var #comfunc global _Type_GetCustomAttributes_2 16 int,var #comfunc global _Type_IsDefined 17 int,int,var #comfunc global _Type_Guid 18 var #comfunc global _Type_Module 19 var #comfunc global _Type_Assembly 20 var #comfunc global _Type_TypeHandle 21 var #comfunc global _Type_FullName 22 var #comfunc global _Type_Namespace 23 var #comfunc global _Type_AssemblyQualifiedName 24 var #comfunc global _Type_GetArrayRank 25 var #comfunc global _Type_BaseType 26 var #comfunc global _Type_GetConstructors 27 int,var #comfunc global _Type_GetInterface 28 int,int,var #comfunc global _Type_GetInterfaces 29 var #comfunc global _Type_FindInterfaces 30 int,int,int,int,int,var #comfunc global _Type_GetEvent 31 int,int,var #comfunc global _Type_GetEvents 32 var #comfunc global _Type_GetEvents_2 33 int,var #comfunc global _Type_GetNestedTypes 34 int,var #comfunc global _Type_GetNestedType 35 int,int,var #comfunc global _Type_GetMember 36 int,int,int,var #comfunc global _Type_GetDefaultMembers 37 var #comfunc global _Type_FindMembers 38 int,int,int,int,int,int,int,var #comfunc global _Type_GetElementType 39 var #comfunc global _Type_IsSubclassOf 40 int,var #comfunc global _Type_IsInstanceOfType 41 int,int,int,int,var #comfunc global _Type_IsAssignableFrom 42 int,var #comfunc global _Type_GetInterfaceMap 43 int,var #comfunc global _Type_GetMethod 44 int,int,int,int,int,var #comfunc global _Type_GetMethod_2 45 int,int,var #comfunc global _Type_GetMethods 46 int,var #comfunc global _Type_GetField 47 int,int,var; #comfunc global _Type_GetFields 48 int,var #comfunc global _Type_GetProperty 49 int,int,var #comfunc global _Type_GetProperty_2 50 int,int,int,int,int,int,var #comfunc global _Type_GetProperties 51 int,var #comfunc global _Type_GetMember_2 52 int,int,var #comfunc global _Type_GetMembers 53 int,var #comfunc global _Type_InvokeMember 54 int,int,int,int,int,int,int,int,int,int,int,var #comfunc global _Type_UnderlyingSystemType 55 var #comfunc global _Type_InvokeMember_2 56 int,int,int,int,int,int,int,int,int,var #comfunc global _Type_InvokeMember_3 57 int,int,int,int,int,int,int,int,var #comfunc global _Type_GetConstructor 58 int,int,int,int,int,var #comfunc global _Type_GetConstructor_2 59 int,int,int,int,var #comfunc global _Type_GetConstructor_3 60 int,var #comfunc global _Type_GetConstructors_2 61 var #comfunc global _Type_TypeInitializer 62 var #comfunc global _Type_GetMethod_3 63 int,int,int,int,int,int,var #comfunc global _Type_GetMethod_4 64 int,int,int,var #comfunc global _Type_GetMethod_5 65 int,int,var #comfunc global _Type_GetMethod_6 66 int,var #comfunc global _Type_GetMethods_2 67 var #comfunc global _Type_GetField_2 68 int,var #comfunc global _Type_GetFields_2 69 var #comfunc global _Type_GetInterface_2 70 int,var #comfunc global _Type_GetEvent_2 71 int,var #comfunc global _Type_GetProperty_3 72 int,int,int,int,var #comfunc global _Type_GetProperty_4 73 int,int,int,var #comfunc global _Type_GetProperty_5 74 int,int,var #comfunc global _Type_GetProperty_6 75 int,int,var #comfunc global _Type_GetProperty_7 76 int,var #comfunc global _Type_GetProperties_2 77 var #comfunc global _Type_GetNestedTypes_2 78 var #comfunc global _Type_GetNestedType_2 79 int,var #comfunc global _Type_GetMember_3 80 int,var #comfunc global _Type_GetMembers_2 81 var #comfunc global _Type_Attributes 82 var #comfunc global _Type_IsNotPublic 83 var #comfunc global _Type_IsPublic 84 var #comfunc global _Type_IsNestedPublic 85 var #comfunc global _Type_IsNestedPrivate 86 var #comfunc global _Type_IsNestedFamily 87 var #comfunc global _Type_IsNestedAssembly 88 var #comfunc global _Type_IsNestedFamANDAssem 89 var #comfunc global _Type_IsNestedFamORAssem 90 var #comfunc global _Type_IsAutoLayout 91 var #comfunc global _Type_IsLayoutSequential 92 var #comfunc global _Type_IsExplicitLayout 93 var #comfunc global _Type_IsClass 94 var #comfunc global _Type_IsInterface 95 var #comfunc global _Type_IsValueType 96 var #comfunc global _Type_IsAbstract 97 var #comfunc global _Type_IsSealed 98 var #comfunc global _Type_IsEnum 99 var #comfunc global _Type_IsSpecialName 100 var #comfunc global _Type_IsImport 101 var #comfunc global _Type_IsSerializable 102 var #comfunc global _Type_IsAnsiClass 103 var #comfunc global _Type_IsUnicodeClass 104 var #comfunc global _Type_IsAutoClass 105 var #comfunc global _Type_IsArray 106 var #comfunc global _Type_IsByRef 107 var #comfunc global _Type_IsPointer 108 var #comfunc global _Type_IsPrimitive 109 var #comfunc global _Type_IsCOMObject 110 var #comfunc global _Type_HasElementType 111 var #comfunc global _Type_IsContextful 112 var #comfunc global _Type_IsMarshalByRef 113 var #comfunc global _Type_Eauals_2 114 int,var #endif #ifndef _MemberInfo #define global IID__MemberInfo "{F7102FA9-CABB-3A74-A6DA-B4567EF1B079}" #define global CLSID__MemberInfo "{5AE028B5-9A3A-32A9-899C-1DEEFB85CC50}" #usecom global _MemberInfo IID__MemberInfo CLSID__MemberInfo #comfunc global _MemberInfo_ToString 7 var #comfunc global _MemberInfo_Equals 8 int,int,int,int,var #comfunc global _MemberInfo_GetHashCode 9 var #comfunc global _MemberInfo_GetType 10 var #comfunc global _MemberInfo_MemberType 11 var #comfunc global _MemberInfo_name 12 var #comfunc global _MemberInfo_DeclaringType 13 var #comfunc global _MemberInfo_ReflectedType 14 var #comfunc global _MemberInfo_GetCustomAttributes 15 int,int,var #comfunc global _MemberInfo_GetCustomAttributes_2 16 int,var #comfunc global _MemberInfo_IsDefined 17 int,int,var #endif #ifndef _PropertyInfo #define global IID__PropertyInfo "{F59ED4E4-E68F-3218-BD77-061AA82824BF}" #define global CLSID__PropertyInfo "{BFDF1F57-230D-394A-B773-D9EC58CBEF9A}" #usecom global _PropertyInfo IID__PropertyInfo CLSID__PropertyInfo #comfunc global _PropertyInfo_ToString 7 var #comfunc global _PropertyInfo_Equals 8 int,int,int,int,var #comfunc global _PropertyInfo_GetHashCode 9 var #comfunc global _PropertyInfo_GetType 10 var #comfunc global _PropertyInfo_MemberType 11 var #comfunc global _PropertyInfo_name 12 var #comfunc global _PropertyInfo_DeclaringType 13 var #comfunc global _PropertyInfo_ReflectedType 14 var #comfunc global _PropertyInfo_GetCustomAttributes 15 int,int,var #comfunc global _PropertyInfo_GetCustomAttributes_2 16 int,var #comfunc global _PropertyInfo_IsDefined 17 int,int,var #comfunc global _PropertyInfo_PropertyType 18 var #comfunc global _PropertyInfo_GetValue 19 int,int,int,int,int,var #comfunc global _PropertyInfo_GetValue_2 20 int,int,int,int,int,int,int,int,var #comfunc global _PropertyInfo_SetValue 21 int,int,int,int,int,int,int,int,int #comfunc global _PropertyInfo_SetValue_2 22 int,int,int,int,int,int,int,int,int,int,int,int #comfunc global _PropertyInfo_GetAccessors 23 int,var #comfunc global _PropertyInfo_GetGetMethod 24 int,var #comfunc global _PropertyInfo_GetSetMethod 25 int,var #comfunc global _PropertyInfo_GetIndexParameters 26 var #comfunc global _PropertyInfo_Attributes 27 var #comfunc global _PropertyInfo_CanRead 28 var #comfunc global _PropertyInfo_CanWrite 29 var #comfunc global _PropertyInfo_GetAccessors_2 30 var #comfunc global _PropertyInfo_GetGetMethod_2 31 var #comfunc global _PropertyInfo_GetSetMethod_2 32 var #comfunc global _PropertyInfo_IsSpecialName 33 var #endif #ifndef _FieldInfo #define global IID__FieldInfo "{8A7C1442-A9FB-366B-80D8-4939FFA6DBE0}" #define global CLSID__FieldInfo "{98BA57DC-4CF2-3ED1-B4A2-890C21BBBF4B}" #usecom global _FieldInfo IID__FieldInfo CLSID__FieldInfo #comfunc global _FieldInfo_ToString 7 var #comfunc global _FieldInfo_Equals 8 int,int,int,int,var #comfunc global _FieldInfo_GetHashCode 9 var #comfunc global _FieldInfo_GetType 10 var #comfunc global _FieldInfo_MemberType 11 var #comfunc global _FieldInfo_name 12 var #comfunc global _FieldInfo_DeclaringType 13 var #comfunc global _FieldInfo_ReflectedType 14 var #comfunc global _FieldInfo_GetCustomAttributes 15 int,int,var #comfunc global _FieldInfo_GetCustomAttributes_2 16 int,var #comfunc global _FieldInfo_IsDefined 17 int,int,var #comfunc global _FieldInfo_FieldType 18 var #comfunc global _FieldInfo_GetValue 19 int,int,int,int,var #comfunc global _FieldInfo_GetValueDirect 20 int,int,int,int,var #comfunc global _FieldInfo_SetValue 21 int,int,int,int,int,int,int,int,int,int,int #comfunc global _FieldInfo_SetValueDirect 22 int,int,int,int,int,int,int,int #comfunc global _FieldInfo_FieldHandle 23 var #comfunc global _FieldInfo_Attributes 24 var #comfunc global _FieldInfo_SetValue_2 25 int,int,int,int,int,int,int,int #comfunc global _FieldInfo_IsPublic 26 var #comfunc global _FieldInfo_IsPrivate 27 var #comfunc global _FieldInfo_IsFamily 28 var #comfunc global _FieldInfo_IsAssembly 29 var #comfunc global _FieldInfo_IsFamilyAndAssembly 30 var #comfunc global _FieldInfo_IsFamilyOrAssembly 31 var #comfunc global _FieldInfo_IsStatic 32 var #comfunc global _FieldInfo_IsInitOnly 33 var #comfunc global _FieldInfo_IsLiteral 34 var #comfunc global _FieldInfo_IsNotSerialized 35 var #comfunc global _FieldInfo_IsSpecialName 36 var #comfunc global _FieldInfo_IsPinvokeImpl 37 var #endif #ifndef _MethodInfo #define global IID__MethodInfo "{FFCC1B5D-ECB8-38DD-9B01-3DC8ABC2AA5F}" #define global CLSID__MethodInfo "{0E22CC27-CA1E-3138-9640-BE831F721659}" #usecom global _MethodInfo IID__MethodInfo CLSID__MethodInfo #comfunc global _MethodInfo_ToString 7 var #comfunc global _MethodInfo_Equals 8 int,int,int,int,var #comfunc global _MethodInfo_GetHashCode 9 var #comfunc global _MethodInfo_GetType 10 var #comfunc global _MethodInfo_MemberType 11 var #comfunc global _MethodInfo_name 12 var #comfunc global _MethodInfo_DeclaringType 13 var #comfunc global _MethodInfo_ReflectedType 14 var #comfunc global _MethodInfo_GetCustomAttributes 15 int,int,var #comfunc global _MethodInfo_GetCustomAttributes_2 16 int,var #comfunc global _MethodInfo_IsDefined 17 int,int,var #comfunc global _MethodInfo_GetParameters 18 var #comfunc global _MethodInfo_GetMethodImplementationFlags 19 var #comfunc global _MethodInfo_MethodHandle 20 var #comfunc global _MethodInfo_Attributes 21 var #comfunc global _MethodInfo_CallingConvention 22 var #comfunc global _MethodInfo_Invoke_2 23 int,int,int,int,int,int,int,int,var #comfunc global _MethodInfo_IsPublic 24 var #comfunc global _MethodInfo_IsPrivate 25 var #comfunc global _MethodInfo_IsFamily 26 var #comfunc global _MethodInfo_IsAssembly 27 var #comfunc global _MethodInfo_IsFamilyAndAssembly 28 var #comfunc global _MethodInfo_IsFamilyOrAssembly 29 var #comfunc global _MethodInfo_IsStatic 30 var #comfunc global _MethodInfo_IsFinal 31 var #comfunc global _MethodInfo_IsVirtual 32 var #comfunc global _MethodInfo_IsHideBySig 33 var #comfunc global _MethodInfo_IsAbstract 34 var #comfunc global _MethodInfo_IsSpecialName 35 var #comfunc global _MethodInfo_IsConstructor 36 var #comfunc global _MethodInfo_Invoke_3 37 int,int,int,int,int,var #comfunc global _MethodInfo_returnType 38 var #comfunc global _MethodInfo_ReturnTypeCustomAttributes 39 var #comfunc global _MethodInfo_GetBaseDefinition 40 var #endif #ifndef _ParameterInfo #define global IID__ParameterInfo "{993634C4-E47A-32CC-BE08-85F567DC27D6}" #define global CLSID__ParameterInfo "{E5CE8078-0CA7-3578-80DB-F20FCA8786A6}" #usecom global _ParameterInfo IID__ParameterInfo CLSID__ParameterInfo #comfunc global _ParameterInfo_GetTypeInfoCount 3 var #comfunc global _ParameterInfo_GetTypeInfo 4 int,int,int #comfunc global _ParameterInfo_GetIDsOfNames 5 var,var,int,int,var #comfunc global _ParameterInfo_Invoke 6 int,var,int,int,var,int,int,int #endif #endif // MOD_HOSTCLR_HSP_
コメント ( 0 ) | Trackback ( 0 )
ImageCapture
SetLayeredWindowAttributes
SetLayeredWindowAttributes関数の第2引数に指定するカラーキーが、
青と赤の値が同じ場合と違う場合で挙動が変わる。DWM上での仕様?
青と赤の値が同じ場合と違う場合で挙動が変わる。DWM上での仕様?
- 青と赤が同じ値
SetLayeredWindowAttributes hWnd, 0x110011, 0, LWA_COLORKEY - 色が0x110011の場合、透明化。クリック時、後ろのウィンドウに通知。
- 色が0x110011以外の場合、不透明化。クリック時、hWndに通知。
- 青と赤が違う値
SetLayeredWindowAttributes hWnd, 0x110022, 0, LWA_COLORKEY - 色が0x110022の場合、透明化。クリック時、hWndに通知。
- 色が0x220011の場合、不透明化。クリック時、後ろのウィンドウに通知。
- 色が0x110022、0x220011以外の場合、不透明化。クリック時、hWndに通知。
bgscr + WS_THICKFRAME
bgscrをサイズ変更可能にした時、クライアントエリア上部に空白が表示される。
DWM上での仕様?
改善例は、ImageCapture.hsp内のmod_Bgscr2参照。
改善例は、ImageCapture.hsp内のmod_Bgscr2参照。

#include "user32.as" bgscr 0, 300, 200 SetWindowLong hwnd, -16, 0x90040000 color : boxf : color 255, 255, 255 mes "左クリック:移動 右クリック:終了" oncmd gosub *WM_LBUTTONDONW, 0x0201 oncmd *WM_RBUTTONUP, 0x205 stop *WM_LBUTTONDONW sendmsg hwnd, 0xa1, 2, 0 return *WM_RBUTTONUP end
ImageCapture.hsp
- 概要
- 画面上の任意のサイズイメージをコピー、保存(JPG固定)。
- 操作
- 左クリック 左クリックドラッグでウィンドウ移動。
- 右クリック ポップアップメニュー表示
- 左ダブルクリック イメージのコピーと表示の切り替え。
- ホイール イメージを拡大・縮小。
- ホイールクリック 前面表示切り替え。
- ホイール イメージを拡大・縮小。
- ポップアップメニュー
- コピー ウィンドウ内に表示されているイメージをコピー。
- 表示 コピーを破棄して、ウィンドウ内を透過。
- 新規 新しいウィンドウを作成。
- 保存 イメージの保存。
- 通常サイズ 拡大率を100%に戻す。
- 前面表示 常に前面に表示する。
- 閉じる ウィンドウを閉じる。最後のウィンドウの場合、終了。
- 終了 アプリケーションの終了。
- その他
- WIC、Direct2Dを使用。
- screen, bgscr命令直後のシステム変数hwndが、別のウィンドウハンドルに変わっている事がある。 とりあえず、gselで対応。
/* --------------------------------------------------------- #include --------------------------------------------------------- */ #include "user32.as" #include "kernel32.as" #include "gdi32.as" /* --------------------------------------------------------- #uselib --------------------------------------------------------- */ #uselib "dwmapi.dll" #func global DwmExtendFrameIntoClientArea "DwmExtendFrameIntoClientArea" int,var #uselib "d2d1.dll" #func global D2D1CreateFactory "D2D1CreateFactory" int,var,int,var /* --------------------------------------------------------- #usecom --------------------------------------------------------- */ #define global IID_IWICImagingFactory "{ec5ec8a9-c395-4314-9c77-54d7a935ff70}" #define global CLSID_WICImagingFactory "{cacaf262-9370-4615-a13b-9f5539da4c0a}" #usecom global IWICImagingFactory IID_IWICImagingFactory CLSID_WICImagingFactory #comfunc global IWICImagingFactory_CreateEncoder 8 var,int,var #comfunc global IWICImagingFactory_CreateFormatConverter 10 var #comfunc global IWICImagingFactory_CreateStream 14 var #comfunc global IWICImagingFactory_CreateBitmapFromHBITMAP 21 int,int,int,var #define global IID_IWICBitmap "{00000121-a8f2-4877-ba0a-fd2b6645fb94}" #usecom global IWICBitmap IID_IWICBitmap "{}" #define global IID_IWICFormatConverter "{00000301-a8f2-4877-ba0a-fd2b6645fb94}" #usecom global IWICFormatConverter IID_IWICFormatConverter "{}" #comfunc global IWICFormatConverter_GetSize 3 var,var #comfunc global IWICFormatConverter_Initialize 8 int,var,int,int,double,int #define global IID_IWICStream "{135FF860-22B7-4ddf-B0F6-218F4F299A43}" #usecom global IWICStream IID_IWICStream "{}" #comfunc global IWICStream_InitializeFromFilename 15 wstr,int #define global IID_IWICBitmapEncoder "{00000103-a8f2-4877-ba0a-fd2b6645fb94}" #usecom global IWICBitmapEncoder IID_IWICBitmapEncoder "{}" #comfunc global IWICBitmapEncoder_Initialize 3 int,int #comfunc global IWICBitmapEncoder_CreateNewFrame 10 var,var #comfunc global IWICBitmapEncoder_Commit 11 #comfunc global IWICBitmapEncoder_GetMetadataQueryWriter 12 var #define global IID_IWICBitmapFrameEncode "{00000105-a8f2-4877-ba0a-fd2b6645fb94}" #usecom global IWICBitmapFrameEncode IID_IWICBitmapFrameEncode "{}" #comfunc global IWICBitmapFrameEncode_Initialize 3 int #comfunc global IWICBitmapFrameEncode_WriteSource 11 int,var #comfunc global IWICBitmapFrameEncode_Commit 12 #comfunc global IWICBitmapFrameEncode_GetMetadataQueryWriter 13 var #define global IID_IWICMetadataQueryWriter "{A721791A-0DEF-4d06-BD91-2118BF1DB10B}" #usecom global IWICMetadataQueryWriter IID_IWICMetadataQueryWriter "{}" #comfunc global IWICMetadataQueryWriter_SetMetadataByName 7 wstr,var #define global IID_IPropertyBag2 "{22F55882-280B-11d0-A8A9-00A0C90C2004}" #usecom global IPropertyBag2 IID_IPropertyBag2 "{}" #comfunc global IPropertyBag2_Read 3 int,var,int,var,var #comfunc global IPropertyBag2_Write 4 int,var,var #ifndef IID_ID2D1Factory #define global IID_ID2D1Factory "{06152247-6F50-465A-9245-118BFD3B6007}" #usecom global ID2D1Factory IID_ID2D1Factory "{}" #comfunc global ID2D1Factory_CreateDCRenderTarget 16 var,var #ifndef IID_ID2D1DCRenderTarget #define global IID_ID2D1DCRenderTarget "{1c51bc64-de61-46fd-9899-63a5d8f03950}" #usecom global ID2D1DCRenderTarget IID_ID2D1DCRenderTarget "{}" #comfunc global ID2D1DCRenderTarget_CreateBitmapFromWicBitmap 5 int,int,var #comfunc global ID2D1DCRenderTarget_DrawBitmap 26 int,int,int,int,int #comfunc global ID2D1DCRenderTarget_Clear 47 var #comfunc global ID2D1DCRenderTarget_BeginDraw 48 #comfunc global ID2D1DCRenderTarget_EndDraw 49 int,int #comfunc global ID2D1DCRenderTarget_BindDC 57 int,var #ifndef ID2D1Bitmap #define global IID_ID2D1Bitmap "{a2296057-ea42-4099-983b-539fb6505426}" #usecom global ID2D1Bitmap IID_ID2D1Bitmap "{}" /* --------------------------------------------------------- mod_Bgscr2 --------------------------------------------------------- */ #module mod_Bgscr2 #deffunc Bgscr2Ex int id, int w2, int h2, int mode, int x, int y, int w, int h if ( nHit == 0 ){ dim pt, 2 : dim rc, 4 : dim nHit, 3, 3 nHit(0, 0) = 13, 12, 14 nHit(0, 1) = 10, 1, 11 nHit(0, 2) = 16, 15, 17 dim rcFrm, 4 AdjustWindowRectEx varptr(rcFrm), 0x94040000, 0, 0 rcFrm(0) *= -1 : rcFrm(1) *= -1 } bgscr id, w2, h2, mode, x, y, w, h gsel id, 0 : hWndTmp = hwnd SetWindowLong hWndTmp, -16, 0x94040000 oncmd gosub *OnNCCalcSize, 0x0083 oncmd gosub *OnNCHitTest, 0x0084 oncmd gosub *OnNCActivate, 0x0086 SetWindowPos hWndTmp, 0, 0, 0, 0, 0, 0x23 return hWndTmp #deffunc Bgscr2 int id, int w, int h, int mode Bgscr2Ex id, ginfo_dispx, ginfo_dispy, mode, -1, -1, w, h return stat *OnNCCalcSize return 0 *OnNCHitTest gsel ginfo(24), 0 pt = lparam & 0xffff, lparam >> 16 ScreenToClient hwnd, varptr(pt) GetClientRect hwnd, varptr(rc) x = 1 : y = 1 if ( pt(0) < rcFrm(0) ){ x = 0 } if ( pt(0) > (rc(2) - rcFrm(2)) ){ x = 2 } if ( pt(1) < rcFrm(1) ){ y = 0 } if ( pt(1) > (rc(3) - rcFrm(3)) ){ y = 2 } return nHit(x, y) *OnNCActivate return 1 #global /* --------------------------------------------------------- mod_d2f --------------------------------------------------------- */ #module mod_d2f #defcfunc d2f double d if( dtof == 0 ){ d_ = 0.0 : f_ = 0 dim prm, 2 : dim dtof,4 dtof(0) = 0x0424448b, 0x4c8b00dd, 0x19d90824, 0x000000c3 VirtualProtect varptr(dtof), 16, 0x40, varptr(r) prm = varptr(d_), varptr(f_) } d_ = d r = callfunc(prm, varptr(dtof), 2) return f_ #global /* --------------------------------------------------------- mod_ImgCap --------------------------------------------------------- */ #module mod_ImgCap mhWnd, mbTop, mWicFC, mImgX, mImgY #define IMGCAP_BORDERX 2 #define IMGCAP_BORDERY 2 #define IMGCAP_TITLE 10 #define IMGCAP_BORDRCOLOR 16, 32, 64 #define IMGCAP_CRKEY 2, 1, 1 #define IMGCAP_CRKEY2 0x010102 #deffunc ImgCapInit if ( vartype(arImgCap) != 5 ){ dimtype arImgCap, 5, 1 bBgsrc0 = 0 wndNum = 0 dim prm, 16 } if ( vartype(cWicFactory) != 6 ){ newcom cWicFactory, IWICImagingFactory } if ( d2dFactory == 0 ){ prm(1) = 0x6152247, 0x465a6f50, 0x8b114592, 0x7603bfd dstFmt24bgr = 0x6fddc324, 0x4bfe4e03, 0x773d85b1, 0xec98d76 D2D1CreateFactory 0, prm(1), 0, prm if ( stat == 0 ){ newcom cD2dFactory, ID2D1Factory, -1, prm prm(1) = 0, 87, 3, 0, 0, 2, 0 ID2D1Factory_CreateDCRenderTarget cD2dFactory, prm(1), prm if ( stat == 0 ){ newcom cDCRender, ID2D1DCRenderTarget, -1, prm } } } if ( hMenuPop == 0 ){ CreatePopupMenu : hMenuPop = stat prm = 48, 0x42 strMenu = "コピー(&C)", "新規(&N)", "保存(&S)", "通常サイズ(&D)", "前面表示(&T)", "閉じる(&Q)", "終了(&X)" repeat length(strMenu) prm(4) = 0x8000 + cnt : prm(9) = varptr(strMenu(cnt)) InsertMenuItem hMenuPop, cnt, 1, varptr(prm) loop } if ( hToolTip == 0 ){ CreateWindowEx 8, "tooltips_class32", "", 0x90000000, 0, 0, 0, 0, 0, 0, hinstance, 0 hToolTip = stat } return #deffunc ImgCapTerm int p prm = 0 foreach arImgCap if ( varptr(arImgCap(cnt)) == p ){ delmod arImgCap(cnt) : prm = 1 } loop return prm #deffunc ImgCapExit onexit if ( vartype(arImgCap) == 5 ){ foreach arImgCap delcom arImgCap(cnt) loop } if ( vartype(cWicFactory) == 6 ){ delcom cWicFactory } if ( vartype(cD2dFactory) == 6 ){ delcom cD2dFactory } if ( vartype(cDCRender) == 6 ){ delcom cDCRender } if ( hMenuPop ){ DestroyMenu hMenuPop } if ( hToolTip ){ DestroyWindow hToolTip } return #defcfunc ImgCapCreate int x, int y, int w, int h ImgCapInit newmod arImgCap, mod_ImgCap dupptr dp, stat, 16, 5 return ImgCap_Create(dp, x, y, w, h) #defcfunc ImgCapExitFlag int flag if ( flag == 0 ){ exitFlag = 0 } else { if ( flag > 0 ){ exitFlag = 1 } } return exitFlag #defcfunc ImgCapGetDp int id, var dpImgCap gsel id, 0 GetProp hwnd, "ImgCapMod" if ( stat == 0 ){ return 0 } dupptr dpImgCap, stat, 16, 5 return 1 #modinit mhWnd = 0 : mbTop = 0 : mWicFC = 0 : mImgX = 0 : mImgY = 0 return varptr(thismod) #modterm if ( mWicFC ){ prm = ImgCap_ImgDel(thismod, mWicFC) } if ( hToolTip ){ prm = 48, 0x11, mhWnd, mhWnd sendmsg hToolTip, 0x405, 0, varptr(prm) } RemoveProp mhWnd, "ImgCapMod" return #modcfunc ImgCap_SetLayered int flag GetWindowRect mhWnd, varptr(prm) prm(2) -= prm(0) : prm(3) -= prm(1) GetWindowLong mhWnd, -20 if ( flag == 0 ){ SetWindowLong mhWnd, -20, stat ^ 0x80000 RedrawWindow mhWnd, 0, 0, 0x485 prm(0) += IMGCAP_BORDERX prm(1) += IMGCAP_BORDERY + IMGCAP_TITLE prm(2) -= (IMGCAP_BORDERX * 2) prm(3) -= (IMGCAP_BORDERY * 2 + IMGCAP_TITLE) } else { SetWindowLong mhWnd, -20, stat | 0x80000 SetLayeredWindowAttributes mhWnd, IMGCAP_CRKEY2, 0, 1 prm(0) -= IMGCAP_BORDERX prm(1) -= (IMGCAP_BORDERY + IMGCAP_TITLE) prm(2) += (IMGCAP_BORDERX * 2) prm(3) += (IMGCAP_BORDERY * 2 + IMGCAP_TITLE) } SetWindowPos mhWnd, 0, prm(0), prm(1), prm(2), prm(3), 0x20 return stat #modcfunc ImgCap_Create int x, int y, int w, int h idTmp = ginfo(25) gsel 0, 0 if ( exitFlag == 0 && bBgsrc0 == 0 ){ GetProp hwnd, "ImgCapMod" if ( stat == 0 ){ idTmp = 0 : bBgsrc0 = 1 } } Bgscr2Ex idTmp, ginfo_dispx, ginfo_dispy, 0, x, y, w, h mhWnd = stat prm = 1, 1, 1, 1 DwmExtendFrameIntoClientArea mhWnd, prm GetClassLong mhWnd, -26 SetClassLong mhWnd, -26, stat | 8 SetProp mhWnd, "ImgCapMod", varptr(thismod) if ( stat == 0 ){ gsel idTmp, -1 : return 0 } buf = "test" prm = 48, 0x11, mhWnd, mhWnd prm(8) = hinstance, 0 sendmsg hToolTip, 0x404, 0, varptr(prm) wndNum++ oncmd gosub *WM_SIZE, 0x0005 oncmd gosub *WM_CLOSE, 0x0010 oncmd gosub *WM_COMMAND, 0x0111 oncmd gosub *WM_LBUTTONDOWN, 0x0201 oncmd gosub *WM_LBUTTONDBLCLK, 0x0203 oncmd gosub *WM_RBUTTONDOWN, 0x0204 oncmd gosub *WM_MBUTTONDOWN, 0x0207 oncmd gosub *WM_MOUSEWHEEL, 0x020A if ( ImgCap_SetLayered(thismod, 1) == 0 ){ return 0 } return 1 #modcfunc ImgCap_Close ImgCapTerm varptr(thismod) if ( wndNum ){ wndNum-- } if ( wndNum == 0 ){ if ( exitFlag == 0 ){ return 1 } } return 0 #modcfunc ImgCap_ImgCreate prm(10) = 0 GetClientRect mhWnd, varptr(prm) ClientToScreen mhWnd, varptr(prm) prm(4) = IMGCAP_BORDERX * 2 prm(5) = IMGCAP_BORDERY + IMGCAP_TITLE prm(6) = prm(5) + IMGCAP_BORDERY if ( prm(2) <= prm(4) || prm(3) <= prm(6) ){ return 0 } prm(0) = prm(0) + IMGCAP_BORDERX prm(1) = prm(1) + prm(5) prm(2) = prm(2) - prm(4) prm(3) = prm(3) - prm(6) GetDesktopWindow : prm(4) = stat GetDC prm(4) : prm(5) = stat CreateCompatibleDC prm(5) : prm(6) = stat CreateCompatibleBitmap prm(5), prm(2), prm(3) : prm(7) = stat SelectObject prm(6), prm(7) : prm(8) = stat BitBlt prm(6), 0, 0, prm(2), prm(3), prm(5), prm(0), prm(1), 0xcc0020 ReleaseDC prm(4), prm(5) SelectObject prm(6), prm(8) DeleteDC prm(6) IWICImagingFactory_CreateBitmapFromHBITMAP cWicFactory, prm(7), 0, 2, prm(9) if ( stat == 0 ){ newcom comTmp, IWICBitmap, -1, prm(9) IWICImagingFactory_CreateFormatConverter cWicFactory, prm(10) if ( stat == 0 ){ newcom comTmp2, IWICFormatConverter, -2, prm(10) IWICFormatConverter_Initialize comTmp2, prm(9), dstFmt24bgr, 1, 0, 0.0, 0 if ( stat ){ prm = ImgCap_ImgDel(thismod, prm(10)) } delcom comTmp2 } delcom comTmp } DeleteObject prm(7) return prm(10) #modcfunc ImgCap_ImgDel int img if ( img == 0 ){ return 0 } newcom comTmp, IWICFormatConverter, -1, img delcom comTmp return 1 #modcfunc ImgCap_ImgGetSize int img, var x, var y newcom comTmp, IWICFormatConverter, -2, img IWICFormatConverter_GetSize comTmp, x, y prm = stat delcom comTmp if ( prm ){ return 0 } return 1 #modcfunc ImgCap_CopyView if ( mWicFC ){ if ( ImgCap_ImgDel(thismod, mWicFC) == 0 ){ return 0 } mWicFC = 0 if ( ImgCap_SetLayered(thismod, 1) == 0 ){ return 0 } } else { prm(11) = ImgCap_ImgCreate(thismod) if ( prm == 0 ){ return 0 } if ( ImgCap_ImgGetSize(thismod, prm(11), prm(12), prm(13)) == 0 ){ prm = ImgCap_ImgDel(thismod, prm(11)) return 0 } mWicFC = prm(11) : mImgX = prm(12) : mImgY = prm(13) if ( ImgCap_SetLayered(thismod, 0) == 0 ){ return 0 } } return 1 #modcfunc ImgCap_Size redraw 0 GetClientRect mhWnd, varptr(prm) GetWindowLong mhWnd, -21 gsel stat, 0 if ( mWicFC ){ ID2D1DCRenderTarget_BindDC cDCRender, hdc, prm ID2D1DCRenderTarget_BeginDraw cDCRender prm(4) = 0, 0, 0, 0x3f800000 ID2D1DCRenderTarget_Clear cDCRender, prm(4) if ( (prm(2) * prm(3) * mImgX * mImgY) != 0 ){ ID2D1DCRenderTarget_CreateBitmapFromWicBitmap cDCRender, mWicFC, 0, prm(4) if ( stat == 0 ){ newcom comTmp, ID2D1Bitmap, -2, prm(4) d1 = 1.0 * prm(2) / mImgX d2 = 1.0 * prm(3) / mImgY if ( d1 > d2 ){ prm(1) = 0 prm(5) = int(1.0 * prm(3) * mImgX / mImgY) prm(0) = (prm(2) - prm(5)) / 2 prm(2) = prm(0) + prm(5) } else { prm(0) = 0 prm(5) = int(1.0 * prm(2) * mImgY / mImgX) prm(1) = (prm(3) - prm(5)) / 2 prm(3) = prm(1) + prm(5) } prm(5) = d2f(prm(0)), d2f(prm(1)), d2f(prm(2)), d2f(prm(3)) ID2D1DCRenderTarget_DrawBitmap cDCRender, prm(4), varptr(prm(5)), 0x3f800000, 1, 0 delcom comTmp } } ID2D1DCRenderTarget_EndDraw cDCRender, 0, 0 prm(2) -= prm(0) : prm(3) -= prm(1) d1 = 1.0 * prm(2) / mImgX * 100 buf = strf("%3d%% %5d x %5d (%5d x %5d)", int(d1), prm(2), prm(3), mImgX, mImgY) } else { color IMGCAP_BORDRCOLOR : boxf color IMGCAP_CRKEY prm(0) = IMGCAP_BORDERX prm(1) = IMGCAP_BORDERY + IMGCAP_TITLE prm(4) = prm(2) - (IMGCAP_BORDERX * 2) prm(5) = prm(3) - prm(1) - IMGCAP_BORDERY prm(2) = prm(0) + prm(4) - 1 prm(3) = prm(1) + prm(5) - 1 boxf prm(0), prm(1), prm(2), prm(3) buf = strf("%5d x %5d", prm(4), prm(5)) } redraw 1 prm = 48, 0x11, mhWnd, mhWnd prm(8) = hinstance, varptr(buf) sendmsg hToolTip, 0x40c, 0, varptr(prm) return 1 #modcfunc ImgCap_SetDefSize if ( mWicFC == 0 ){ return 0 } SetWindowPos mhWnd, 0, 0, 0, mImgX, mImgY, 0x2 return 1 #modcfunc ImgCap_TopWnd mbTop ^= 1 if ( mbTop ){ prm = -1 } else { prm = -2 } SetWindowPos mhWnd, prm, 0, 0, 0, 0, 0x23 return stat #modcfunc ImgCap_MouseWheel int w, int l GetClientRect mhWnd, varptr(prm) ClientToScreen mhWnd, varptr(prm) prm(4) = w >> 16 if ( mWicFC == 0 ){ prm(5) = int(0.1 * prm(2)), int(0.1 * prm(3)) if ( prm(4) < 0 ){ prm(2) -= prm(5) : prm(3) -= prm(6) } else { prm(2) += prm(5) : prm(3) += prm(6) } } else { d1 = 1.0 * prm(2) / mImgX + 0.09 d2 = 1.0 * prm(3) / mImgY + 0.09 if ( d1 > d2 ){ prm(5) = int(d2 * 10) } else { prm(5) = int(d1 * 10) } if ( prm(4) < 0 ){ prm(5)-- } else { prm(5)++ } if ( prm(5) <= 0 ){ prm(5) = 1 } if ( prm(5) > 300 ){ prm(5) = 300 } d1 = 10.0 * prm(5) / 100.0 prm(2) = int(d1 * mImgX) prm(3) = int(d1 * mImgY) } prm(0) += prm(2) / 2 : prm(1) += prm(3) / 2 SetCursorPos prm(0), prm(1) SetWindowPos mhWnd, 0, 0, 0, prm(2), prm(3), 0x2 return 1 #modcfunc ImgCap_Save wicTmp = mWicFC if ( wicTmp == 0 ){ wicTmp = ImgCap_ImgCreate(thismod) } if ( wicTmp == 0 ){ return 0 } dialog "jpg", 17 if ( stat == 0 ){ return 0 } fileName = refstr prm(5) = 0 prm(12) = 0x19e4a5aa, 0x4fc55662, 0x5817c0a0, 0x57108e02 IWICImagingFactory_CreateEncoder cWicFactory, prm(12), 0, prm(0) if ( stat == 0 ){ IWICImagingFactory_CreateStream cWicFactory, prm(1) if ( stat == 0 ){ newcom comTmp, IWICBitmapEncoder, -1, prm(0) newcom comTmp2, IWICStream, -1, prm(1) IWICStream_InitializeFromFilename comTmp2, fileName, 0x40000000 if ( stat == 0 ){ IWICBitmapEncoder_Initialize comTmp, prm(1), 2 if ( stat == 0 ){ IWICBitmapEncoder_CreateNewFrame comTmp, prm(2), prm(3) if ( stat == 0 ){ newcom comTmp3, IWICBitmapFrameEncode, -1, prm(2) newcom comTmp4, IPropertyBag2, -1, prm(3) IWICBitmapFrameEncode_Initialize comTmp3, prm(3) if ( stat == 0 ){ newcom comTmp5, IWICFormatConverter, -2, wicTmp IWICFormatConverter_GetSize comTmp5, prm(2), prm(3) if ( stat == 0 ){ prm = 0, 0 IWICBitmapFrameEncode_WriteSource comTmp3, wicTmp, prm if ( stat == 0 ){ IWICBitmapFrameEncode_Commit comTmp3 if ( stat == 0 ){ IWICBitmapEncoder_Commit comTmp if ( stat == 0 ){ prm(5) = 1 } } } } delcom comTmp5 } delcom comTmp3 : delcom comTmp4 } } } delcom comTmp : delcom comTmp2 } } if ( wicTmp != mWicFC ){ prm = ImgCap_ImgDel(thismod, wicTmp) } return prm(5) #modcfunc ImgCap_SetPopMenuItem if ( hMenuPop == 0 ){ return 0 } prm = 48 prm(1) = 0x40 : prm(9) = varptr(strMenu(0)) if ( mWicFC ){ strMenu(0) = "表示(&V)" } else { strMenu(0) = "コピー(&C)" } SetMenuItemInfo hMenuPop, 0, 1, varptr(prm) prm(1) = 1 : prm(3) = 0 if ( mWicFC ){ GetClientRect mhWnd, varptr(prm(12)) if ( prm(14) == mImgX && prm(15) == mImgY ){ prm(3) = 8 } } SetMenuItemInfo hMenuPop, 3, 1, varptr(prm) if ( mbTop ){ prm(3) = 8 } else { prm(3) = 0 } SetMenuItemInfo hMenuPop, 4, 1, varptr(prm) return 1 *WM_SIZE if ( ImgCapGetDp(ginfo(24), dp ) == 0 ){ return } prm = ImgCap_Size(dp) return *WM_CLOSE idTmp = ginfo(24) gsel idTmp, -1 if ( ImgCapGetDp(idTmp, dp ) == 0 ){ return } if ( ImgCap_Close(dp) ){ return } return 0 *WM_COMMAND idTmp = ginfo(24) gsel idTmp, 0 lw = wparam & 0xffff if ( lw == 0x8001 ){ GetWindowRect hwnd, varptr(prm) prm(2) -= prm(0) : prm(3) -= prm(1) prm(0) += 20 : prm(1) += 20 prm = ImgCapCreate(prm(0), prm(1), prm(2), prm(3)) return } if ( lw == 0x8005 ){ sendmsg hwnd, 0x10, 0, 0 : return } if ( lw == 0x8006 ){ end : end } if ( ImgCapGetDp(idTmp, dp ) == 0 ){ return } if ( lw == 0x8000 ){ prm = ImgCap_CopyView(dp) : return } if ( lw == 0x8002 ){ prm = ImgCap_Save(dp) : return } if ( lw == 0x8003 ){ prm = ImgCap_SetDefSize(dp) : return } if ( lw == 0x8004 ){ prm = ImgCap_TopWnd(dp) : return } return *WM_LBUTTONDOWN gsel ginfo(24), 0 sendmsg hwnd, 0xa1, 2, 0 return *WM_LBUTTONDBLCLK if ( ImgCapGetDp(ginfo(24), dp ) == 0 ){ return } prm = ImgCap_CopyView(dp) return *WM_RBUTTONDOWN if ( ImgCapGetDp(ginfo(24), dp ) == 0 ){ return } prm = ImgCap_SetPopMenuItem(dp) GetCursorPos varptr(prm) TrackPopupMenu hMenuPop, 0, prm(0), prm(1), 0, hwnd, 0 return *WM_MBUTTONDOWN if ( ImgCapGetDp(ginfo(24), dp ) == 0 ){ return } prm = ImgCap_TopWnd(dp) return *WM_MOUSEWHEEL if ( ImgCapGetDp(ginfo(24), dp ) == 0 ){ return } prm = ImgCap_MouseWheel(dp, wparam, lparam) return #global /* --------------------------------------------------------- Main --------------------------------------------------------- */ if ( ImgCapCreate(100, 100, 300, 200) == 0 ){ dialog "err" : end } stop
コメント ( 0 ) | Trackback ( 0 )
DirectWrite 2
サンプル

#include "mod_DWMes.hsp" font "メイリオ", 40 mes "0123456789 mes" DWMesFont "メイリオ", 40 DWMes "0123456789 DWMes" stop

#include "mod_DWMes.hsp" DWMesClear 200, 200, 200 DWMesFont msgothic, 32 DWMesColor 0, 0, 0 repeat 6 tmp = cnt * 20 DWMesOpacity tmp DWMes strf("DWMesOpacity %d", tmp) loop stop

#include "mod_DWMes.hsp" screen 0, 300, 300 onexit *ONEXIT_ txtNum = 50 sdim txt, txtNum, 64 dim txtColor, txtNum dim txtPos, txtNum, 4 w = ginfo_winx : h = ginfo_winy repeat txtNum txt(cnt) = strf("%c%c%c", rnd(26)+65, rnd(26)+65,rnd(26)+65) txtColor(cnt) = rnd(255) | rnd(255) << 8 | rnd(255) << 16 txtPos(cnt, 0) = rnd(w) txtPos(cnt, 1) = rnd(h) txtPos(cnt, 2) = rnd(500) txtPos(cnt, 3) = rnd(2) loop DWMes2Make dw, hdc, msmincho, 32, 800, 0, 0, 0 repeat DWMes2Begin dw, 0, 0, w, h DWMes2Clear dw, 30, 30, 30 repeat txtNum d = 1.0 * txtPos(cnt, 2) / 100.0 DWMesScale d, d, w / 2, h / 2 DWMes2Color dw, txtColor(cnt) & 0xff, (txtColor(cnt) >> 8) & 0xff, (txtColor(cnt) >> 16) & 0xff DWMes2 dw, txt(cnt), txtPos(cnt, 0), txtPos(cnt, 1), w, h if ( txtPos(cnt, 3) ){ txtPos(cnt, 2) += 3 : if ( txtPos(cnt, 2) > 500 ){ txtPos(cnt, 3) = 0 } } else { txtPos(cnt, 2) -= 5 : if ( txtPos(cnt, 2) < 0 ){ txtPos(cnt, 3) = 1 } } loop DWMes2End redraw 1 await 20 loop stop *ONEXIT_ DWMes2Free dw end

#include "mod_DWMes.hsp" s = {"Hello World !! DirectWrite mod_DWMes.hsp"} screen 0, 300, 300 DWMesFont "メイリオ", 30, 800 DWMesColor 255, 255, 255 repeat redraw 0 color : boxf pos 50, 50 DWMesSkew cnt, cnt, 150, 150 DWMes s redraw 1 await 20 loop stop

#include "mod_DWMes.hsp" s = "2.プログラミングガイド¥n¥n2.1.スクリプトの形式¥n" s += " HSPはプログラム(命令と実行の順序を記したもの)によって動作します。" s += "そのもとになるのがスクリプト(ソースファイル)です。" s += "これはテキストファイルの形式で、拡張子は .hsp または、.as になります。" s += "(拡張子 .hsp は、HSP3.0から追加されたものです。)" s += "スクリプトはHSPに付属しているHSPスクリプトエディタ(HSED3.EXE)や、" s += "テキストエディタなどのアプリケーションで作成することができます。" screen 0, 300, 300 DWMesFont "メイリオ", 14 DWMesVertical DWMes s stop

#include "mod_DWMes.hsp" screen 0, 200, 100 DWMesFont msgothic, 32 DWMesSetTrimming 1, 1 x = 0 repeat redraw 0 color 255, 255, 255 : boxf pos x, 30 DWMes "あいうえお" redraw 1 await 20 x++ if ( x > ginfo_winx ){ x = -200 } loop stop
簡易説明
DWMesは、現在選択されているウィンドウのカレントポジションのX、Yに文字を描画します。
DWMesFontでフォントの変更、DWMesColorで文字色の変更、DWMesOpacityで文字の透明度の設定、DWMesWordWrappingで自動改行の設定、
DWMesTabStopでタブストップの設定。
DWMes2は、任意のデバイスコンテキスト(hdc)の任意の範囲内に文字を描画します。 DWMes2から始まる命令を使用します。
状況にもよりますが、DWMesより高速です。
DWMesが遅いのは、ID2D1DCRenderTarget::BeginDrawとID2D1DCRenderTarget::EndDrawを毎回呼び出ししている事が原因です。
DWMesは、mes同様、カレントポジションのY座標(ginfo_cy)を移動します。 しかし、Transform関連の命令後は正確に反映されないことがあります。
DWMes2は、任意のデバイスコンテキスト(hdc)の任意の範囲内に文字を描画します。 DWMes2から始まる命令を使用します。
状況にもよりますが、DWMesより高速です。
- 使用例
- DWMes2Makeで描画用変数を初期化する
- DWMes2Beginで描画開始
- DWMes2で文字表示
- DWMes2Endで描画終了
- DWMes2Freeで描画用変数を解放する
DWMesが遅いのは、ID2D1DCRenderTarget::BeginDrawとID2D1DCRenderTarget::EndDrawを毎回呼び出ししている事が原因です。
DWMesは、mes同様、カレントポジションのY座標(ginfo_cy)を移動します。 しかし、Transform関連の命令後は正確に反映されないことがあります。
コメント ( 0 ) | Trackback ( 0 )
DirectWrite
モジュール mod_DWMes - DirectWriteによる文字表示
mod_DWMes.hsp
#ifndef MOD_DWMES_HSP_ #define MOD_DWMES_HSP_ #include "user32.as" #include "gdi32.as" #include "kernel32.as" #uselib "d2d1.dll" #func global D2D1CreateFactory "D2D1CreateFactory" int,var,int,var #func global D2D1InvertMatrix "D2D1InvertMatrix" var #func global D2D1IsMatrixInvertible "D2D1IsMatrixInvertible" var #func global D2D1MakeRotateMatrix "D2D1MakeRotateMatrix" int,int,int,var #func global D2D1MakeSkewMatrix "D2D1MakeSkewMatrix" int,int,int,int,var #uselib "dwrite.dll" #func global DWriteCreateFactory "DWriteCreateFactory" int,var,var #ifndef IID_ID2D1Factory #define global IID_ID2D1Factory "{06152247-6F50-465A-9245-118BFD3B6007}" #usecom global ID2D1Factory IID_ID2D1Factory "{}" #comfunc global ID2D1Factory_ReloadSystemMetrics 3 #comfunc global ID2D1Factory_GetDesktopDpi 4 var,var #comfunc global ID2D1Factory_CreateRectangleGeometry 5 var,var #comfunc global ID2D1Factory_CreateRoundedRectangleGeometry 6 var,var #comfunc global ID2D1Factory_CreateEllipseGeometry 7 var,var #comfunc global ID2D1Factory_CreateGeometryGroup 8 int,var,int,var #comfunc global ID2D1Factory_CreateTransformedGeometry 9 int,var,var #comfunc global ID2D1Factory_CreatePathGeometry 10 var #comfunc global ID2D1Factory_CreateStrokeStyle 11 var,var,int,var #comfunc global ID2D1Factory_CreateDrawingStateBlock 12 int,int,var #comfunc global ID2D1Factory_CreateWicBitmapRenderTarget 13 int,var,var #comfunc global ID2D1Factory_CreateHwndRenderTarget 14 var,var,var #comfunc global ID2D1Factory_CreateDxgiSurfaceRenderTarget 15 int,var,var #comfunc global ID2D1Factory_CreateDCRenderTarget 16 var,var #endif // IID_ID2D1Factory #ifndef IID_ID2D1DCRenderTarget #define global IID_ID2D1DCRenderTarget "{1c51bc64-de61-46fd-9899-63a5d8f03950}" #usecom global ID2D1DCRenderTarget IID_ID2D1DCRenderTarget "{}" #comfunc global ID2D1DCRenderTarget_GetFactory 3 var #comfunc global ID2D1DCRenderTarget_CreateBitmap 4 int,int,int,int,int,var #comfunc global ID2D1DCRenderTarget_CreateBitmapFromWicBitmap 5 int,int,var #comfunc global ID2D1DCRenderTarget_CreateSharedBitmap 6 var,var,int,var #comfunc global ID2D1DCRenderTarget_CreateBitmapBrush 7 int,int,int,var #comfunc global ID2D1DCRenderTarget_CreateSolidColorBrush 8 var,int,var #comfunc global ID2D1DCRenderTarget_CreateGradientStopCollection 9 var,int,int,int,var #comfunc global ID2D1DCRenderTarget_CreateLinearGradientBrush 10 int,int,int,var #comfunc global ID2D1DCRenderTarget_CreateRadialGradientBrush 11 int,int,int,var #comfunc global ID2D1DCRenderTarget_CreateCompatibleRenderTarget 12 int,int,int,int,int,int,var #comfunc global ID2D1DCRenderTarget_CreateLayer 13 int,int,var #comfunc global ID2D1DCRenderTarget_CreateMesh 14 var #comfunc global ID2D1DCRenderTarget_DrawLine 15 int,int,int,int,int,int,int #comfunc global ID2D1DCRenderTarget_DrawRectangle 16 var,int,int,int #comfunc global ID2D1DCRenderTarget_FillRectangle 17 var,var #comfunc global ID2D1DCRenderTarget_DrawRoundedRectangle 18 var,int,int,int #comfunc global ID2D1DCRenderTarget_FillRoundedRectangle 19 int,int #comfunc global ID2D1DCRenderTarget_DrawEllipse 20 int,int,int,int,int,int,int #comfunc global ID2D1DCRenderTarget_FillEllipse 21 var,int #comfunc global ID2D1DCRenderTarget_DrawGeometry 22 int,int,int,int #comfunc global ID2D1DCRenderTarget_FillGeometry 23 int,int,int #comfunc global ID2D1DCRenderTarget_FillMesh 24 int,int #comfunc global ID2D1DCRenderTarget_FillOpacityMask 25 int,int,int,int,int #comfunc global ID2D1DCRenderTarget_DrawBitmap 26 int,int,int,int,int #comfunc global ID2D1DCRenderTarget_DrawText 27 wstr,int,int,var,int,int,int #comfunc global ID2D1DCRenderTarget_DrawTextLayout 28 int,int,int,int,int #comfunc global ID2D1DCRenderTarget_DrawGlyphRun 29 int,int,int,int,int #comfunc global ID2D1DCRenderTarget_SetTransform 30 var #comfunc global ID2D1DCRenderTarget_GetTransform 31 var #comfunc global ID2D1DCRenderTarget_SetAntialiasMode 32 int #comfunc global ID2D1DCRenderTarget_GetAntialiasMode 33 #comfunc global ID2D1DCRenderTarget_SetTextAntialiasMode 34 int #comfunc global ID2D1DCRenderTarget_GetTextAntialiasMode 35 #comfunc global ID2D1DCRenderTarget_SetTextRenderingParams 36 int #comfunc global ID2D1DCRenderTarget_GetTextRenderingParams 37 var #comfunc global ID2D1DCRenderTarget_SetTags 38 int,int,int,int #comfunc global ID2D1DCRenderTarget_GetTags 39 int,int #comfunc global ID2D1DCRenderTarget_PushLayer 40 var,int #comfunc global ID2D1DCRenderTarget_PopLayer 41 #comfunc global ID2D1DCRenderTarget_Flush 42 int,int #comfunc global ID2D1DCRenderTarget_SaveDrawingState 43 int #comfunc global ID2D1DCRenderTarget_RestoreDrawingState 44 int #comfunc global ID2D1DCRenderTarget_PushAxisAlignedClip 45 var,int #comfunc global ID2D1DCRenderTarget_PopAxisAlignedClip 46 #comfunc global ID2D1DCRenderTarget_Clear 47 var #comfunc global ID2D1DCRenderTarget_BeginDraw 48 #comfunc global ID2D1DCRenderTarget_EndDraw 49 int,int #comfunc global ID2D1DCRenderTarget_GetPixelFormat 50 #comfunc global ID2D1DCRenderTarget_SetDpi 51 int,int #comfunc global ID2D1DCRenderTarget_GetDpi 52 var,var #comfunc global ID2D1DCRenderTarget_GetSize 53 var #comfunc global ID2D1DCRenderTarget_GetPixelSize 54 var #comfunc global ID2D1DCRenderTarget_GetMaximumBitmapSize 55 #comfunc global ID2D1DCRenderTarget_IsSupported 56 var #comfunc global ID2D1DCRenderTarget_BindDC 57 int,var #endif // IID_ID2D1DCRenderTarget #ifndef IID_ID2D1SolidColorBrush #define global IID_ID2D1SolidColorBrush "{2CD906A9-12E2-11DC-9FED-001143A055F9}" #usecom global ID2D1SolidColorBrush IID_ID2D1SolidColorBrush "{}" #comfunc global ID2D1SolidColorBrush_GetFactory 3 var #comfunc global ID2D1SolidColorBrush_SetOpacity 4 int #comfunc global ID2D1SolidColorBrush_SetTransform 5 var #comfunc global ID2D1SolidColorBrush_GetOpacity 6 #comfunc global ID2D1SolidColorBrush_GetTransform 7 var #comfunc global ID2D1SolidColorBrush_SetColor 8 var #comfunc global ID2D1SolidColorBrush_GetColor 9 var #endif // IID_ID2D1SolidColorBrush #ifndef IID_IDWriteFactory #define global IID_IDWriteFactory "{B859EE5A-D838-4B5B-A2E8-1ADC7D93DB48}" #usecom global IDWriteFactory IID_IDWriteFactory "{}" #comfunc global IDWriteFactory_GetSystemFontCollection 3 var,int #comfunc global IDWriteFactory_CreateCustomFontCollection 4 int,var,int,var #comfunc global IDWriteFactory_RegisterFontCollectionLoader 5 int #comfunc global IDWriteFactory_UnregisterFontCollectionLoader 6 int #comfunc global IDWriteFactory_CreateFontFileReference 7 wstr,int,var #comfunc global IDWriteFactory_CreateCustomFontFileReference 8 int,int,int,var #comfunc global IDWriteFactory_CreateFontFace 9 int,int,int,int,int,var #comfunc global IDWriteFactory_CreateRenderingParams 10 var #comfunc global IDWriteFactory_CreateMonitorRenderingParams 11 int,var #comfunc global IDWriteFactory_CreateCustomRenderingParams 12 int,int,int,int,int,var #comfunc global IDWriteFactory_RegisterFontFileLoader 13 int #comfunc global IDWriteFactory_UnregisterFontFileLoader 14 int #comfunc global IDWriteFactory_CreateTextFormat 15 wstr,int,int,int,int,int,wstr,var #comfunc global IDWriteFactory_CreateTypography 16 var #comfunc global IDWriteFactory_GetGdiInterop 17 var #comfunc global IDWriteFactory_CreateTextLayout 18 wstr,int,int,int,int,var #comfunc global IDWriteFactory_CreateGdiCompatibleTextLayout 19 wstr,int,int,int,int,int,int,int,var #comfunc global IDWriteFactory_CreateEllipsisTrimmingSign 20 int,var #comfunc global IDWriteFactory_CreateTextAnalyzer 21 var #comfunc global IDWriteFactory_CreateNumberSubstitution 22 int,wstr,int,var #comfunc global IDWriteFactory_CreateGlyphRunAnalysis 23 int,int,int,int,int,int,int,var #endif // IID_IDWriteFactory #ifndef IID_IDWriteTextFormat #define global IID_IDWriteTextFormat "{9c906818-31d7-4fd3-a151-7c5e225db55a}" #usecom global IDWriteTextFormat IID_IDWriteTextFormat "{}" #comfunc global IDWriteTextFormat_SetTextAlignment 3 int #comfunc global IDWriteTextFormat_SetParagraphAlignment 4 int #comfunc global IDWriteTextFormat_SetWordWrapping 5 int #comfunc global IDWriteTextFormat_SetReadingDirection 6 int #comfunc global IDWriteTextFormat_SetFlowDirection 7 int #comfunc global IDWriteTextFormat_SetIncrementalTabStop 8 int #comfunc global IDWriteTextFormat_SetTrimming 9 var,int #comfunc global IDWriteTextFormat_SetLineSpacing 10 int,int,int #comfunc global IDWriteTextFormat_GetTextAlignment 11 #comfunc global IDWriteTextFormat_GetParagraphAlignment 12 #comfunc global IDWriteTextFormat_GetWordWrapping 13 #comfunc global IDWriteTextFormat_GetReadingDirection 14 #comfunc global IDWriteTextFormat_GetFlowDirection 15 #comfunc global IDWriteTextFormat_GetIncrementalTabStop 16 #comfunc global IDWriteTextFormat_GetTrimming 17 var,var #comfunc global IDWriteTextFormat_GetLineSpacing 18 var,var,var #comfunc global IDWriteTextFormat_GetFontCollection 19 var #comfunc global IDWriteTextFormat_GetFontFamilyNameLength 20 #comfunc global IDWriteTextFormat_GetFontFamilyName 21 var,int #comfunc global IDWriteTextFormat_GetFontWeight 22 #comfunc global IDWriteTextFormat_GetFontStyle 23 #comfunc global IDWriteTextFormat_GetFontStretch 24 #comfunc global IDWriteTextFormat_GetFontSize 25 #comfunc global IDWriteTextFormat_GetLocaleNameLength 26 #comfunc global IDWriteTextFormat_GetLocaleName 27 var,int #endif // IID_IDWriteTextFormat #ifndef IID_IDWriteTextLayout // inherits from IDWriteTextFormat #define global IID_IDWriteTextLayout "{53737037-6d14-410b-9bfe-0b182bb70961}" #usecom global IDWriteTextLayout IID_IDWriteTextLayout "{}" #comfunc global IDWriteTextLayout_SetMaxWidth 28 int #comfunc global IDWriteTextLayout_SetMaxHeight 29 int #comfunc global IDWriteTextLayout_SetFontCollection 30 int,int,int #comfunc global IDWriteTextLayout_SetFontFamilyName 31 wstr,int,int #comfunc global IDWriteTextLayout_SetFontWeight 32 int,int,int #comfunc global IDWriteTextLayout_SetFontStyle 33 int,int,int #comfunc global IDWriteTextLayout_SetFontStretch 34 int,int,int #comfunc global IDWriteTextLayout_SetFontSize 35 int,int,int #comfunc global IDWriteTextLayout_SetUnderline 36 int,int,int #comfunc global IDWriteTextLayout_SetStrikethrough 37 int,int,int #comfunc global IDWriteTextLayout_SetDrawingEffect 38 int,int,int #comfunc global IDWriteTextLayout_SetInlineObject 39 int,int,int #comfunc global IDWriteTextLayout_SetTypography 40 int,int,int #comfunc global IDWriteTextLayout_SetLocaleName 41 wstr,int,int #comfunc global IDWriteTextLayout_GetMaxWidth 42 #comfunc global IDWriteTextLayout_GetMaxHeight 43 #comfunc global IDWriteTextLayout_GetFontCollection 44 int,var,int #comfunc global IDWriteTextLayout_GetFontFamilyNameLength 45 int,var,int #comfunc global IDWriteTextLayout_GetFontFamilyName 46 int,var,int,int #comfunc global IDWriteTextLayout_GetFontWeight 47 int,var,int #comfunc global IDWriteTextLayout_GetFontStyle 48 int,var,int #comfunc global IDWriteTextLayout_GetFontStretch 49 int,var,int #comfunc global IDWriteTextLayout_GetFontSize 50 int,var,int #comfunc global IDWriteTextLayout_GetUnderline 51 int,var,int #comfunc global IDWriteTextLayout_GetStrikethrough 52 int,var,int #comfunc global IDWriteTextLayout_GetDrawingEffect 53 int,var,int #comfunc global IDWriteTextLayout_GetInlineObject 54 int,var,int #comfunc global IDWriteTextLayout_GetTypography 55 int,var,int #comfunc global IDWriteTextLayout_GetLocaleNameLength 56 int,var,int #comfunc global IDWriteTextLayout_GetLocaleName 57 int,var,int,int #comfunc global IDWriteTextLayout_Draw 58 int,int,int,int #comfunc global IDWriteTextLayout_GetLineMetrics 59 int,int,var #comfunc global IDWriteTextLayout_GetMetrics 60 var #comfunc global IDWriteTextLayout_GetOverhangMetrics 61 var #comfunc global IDWriteTextLayout_GetClusterMetrics 62 var,int,var #comfunc global IDWriteTextLayout_DetermineMinWidth 63 var #comfunc global IDWriteTextLayout_HitTestPoint 64 int,int,var,var,var #comfunc global IDWriteTextLayout_HitTestTextPosition 65 int,int,var,var,var #comfunc global IDWriteTextLayout_HitTestTextRange 66 int,int,int,int,var,int,var #endif // IID_IDWriteTextLayout #ifndef IDWriteInlineObject #define global IID_IDWriteInlineObject "{8339FDE3-106F-47ab-8373-1C6295EB10B3}" #usecom global IDWriteInlineObject IID_IDWriteInlineObject "{}" #comfunc global IDWriteInlineObject_Draw 3 int,int,int,int,int,int,int #comfunc global IDWriteInlineObject_GetMetrics 4 var #comfunc global IDWriteInlineObject_GetOverhangMetrics 5 var #comfunc global IDWriteInlineObject_GetBreakConditions 6 var,var #endif // IDWriteInlineObject #ifndef d2f #module mod_d2f #defcfunc d2f double d if( dtof == 0 ){ d_ = 0.0 : f_ = 0 dim prm, 2 : dim dtof,4 dtof(0) = 0x0424448b, 0x4c8b00dd, 0x19d90824, 0x000000c3 VirtualProtect varptr(dtof), 16, 0x40, varptr(r) prm = varptr(d_), varptr(f_) } d_ = d r = callfunc(prm, varptr(dtof), 2) return f_ #global #endif // d2f #ifndef f2d #module mod_f2d #defcfunc f2d int f if( ftod == 0 ){ d_ = 0.0 : f_ = 0 dim prm, 2 : dim ftod,4 ftod(0) = 0x0424448b, 0x4c8b00d9, 0x19dd0824, 0x000000c3 VirtualProtect varptr(ftod), 16, 0x40, varptr(r) prm = varptr(f_), varptr(d_) } f_ = f r = callfunc(prm, varptr(ftod), 2) return d_ #global #endif // f2d #ifndef GetF2D #module mod_GetF2D #defcfunc GetF2D if( getFtoD == 0 ){ prm = 0 : dim getFtoD, 3 getFtoD(0) = 0x241cd951, 0x5924048b, 0x000000c3 VirtualProtect varptr(getFtoD), 12, 0x40, varptr(r) } r = callfunc(prm, varptr(getFtoD), 0) return f2d(r) #global #endif // GetF2D #module mod_DWMes #deffunc DWMes_Init mref bmscr, 67 dim IID_ID2D1Factory_, 4 dim IID_IDWriteFactory_, 4 IID_ID2D1Factory_(0) = 0x6152247, 0x465a6f50, 0x8b114592, 0x7603bfd D2D1CreateFactory 0, IID_ID2D1Factory_, 0, pv if ( stat ){ return } newcom factory, ID2D1Factory, -1, pv IID_IDWriteFactory_(0) = 0xb859ee5a, 0x4b5bd838, 0xdc1ae8a2, 0x48db937d DWriteCreateFactory 0, IID_IDWriteFactory_, pv if ( stat ){ delcom factory : return } newcom dwFactory, IID_IDWriteFactory, -1, pv dim prm, 15 : prm(1) = 87, 3 ID2D1Factory_CreateDCRenderTarget factory, prm, pv if ( stat ){ delcom factory : delcom dwFactory : return } newcom dcRT, ID2D1DCRenderTarget, -1, pv dim curDWInfo, 3 mref bmscr, 67 GetObjectA bmscr(38), 60, varptr(prm) dupptr dp, varptr(prm) + 28, 32, 2 if ( prm < 0 ){ prm *= -1 } DWMes2Make curDWInfo, hdc, dp, prm, 400, ginfo_r, ginfo_g, ginfo_b return #deffunc DWMes str s GetClientRect hwnd, varptr(prm) ID2D1DCRenderTarget_BindDC dcRT, hdc, prm MultiByteToWideChar 0, 0, s, -1, 0, 0 if ( stat == 0 ){ return } prm(4) = stat - 1, d2f(ginfo_cx), d2f(ginfo_cy), d2f(prm(2)), d2f(prm(3)) ID2D1DCRenderTarget_BeginDraw dcRT ID2D1DCRenderTarget_DrawText dcRT, s, prm(4), curDWInfo(1), prm(5), curDWInfo(2), 0, 0 ID2D1DCRenderTarget_EndDraw dcRT, 0, 0 IDWriteFactory_CreateTextLayout dwFactory, s, prm(4), curDWInfo(1), prm(7), prm(8), pv newcom objTmp, IDWriteTextLayout, -1, pv IDWriteTextLayout_GetMetrics objTmp, prm bmscr(28) += f2d(prm(4)) objTmp = 0 if ( wpeek(bmscr, 78) ){ redraw 1 } return #deffunc DWMesFont str fontName, int size, int weight DWMes2Font curDWInfo, fontName, size, weight return #deffunc DWMesColor int r, int g, int b DWMes2Color curDWInfo, r, g, b return #deffunc DWMesGetSize str s, int w, int h, array rc DWMes2GetSize curDWInfo, s, w, h, rc return #deffunc DWMesOpacity int opacity DWMes2Opacity curDWInfo, opacity return #defcfunc DWMesGetTextAlignment return DWMes2GetTextAlignment(curDWInfo) #deffunc DWMesSetTextAlignment int b DWMes2SetTextAlignment curDWInfo, b return #defcfunc DWMesGetParagraphAlignment return DWMes2GetParagraphAlignment(curDWInfo) #deffunc DWMesSetParagraphAlignment int b DWMes2SetParagraphAlignment curDWInfo, b return #defcfunc DWMesGetWordWrapping return DWMes2GetWordWrapping(curDWInfo) #deffunc DWMesSetWordWrapping int b DWMes2SetWordWrapping curDWInfo, b return #defcfunc DWMesGetReadingDirection return DWMes2GetReadingDirection(curDWInfo) #deffunc DWMesSetReadingDirection int b DWMes2SetReadingDirection curDWInfo, b return #defcfunc DWMesGetFlowDirection return DWMes2GetFlowDirection(curDWInfo) #deffunc DWMesSetFlowDirection int b DWMes2SetFlowDirection curDWInfo, b return #defcfunc DWMesGetTabStop return DWMes2GetTabStop(curDWInfo) #deffunc DWMesSetTabStop int size DWMes2SetTabStop curDWInfo, d2f(size) return #defcfunc DWMesGetTrimmingOption return DWMes2GetTrimmingOption(curDWInfo) #defcfunc DWMesGetTrimmingObj return DWMes2GetTrimmingObj(curDWInfo) #deffunc DWMesSetTrimming int option, int bObj DWMes2SetTrimming curDWInfo, option, bObj return #defcfunc DWMesGetLineSpacingMethod return DWMes2GetLineSpacingMethod(curDWInfo) #defcfunc DWMesGetLineSpacingHeight return DWMes2GetLineSpacingHeight(curDWInfo) #defcfunc DWMesGetLineSpacingBase return DWMes2GetLineSpacingBase(curDWInfo) #deffunc DWMesSetLineSpacing int method, double h, double base DWMes2SetLineSpacing curDWInfo, method, h, base return #deffunc DWMesClear int r, int g, int b GetClientRect hwnd, varptr(prm) ID2D1DCRenderTarget_BindDC dcRT, hdc, prm ID2D1DCRenderTarget_BeginDraw dcRT prm = d2f(1.0 * r / 255), d2f(1.0 * g / 255), d2f(1.0 * b / 255), d2f(1.0) ID2D1DCRenderTarget_Clear dcRT, prm ID2D1DCRenderTarget_EndDraw dcRT, 0, 0 mref bmscr, 67 if ( wpeek(bmscr, 78) ){ redraw 1 } return #deffunc DWMesTransform array p ID2D1DCRenderTarget_SetTransform dcRT, p return #deffunc DWMesScale double sx, double sy, double x, double y prm = d2f(sx), 0, 0, d2f(sy), d2f(x - x * sx), d2f(y - y * sy) ID2D1DCRenderTarget_SetTransform dcRT, prm return #deffunc DWMesRotate double r, double x, double y D2D1MakeRotateMatrix d2f(r), d2f(x), d2f(y), prm ID2D1DCRenderTarget_SetTransform dcRT, prm return #deffunc DWMesSkew double rx, double ry, double x, double y D2D1MakeSkewMatrix d2f(rx), d2f(ry), d2f(x), d2f(y), prm ID2D1DCRenderTarget_SetTransform dcRT, prm return #deffunc DWMesHorizen DWMes2Horizen curDWInfo return #deffunc DWMesVertical DWMes2Vertical curDWInfo return #deffunc DWMes2Begin array dwInfo, int x, int y, int w, int h prm = x, y, w, h ID2D1DCRenderTarget_BindDC dcRT, dwInfo(0), prm ID2D1DCRenderTarget_BeginDraw dcRT return #deffunc DWMes2End ID2D1DCRenderTarget_EndDraw dcRT, 0, 0 return #deffunc DWMes2 array dwInfo, str s, int x, int y, int w, int h prm = d2f(x), d2f(y), d2f(w), d2f(h) MultiByteToWideChar 0, 0, s, -1, 0, 0 ID2D1DCRenderTarget_DrawText dcRT, s, stat - 1, dwInfo(1), prm, dwInfo(2), 0, 0 return #deffunc DWMes2Make array dwInfo, int hdc_, str fontName, int size, int weight, int r, int g, int b dim dwInfo, 3 dwInfo = hdc_ DWMes2Font dwInfo, fontName, size, weight DWMes2Color dwInfo, r, g, b return #deffunc DWMes2Free array dwInfo newcom objTmp, IDWriteTextFormat, -1, dwInfo(1) : delcom objTmp newcom objTmp, ID2D1SolidColorBrush, -1, dwInfo(2) : delcom objTmp repeat 3 : dwInfo(cnt) = 0 : loop objTmp = 0 return #deffunc DWMes2Font array dwInfo, str fontName, int size, int weight if ( dwInfo(1) ){ if ( dwInfo(1) == curDWInfo(1) ){ delcom curTextFormat } else { newcom objTmp, IDWriteTextFormat, -1, dwInfo(1) delcom objTmp } dwInfo(1) = 0 } prm = weight, size if ( prm == 0 ){ prm = 400 } if ( size < 0 ){ prm(1) *= -1 } IDWriteFactory_CreateTextFormat dwFactory, fontName, 0, prm, 0, 5, d2f(prm(1)), "", dwInfo(1) if ( stat ){ return } if ( dwInfo(1) == curDWInfo(1) ){ newcom curTextFormat, IDWriteTextFormat, -1, dwInfo(1) DWMesSetWordWrapping 1 } else { DWMes2SetWordWrapping dwInfo, 1 } return #deffunc DWMes2Color array dwInfo, int r, int g, int b prm = d2f(1.0 * r / 255), d2f(1.0 * g / 255), d2f(1.0 * b / 255), d2f(1.0) if ( dwInfo(2) == 0 ){ ID2D1DCRenderTarget_CreateSolidColorBrush dcRT, prm, 0, dwInfo(2) if ( dwInfo(2) == curDWInfo(2) ){ newcom curBrush, ID2D1SolidColorBrush, -1, dwInfo(2) } } else { if ( dwInfo(2) == curDWInfo(2) ){ ID2D1SolidColorBrush_SetColor curBrush, prm } else { newcom objTmp, ID2D1SolidColorBrush, -2, dwInfo(2) ID2D1SolidColorBrush_SetColor objTmp, prm } } return #deffunc DWMes2GetSize array dwInfo, str s, int w, int h, array rc MultiByteToWideChar 0, 0, s, -1, 0, 0 if ( stat == 0 ){ return } IDWriteFactory_CreateTextLayout dwFactory, s, stat - 1, dwInfo(1), d2f(w), d2f(h), pv newcom objTmp, IDWriteTextLayout, -1, pv IDWriteTextLayout_GetMetrics objTmp, prm dim rc, 4 rc = int(f2d(prm(0))), int(f2d(prm(1))), int(f2d(prm(2))), int(f2d(prm(4))) rc(2) += rc(0) : rc(3) += rc(1) objTmp = 0 return #deffunc DWMes2Opacity array dwInfo, int opacity newcom objTmp, ID2D1SolidColorBrush, -2, dwInfo(2) ID2D1SolidColorBrush_SetOpacity objTmp, d2f(1.0 * opacity / 100) return #defcfunc DWMes2GetTextAlignment array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_GetTextAlignment objTmp return stat #deffunc DWMes2SetTextAlignment array dwInfo, int b newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_SetTextAlignment objTmp, b return #defcfunc DWMes2GetParagraphAlignment array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_GetParagraphAlignment objTmp return stat #deffunc DWMes2SetParagraphAlignment array dwInfo, int b newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_SetParagraphAlignment objTmp, b return #defcfunc DWMes2GetWordWrapping array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_GetWordWrapping objTmp return stat #deffunc DWMes2SetWordWrapping array dwInfo, int b newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_SetWordWrapping objTmp, b return #defcfunc DWMes2GetReadingDirection array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_SetReadingDirection objTmp return stat #deffunc DWMes2SetReadingDirection array dwInfo, int b newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_SetReadingDirection objTmp, b return #defcfunc DWMes2GetFlowDirection array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_GetFlowDirection objTmp return stat #deffunc DWMes2SetFlowDirection array dwInfo, int b newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_SetFlowDirection objTmp, b return #defcfunc DWMes2GetTabStop array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_GetIncrementalTabStop objTmp return GetF2D() #deffunc DWMes2SetTabStop array dwInfo, int size newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_SetIncrementalTabStop objTmp, d2f(size) return #defcfunc DWMes2GetTrimmingOption array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_GetTrimming objTmp, prm, 0 return prm #defcfunc DWMes2GetTrimmingObj array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_GetTrimming objTmp, prm, prm(1) return prm(1) #deffunc DWMes2SetTrimming array dwInfo, int option, int bObj newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) if ( bObj == 0 ){ pv = 0 } else { IDWriteFactory_CreateEllipsisTrimmingSign dwFactory, curDWInfo(1), pv newcom objTmp2, IDWriteInlineObject, -1, pv } prm = option IDWriteTextFormat_SetTrimming objTmp, prm, pv if ( bObj ){ delcom objTmp2 } objTmp = 0 return #defcfunc DWMes2GetLineSpacingMethod array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_GetLineSpacing objTmp, prm(0), prm(1), prm(2) return prm #defcfunc DWMes2GetLineSpacingHeight array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_GetLineSpacing objTmp, prm(0), prm(1), prm(2) return f2d(prm(1)) #defcfunc DWMes2GetLineSpacingBase array dwInfo newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_GetLineSpacing objTmp, prm(0), prm(1), prm(2) return f2d(prm(2)) #deffunc DWMes2SetLineSpacing array dwInfo, int method, double h, double base newcom objTmp, IDWriteTextFormat, -2, dwInfo(1) IDWriteTextFormat_SetLineSpacing objTmp, method, d2f(h), d2f(base) return #deffunc DWMes2Clear array dwInfo, int r, int g, int b prm = d2f(1.0 * r / 255), d2f(1.0 * g / 255), d2f(1.0 * b / 255), d2f(1.0) ID2D1DCRenderTarget_Clear dcRT, prm return #deffunc DWMes2Horizen array dwInfo DWMes2SetTextAlignment dwInfo, 0 DWMes2SetParagraphAlignment dwInfo, 0 DWMes2SetReadingDirection dwInfo, 0 DWMes2SetFlowDirection dwInfo, 0 DWMes2SetWordWrapping dwInfo, 0 return #deffunc DWMes2Vertical array dwInfo DWMes2SetTextAlignment dwInfo, 0 DWMes2SetParagraphAlignment dwInfo, 0 DWMes2SetReadingDirection dwInfo, 2 DWMes2SetFlowDirection dwInfo, 3 DWMes2SetWordWrapping dwInfo, 0 return #global DWMes_Init #endif // MOD_DWMES_HSP_
コメント ( 0 ) | Trackback ( 0 )
ガンマ設定
モジュール mod_SetGamma - ディスプレイのガンマを設定
- ディスプレイのガンマ値を設定。画面が暗すぎて(明るすぎて)文字が見えない時等に利用可能。 命令:
- SetGamma gamma
- gamma: double値を指定。0.23から4.4位の値を指定。1.0がデフォルト。
mod_SetGamma.hsp
#ifndef MOD_SETGAMMA_HSP_ #define MOD_SETGAMMA_HSP_ #include "user32.as" #include "gdi32.as" #module mod_SetGamma #deffunc SetGamma double gamma sdim ramp, 2* 256 * 3 repeat 256 d = powf((1.0 + cnt) / 256.0, gamma) * 65535 + 0.5 if ( d < 0.0 ){ d = 0.0 } if ( d > 65535.0 ){ d = 65535.0 } i = int(d) & 0xffff tmp = cnt * 2 wpoke ramp, tmp, i wpoke ramp, tmp + 512, i wpoke ramp, tmp + 1024, i loop GetDC 0 : tmp = stat SetDeviceGammaRamp tmp, varptr(ramp) ReleaseDC 0, tmp return #global #endif // MOD_SETGAMMA_HSP_
サンプル
#include "mod_SetGamma.hsp" screen 0, 300, 200 title "mod_SetGamma 0.3 - 4.4" x = ginfo(12) : y = 20 pos 0, 0 winobj "EDIT", "1.0", 0, 0x50000000, 100, y, 0x8000, 0 hEdit = objinfo(stat, 2) winobj "msctls_updown32", "", 0, 0x5000_0024, 0, 0, 0x8001, 0 hUpDown = objinfo(stat, 2) sendmsg hUpDown, 0x0469, hEdit, 0 sendmsg hUpDown, 0x046f, 0, 41 sendmsg hUpDown, 0x0467, 0, 7 pos x - 200, 0 : objsize 200, y button gosub "変更", *SET_GAMMA font msgothic, 32 buf = "■□表示テスト□■" color 32, 32, 32 : boxf 0, y, x, y + 90 color 48, 48, 48: pos 10, y + 25 : mes buf y += 90 color 255, 255, 255 : boxf 0, y, x, y + 90 color 240, 240, 240: pos 10, y + 25 : mes buf oncmd gosub *WM_NOTIFY, 0x004e stop *SET_GAMMA GetWindowText hEdit, varptr(buf), 64 if ( stat == 0 ){ return } d = double(buf) if ( d < 0.2 || 4.4 < d ){ buf = "err" SetWindowText hEdit, varptr(buf) return } SetGamma d return *WM_NOTIFY if ( wparam == 0x8001 ){ dupptr nmUD, lparam, 24, 4 buf = strf("%.1f", 0.1 * nmUD(3) + 0.3) SetWindowText hEdit, varptr(buf) } return</pre>
コメント ( 0 ) | Trackback ( 0 )
« 前ページ | 次ページ » |