Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have find batch file that start wifi hotspot automaticaly ,So I need to make a program in visual studio to run that batch file
Execute batch-file to start wifi hotspot as admin
// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "YOURBATCHFILE.bat";
p.Start();
// Do not wait for the child process to exit before
// reading to the end of its redirected stream.
// p.WaitForExit();
// Read the output stream first and then wait.
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
Code is from MSDN.
Simply Write a program containing this line of code:
System.Diagnostics.Process.Start("c:\\batchfilename.bat");
Should work for your belonings.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
ARCHITECTURE synthesis1 OF vending IS
TYPE statetype IS (Idle, Opt1, Opt2, Error);
SIGNAL currentstate, nextstate : statetype;
BEGIN
fsm1: PROCESS( buttons, currentstate ) -- Is necessary to give the PROCESS bl a name?
BEGIN
-- Process the input
END PROCESS;
END synthesis1;
Is necessary to give the Process a name? Why should I set the name?
No. It is not necessary. It is optional. However, sometimes it is useful to give a process (or other statement) a name, for example, to make your code easier to read.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Yes, I realize I can just look at the green-light when the video camera is on. That's not the point.
I'd like to write a little utility that notices when the mic or video camera is in use. I don't have any interest in knowing what app is using it. I just want to know if the mic / camera on or off.
This is for me as a parent. I was thinking I could get one of those color changing LED lights, and then when the camera/mic is on, my app could detect it, then send a signal to the light to change color. Then when one of my kids walks in, they'd see the light is "red" (meaning, do not disturb) and they'd know I'm on a conference call.
I have pretty much the exact same problem to solve. This is my prototype solution. It monitors the number of threads of the AppleCamera process. On the test macbook, the base number of threads seems to be 3. When an application uses the camera, the count increases to 4. I plan to implement microphone checking as well. I'm sure my code could be more compact and I could get the shell commands down to a one-liner but I prefer readability.
import subprocess
import pywemo
DEVICE_NAME = "BatSignal"
def count_camera_threads():
command = ["pgrep", "AppleCamera"]
process = subprocess.run(command, capture_output=True, text=True)
pid = process.stdout.replace("\n", "")
command = ["ps", "M", pid]
process = subprocess.run(command, capture_output=True, text=True)
lines = process.stdout
count = len(lines.splitlines()) - 2
return count
def get_device(name):
devices = pywemo.discover_devices()
for device in devices:
if device.name == name:
return device
return None
if __name__ == "__main__":
device = get_device(DEVICE_NAME)
if device is None:
exit(f"Unable to find '{DEVICE_NAME}' on network")
while True:
if count_camera_threads() > 3:
device.on()
else:
device.off()
time.sleep(1)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am new here and am trying to develop a concept fs driver for the tar 'filesystem' (mount tar). My question is, how does the OS detect that a partition has the TAR filesystem and automatically load my driver?
first of all loaded FS called IoRegisterFileSystem - this routine inserts the device object into the list of file systems in the system. then you must have a WRK. when say file opened on device with VPB IopCheckVpbMounted is called and he call IopMountVolume - this is key point for mount understand. this routine first walk through list with registered FS and send IRP_MN_MOUNT_VOLUME to all until some FS not return success code. also the last entry in the list - special File system recognizer - he try determinate format of the volume. and if yes - he return STATUS_FS_DRIVER_REQUIRED - indicates that need load new FS for this volume. system in this case call IopLoadFileSystemDriver. this routine is invoked when a mini-file system recognizer driver recognizes a volume as being a particular file system, but the driver for that file system has not yet been loaded. at the current moment FS_Rec.sys support next FS:
cdfs
ReFS
ReFSv1 // begin from win 10
ExFat
FastFat
Udfs
Ntfs
for support other - you need or auto load self FS driver or self recognizer (mini driver) which recognize your FS and return STATUS_FS_DRIVER_REQUIRED on IRP_MJ_FILE_SYSTEM_CONTROL.IRP_MN_MOUNT_VOLUME and load your FS (by ZwLoadDriver call ) on IRP_MJ_FILE_SYSTEM_CONTROL.IRP_MN_LOAD_FILE_SYSTEM
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I want to write a procedure that creates a beep sound on Windows, using assembly language.
How can I do that? Do you have any starting point idea?
In MS-DOS, which is what many assembly novices are targeting without even knowing it, outputting character ASCII 7 (BEL) via interrupt 21h, function AH=2 will do it:
mov ah, 2
mov dl, 7
int 21h
In Windows, call the MessageBeep() API function, passing 0xffffffff as the parameter. The function resides in User[32].dll; depending on your assembler, the sequence for importing an API function might vary.
If by "Windows" you mean "DOS executable running under Windows", which some people occasionally do, then back to int21h.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a long ruby script running on a machine and I thought of re-organizing it by dividing it into small functions and sending the socket as a parameter:
#!/usr/bin/env ruby
def prepare data, my_socket
# some calculations
my_socket.write data
end
# execution starts here
tcpsocket = TCPSocket.open host, port
data = "xxx"
prepare(data, tcpsocket)
Unfortunately I can't test.
EDIT: Now that I understood that I shouldn't do that (I will read on the subject later), this is what I did:
#!/usr/bin/env ruby
def prepare data
my_array = []
# some calculations
my_array << data
end
# execution starts here
tcpsocket = TCPSocket.open host, port
data = "xxx"
my_array = prepare data
my_array.each do |m|
my_socket.write m
end
tcpsocket is a local identifier (file descriptor) for a given socket-endpoint.
You would not achieve anything by sending the file descriptor of one host to another host. Without the kernel (or process) hosting the file-descriptor, tcpsocket means nothing. Typically, the kernel would have a mapping of file-descriptor and the socket structure. If you send the tcpsocket file-descriptor to the other side, the other side would not have the corresponding socket structure.
Accordingly, operations on the passed file-descriptor would fail with a bad file-descriptor error. In the worst case, if the process on the remote host has another file-descriptor with the same value, then this would cause unexpected things!