Created dll project, already including basic AHK interface functionality
This commit is contained in:
		
							parent
							
								
									700340684a
								
							
						
					
					
						commit
						6df7fec2b0
					
				
							
								
								
									
										31
									
								
								OSC2AHK.sln
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								OSC2AHK.sln
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,31 @@ | ||||
|  | ||||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||||
| # Visual Studio Version 16 | ||||
| VisualStudioVersion = 16.0.31112.23 | ||||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OSC2AHK", "OSC2AHK\OSC2AHK.vcxproj", "{637B560B-0B6A-4EF8-B45B-61459545F6A3}" | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|x64 = Debug|x64 | ||||
| 		Debug|x86 = Debug|x86 | ||||
| 		Release|x64 = Release|x64 | ||||
| 		Release|x86 = Release|x86 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||||
| 		{637B560B-0B6A-4EF8-B45B-61459545F6A3}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{637B560B-0B6A-4EF8-B45B-61459545F6A3}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{637B560B-0B6A-4EF8-B45B-61459545F6A3}.Debug|x86.ActiveCfg = Debug|Win32 | ||||
| 		{637B560B-0B6A-4EF8-B45B-61459545F6A3}.Debug|x86.Build.0 = Debug|Win32 | ||||
| 		{637B560B-0B6A-4EF8-B45B-61459545F6A3}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{637B560B-0B6A-4EF8-B45B-61459545F6A3}.Release|x64.Build.0 = Release|x64 | ||||
| 		{637B560B-0B6A-4EF8-B45B-61459545F6A3}.Release|x86.ActiveCfg = Release|Win32 | ||||
| 		{637B560B-0B6A-4EF8-B45B-61459545F6A3}.Release|x86.Build.0 = Release|Win32 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ExtensibilityGlobals) = postSolution | ||||
| 		SolutionGuid = {C78C981F-16A4-4CF8-9342-48C28379B77C} | ||||
| 	EndGlobalSection | ||||
| EndGlobal | ||||
							
								
								
									
										170
									
								
								OSC2AHK/OSC2AHK.vcxproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										170
									
								
								OSC2AHK/OSC2AHK.vcxproj
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,170 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup Label="ProjectConfigurations"> | ||||
|     <ProjectConfiguration Include="Debug|Win32"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|Win32"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Debug|x64"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|x64"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|   </ItemGroup> | ||||
|   <PropertyGroup Label="Globals"> | ||||
|     <VCProjectVersion>16.0</VCProjectVersion> | ||||
|     <Keyword>Win32Proj</Keyword> | ||||
|     <ProjectGuid>{637b560b-0b6a-4ef8-b45b-61459545f6a3}</ProjectGuid> | ||||
|     <RootNamespace>OSC2AHK</RootNamespace> | ||||
|     <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <PlatformToolset>v142</PlatformToolset> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <PlatformToolset>v142</PlatformToolset> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <PlatformToolset>v142</PlatformToolset> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>DynamicLibrary</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <PlatformToolset>v142</PlatformToolset> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||||
|   <ImportGroup Label="ExtensionSettings"> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="Shared"> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <PropertyGroup Label="UserMacros" /> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <LinkIncremental>true</LinkIncremental> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <LinkIncremental>false</LinkIncremental> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <LinkIncremental>true</LinkIncremental> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <LinkIncremental>false</LinkIncremental> | ||||
|   </PropertyGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <SDLCheck>true</SDLCheck> | ||||
|       <PreprocessorDefinitions>WIN32;_DEBUG;OSC2AHK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <ConformanceMode>true</ConformanceMode> | ||||
|       <PrecompiledHeader>Use</PrecompiledHeader> | ||||
|       <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <EnableUAC>false</EnableUAC> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <SDLCheck>true</SDLCheck> | ||||
|       <PreprocessorDefinitions>WIN32;NDEBUG;OSC2AHK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <ConformanceMode>true</ConformanceMode> | ||||
|       <PrecompiledHeader>Use</PrecompiledHeader> | ||||
|       <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <EnableUAC>false</EnableUAC> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <SDLCheck>true</SDLCheck> | ||||
|       <PreprocessorDefinitions>_DEBUG;OSC2AHK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <ConformanceMode>true</ConformanceMode> | ||||
|       <PrecompiledHeader>Use</PrecompiledHeader> | ||||
|       <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <EnableUAC>false</EnableUAC> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <SDLCheck>true</SDLCheck> | ||||
|       <PreprocessorDefinitions>NDEBUG;OSC2AHK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <ConformanceMode>true</ConformanceMode> | ||||
|       <PrecompiledHeader>Use</PrecompiledHeader> | ||||
|       <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Windows</SubSystem> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|       <EnableUAC>false</EnableUAC> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="dllmain.h" /> | ||||
|     <ClInclude Include="framework.h" /> | ||||
|     <ClInclude Include="pch.h" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="dllmain.cpp" /> | ||||
|     <ClCompile Include="pch.cpp"> | ||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> | ||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> | ||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> | ||||
|       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||||
|   <ImportGroup Label="ExtensionTargets"> | ||||
|   </ImportGroup> | ||||
| </Project> | ||||
							
								
								
									
										36
									
								
								OSC2AHK/OSC2AHK.vcxproj.filters
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								OSC2AHK/OSC2AHK.vcxproj.filters
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,36 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup> | ||||
|     <Filter Include="Source Files"> | ||||
|       <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||||
|       <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||||
|     </Filter> | ||||
|     <Filter Include="Header Files"> | ||||
|       <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||||
|       <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions> | ||||
|     </Filter> | ||||
|     <Filter Include="Resource Files"> | ||||
|       <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||||
|       <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | ||||
|     </Filter> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="framework.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="pch.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|     <ClInclude Include="dllmain.h"> | ||||
|       <Filter>Header Files</Filter> | ||||
|     </ClInclude> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="dllmain.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="pch.cpp"> | ||||
|       <Filter>Source Files</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
							
								
								
									
										81
									
								
								OSC2AHK/dllmain.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										81
									
								
								OSC2AHK/dllmain.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,81 @@ | ||||
| // dllmain.cpp : Defines the entry point for the DLL application.
 | ||||
| #include "pch.h" | ||||
| #include "dllmain.h" | ||||
| #include <string> | ||||
| #include <vector> | ||||
| 
 | ||||
| /* Definition and declaration of the OSC Listeners. 
 | ||||
| * Contains OSC addresses to listen to and OS message ID to send for each  | ||||
| * address */ | ||||
| struct Listener { | ||||
|     std::string address; | ||||
|     unsigned int message; | ||||
| }; | ||||
| std::vector<Listener> listeners; | ||||
| /* Handle to the calling window */ | ||||
| HWND hwnd = NULL; | ||||
| 
 | ||||
| BOOL APIENTRY DllMain( HMODULE hModule, | ||||
|                        DWORD  ul_reason_for_call, | ||||
|                        LPVOID lpReserved | ||||
|                      ) | ||||
| { | ||||
|     switch (ul_reason_for_call) | ||||
|     { | ||||
|     case DLL_PROCESS_ATTACH: | ||||
|     case DLL_THREAD_ATTACH: | ||||
|         break; | ||||
|     case DLL_THREAD_DETACH: | ||||
|     case DLL_PROCESS_DETACH: | ||||
|         close(); | ||||
|         break; | ||||
|     } | ||||
|     return TRUE; | ||||
| } | ||||
| 
 | ||||
| DLLEXPORT int open(HWND targetWindowHandle, unsigned int port) | ||||
| { | ||||
|     hwnd = targetWindowHandle; | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| DLLEXPORT int close() | ||||
| { | ||||
|     hwnd = NULL; | ||||
|     listeners.clear(); | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| DLLEXPORT int addListener(std::string address, unsigned int messageID) | ||||
| { | ||||
|     listeners.push_back(Listener{ address, messageID }); | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| DLLEXPORT int removeListener(std::string address) | ||||
| { | ||||
|     UINT result = 1; | ||||
| 
 | ||||
|     //All OSC addresses have to start with a '/'
 | ||||
|     if (address[0] != '/') address.insert(0, "/"); | ||||
| 
 | ||||
|     for (UINT i = 0; i < listeners.size(); i++) | ||||
|     { | ||||
|         if (listeners[i].address == address) | ||||
|         { | ||||
|             listeners.erase(listeners.begin() + i); | ||||
|             i--; //one step backward, what previously was i+1 is i after erase().
 | ||||
|             result = 0; //Found at least one occurence
 | ||||
|         } | ||||
|     } | ||||
|     return result; | ||||
| } | ||||
| 
 | ||||
| /* Debugging function to test messaging. Probably will be removed later. */ | ||||
| DLLEXPORT int testMsg(HWND windowHandle, unsigned int messageID) | ||||
| { | ||||
|     if (PostMessage(windowHandle, messageID, 42, 43)) | ||||
|         return 0; | ||||
|     else | ||||
|         return 1; | ||||
| } | ||||
							
								
								
									
										12
									
								
								OSC2AHK/dllmain.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								OSC2AHK/dllmain.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| #pragma once | ||||
| 
 | ||||
| #include <windows.h> | ||||
| #include <string> | ||||
| 
 | ||||
| #define DLLEXPORT __declspec(dllexport) | ||||
| 
 | ||||
| extern "C" DLLEXPORT int open(HWND targetWindowHandle, unsigned int port); | ||||
| extern "C" DLLEXPORT int close(); | ||||
| extern "C" DLLEXPORT int addListener(std::string address, unsigned int messageID); | ||||
| extern "C" DLLEXPORT int removeListener(std::string address); | ||||
| extern "C" DLLEXPORT int testMsg(HWND windowHandle, unsigned int messageID); | ||||
							
								
								
									
										5
									
								
								OSC2AHK/framework.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								OSC2AHK/framework.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| #pragma once | ||||
| 
 | ||||
| #define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
 | ||||
| // Windows Header Files
 | ||||
| #include <windows.h> | ||||
							
								
								
									
										5
									
								
								OSC2AHK/pch.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								OSC2AHK/pch.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| // pch.cpp: source file corresponding to the pre-compiled header
 | ||||
| 
 | ||||
| #include "pch.h" | ||||
| 
 | ||||
| // When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
 | ||||
							
								
								
									
										13
									
								
								OSC2AHK/pch.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								OSC2AHK/pch.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| // pch.h: This is a precompiled header file.
 | ||||
| // Files listed below are compiled only once, improving build performance for future builds.
 | ||||
| // This also affects IntelliSense performance, including code completion and many code browsing features.
 | ||||
| // However, files listed here are ALL re-compiled if any one of them is updated between builds.
 | ||||
| // Do not add files here that you will be updating frequently as this negates the performance advantage.
 | ||||
| 
 | ||||
| #ifndef PCH_H | ||||
| #define PCH_H | ||||
| 
 | ||||
| // add headers that you want to pre-compile here
 | ||||
| #include "framework.h" | ||||
| 
 | ||||
| #endif //PCH_H
 | ||||
							
								
								
									
										44
									
								
								msgtest.ahk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								msgtest.ahk
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,44 @@ | ||||
| #SingleInstance, Force | ||||
| SendMode Input | ||||
| SetWorkingDir, %A_ScriptDir% | ||||
| hWnd := WinExist() | ||||
| 
 | ||||
| stdout := FileOpen("tmp.log", "w") | ||||
| stdout.WriteLine("START") | ||||
| 
 | ||||
| retOnMsg := OnMessage(0x1000, "msghandler") | ||||
| stdout.WriteLine("OnMessage:") | ||||
| stdout.WriteLine(retOnMsg) | ||||
| OnExit("exithandler") | ||||
| 
 | ||||
| hModule := DllCall("LoadLibrary", "Str", "x64\Debug\OSC2AHK.dll", "Ptr")  ; Avoids the need for DllCall() in the loop to load the library. | ||||
| stdout.WriteLine("DLL handle:") | ||||
| stdout.WriteLine(hModule) | ||||
| 
 | ||||
| ret := DllCall("OSC2AHK.dll\testMsg", UInt,hWnd, UInt,0x1000) | ||||
| stdout.WriteLine("DLL call:") | ||||
| stdout.WriteLine(ret) | ||||
| 
 | ||||
| stdout.Close() | ||||
| 
 | ||||
| return | ||||
| 
 | ||||
| msghandler(wParam, lParam, msg, hwnd) { | ||||
|     stdout := FileOpen("tmp.log", "a") | ||||
|     stdout.WriteLine("Received MSG!") | ||||
|     stdout.WriteLine(wParam) | ||||
|     stdout.WriteLine(lParam) | ||||
|     stdout.Close() | ||||
| } | ||||
| 
 | ||||
| exithandler() { | ||||
|     stdout := FileOpen("tmp.log", "a") | ||||
|     stdout.WriteLine("The End") | ||||
|     stdout.Close() | ||||
| } | ||||
| 
 | ||||
| do_exit: | ||||
| ExitApp | ||||
| return ; unnecessary redundancy? | ||||
| 
 | ||||
| Esc::GoSub, do_exit | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user