-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtryInvokePy.py
More file actions
86 lines (83 loc) · 2.9 KB
/
tryInvokePy.py
File metadata and controls
86 lines (83 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import ctypes
import os
#my_dll = ctypes.CDLL('D:\\DeveloperStuff\\Cpp\\Microphone_Info\\x64\\Release\\Microphone_Info_DLL.dll')
my_dll = ctypes.CDLL(f"{os.getcwd()}\\Microphone_Info_DLL.dll")
my_dll.getMicUsage_JSON.restype = ctypes.c_char_p
result = my_dll.getMicUsage_JSON()
result_str = result.decode('utf-8')
import json
print(json.loads(result_str))
#
#import ctypes
#
## Load the DLL
##my_dll = ctypes.CDLL('D:\\DeveloperStuff\\Python\\WindowsAutomations\\Microphone_Info\\Microphone_Info_DLL.dll')
#
#my_dll = ctypes.CDLL('D:\\DeveloperStuff\\Cpp\\Microphone_Info\\x64\\Release\\Microphone_Info_DLL.dll')
#
## Define the MicrophoneDataHandle type
#MicrophoneDataHandle = ctypes.c_void_p
#
## Define the return type for the functions
#my_dll.getMicrophoneUsageStats.restype = MicrophoneDataHandle
#
#my_dll.printMicUsageStats_JSON.argtypes = [MicrophoneDataHandle]
#
## Call the function to get microphone usage stats
#microphone_data = my_dll.getMicrophoneUsageStats()
## Call the function to print microphone usage stats
#my_dll.printMicUsageStats_JSON(microphone_data)
#
#
#
#
#
#import ctypes
#my_dll = ctypes.CDLL('D:\\DeveloperStuff\\Cpp\\Microphone_Info\\x64\\Release\\Microphone_Info_DLL.dll')
#my_dll.getMicrophoneUsageStatsJsonWrapper.restype = ctypes.c_char_p
#json_str = my_dll.getMicrophoneUsageStatsJsonWrapper()
#print(json_str)
#
#json_str = my_dll.getMicrophoneUsageStatsJsonWrapper().decode('utf-8')
## Parse the JSON string
#microphone_json = json.loads(json_str)
#
## Now, you can work with the JSON data in Python
#print(microphone_json)
#
#import ctypes
#my_dll = ctypes.CDLL('D:\\DeveloperStuff\\Cpp\\Microphone_Info\\x64\\Release\\Microphone_Info_DLL.dll')
#my_dll.get_greeting.restype = ctypes.c_char_p
#result = my_dll.get_greeting()
#result_str = result.decode('utf-8')
#print(result_str)
#
#import ctypes
#my_dll = ctypes.CDLL('D:\\DeveloperStuff\\Cpp\\Microphone_Info\\x64\\Release\\Microphone_Info_DLL.dll')
#my_dll.getMicUsage_JSON.restype = ctypes.c_char_p
#result = my_dll.getMicUsage_JSON()
#result_str = result.decode('utf-8')
#print(result_str)
#
#
##
### Define the MicrophoneDataHandle type
##MicrophoneDataHandle = ctypes.c_void_p
##
### Declare the function prototype
##get_mic_usage_stats_json = my_dll.getMicUsageStats_JSON
##get_mic_usage_stats_json.restype = ctypes.c_char_p # The return type is a C string (char*)
##
### Call the function to get the microphone usage stats as JSON
##mic_data_handle = my_dll.getMicrophoneUsageStats()
##json_string = get_mic_usage_stats_json(mic_data_handle)
##
### Convert the C string to a Python string
##json_string = json_string.decode('utf-8')
##
### Print or use the JSON string as needed
##print(json_string)
##
### Remember to free the memory allocated by the C code
###mic_stats_dll.freeMicData.argtypes = [MicrophoneDataHandle]
###mic_stats_dll.freeMicData(mic_data_handle)