|
The Device has 4 videos capture entrance, the difficulty is to have access the library.(Drivers and API)
Thanks by the atençao!!
|
|
|
|
|
How many times are you going to ask? Read the documentation of your devices and read the posts people have given you already.
Stop repeating your question.
|
|
|
|
|
I did a search to see if this has already been answered, but didn't find anything (if it's already been answered, please just point me in the right direction).
I need to find out how to switch off the computer at runtime, meaning from a program, not by pushing the button on the tower . I suppose I could just create a process using shutdown.exe with args, but that actually shuts down Windows, and I want to bypass that. I have seen it done in the past (but I don't remember what program did it). I'm hoping there's some unmanaged function call (to some dll somewhere) that will simply power off the machine with no dialogs or anything. Just beeooooop, the machine is off.
Anyone?
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
I don't see why shutdown.exe would not suit this requirement.. to be honest I don't know of another way, and if it exists I'm not sure it would be entirely safe to the machine.
For no dialog, couldn't shutdown.exe -s -f work as you described?
|
|
|
|
|
EliottA wrote: to be honest I don't know of another way, and if it exists I'm not sure it would be entirely safe to the machine.
ExitWindowsEx[^] API does the job.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I'll look into this one, thank you!
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
shutdown.exe would shut down Windows and then turn off the machine (depending on the arguments). However, I wish to bypass the "shut down Windows" part and just turn off the machine from the program.
Yes, I know, it's not healthy. But I have a need regardless.
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
|
I'll look into this one, too, thank you!
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
Looking up WMI, it appears that the following should work like I want:
ManagementClass mc = new ManagementClass("CIM_PowerSupply");
object[] methodArgs = { 6, null };
object result = mc.InvokeMethod("SetPowerState", methodArgs);
However, the program crashes with a ManagementException, saying "This method is not implemented in any class." And, Microsoft's article on the SetPowerState function says "This method is currently not implemented by WMI. To use this method, you must implement it in your own provider."
It's kind of cruel to tease me with a function that doesn't actually do anything... Anyone know how it's supposed to be "implemented"?
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
|
yes shutdown sucks with shutdown.exe, specially in older windows version eg. XP
here is the code i use to shut my pc down
void Shutdown()
{
ManagementClass W32_OS = new ManagementClass("Win32_OperatingSystem");
ManagementBaseObject inParams, outParams;
int result;
W32_OS.Scope.Options.EnablePrivileges = true;
foreach (ManagementObject obj in W32_OS.GetInstances())
{
inParams = obj.GetMethodParameters("Win32Shutdown");
inParams["Flags"] = ShutDown.ForcedShutdown;
inParams["Reserved"] = 0;
outParams = obj.InvokeMethod("Win32Shutdown", inParams, null);
result = Convert.ToInt32(outParams["returnValue"]);
if (result != 0) throw new Win32Exception(result);
}
}
public enum ShutDown
{
LogOff = 0,
Shutdown = 1,
Reboot = 2,
ForcedLogOff = 4,
ForcedShutdown = 5,
ForcedReboot = 6,
PowerOff = 8,
ForcedPowerOff = 12
}
When you test this, save all your work. There is no way to stop this thing.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Thank you, Xmen, but the PowerOff and ForcedPowerOff enum values are deceptive. Yes, they do power off the computer, but they also shut down Windows before then. I was looking for a way to power off the computer without wasting time shutting down Windows (the computer just goes silent right after I double-click something.exe on my desktop). But, thanks anyway!
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
Hi all, quick question, using the following
using(DataModel.DatabaseDataContext context = GetDatabaseContext())<br />
var result = from b in context.Branches<br />
where b.Id == id<br />
select new Branch()<br />
{<br />
Id = b.Id,<br />
RowVersion = b.RowVersion.ToArray(),<br />
Name = b.Name,<br />
Description = b.Description<br />
};
I get a compiler error stating that an embedded statement cannot be a declaration or labbeled statement. I believe this is related to the return type from the Linq statement.
Is anybody able to point me in the correct direction of what this type should be? I have tried several types and get the impression that I have a fundamental misunderstanding.
Just racking up the postings
|
|
|
|
|
Did I understand correctly that you're querying for branches which have a specific id? I that's correct, I think it could be something like:
using(DataModel.DatabaseDataContext context = GetDatabaseContext()) {
var result = from b in context.Branches
where b.Id == id
select b;
foreach(Branch branch in result) {
...
}
}
|
|
|
|
|
How to have access the drivers and API?
|
|
|
|
|
|
|
I got a gridview with 12 unbound columns that is gonna be exported to Excel document. The exporting is already done but here is where im failing. Some cells can be empty in the gridview and trying to get its value will result in error: "Object reference not set to an instance of an object". Value property doesnt even seem to exist if its an empty cell.
This is how i do it now. Im sending the gridviews rowcollection to the method that exports it to excel. There i get the value from a cell with rows[index].Cells["columnname"].Value. Temporarily fixed it now with a try catch for every column as i got tired of it, but there must be another way.
|
|
|
|
|
I just did this a couple of days ago. Check for rows[i].Cells[j].Value == null. If my whole row is null I don't send that row since the gridview automatically creates the row and I may not have used it. Otherwise, set the data for that cell to "" so it doesn't cause an error.
string getCellValue(int row, int cell)
{
string rtn = "";
if (dataGridView1.Rows[row].Cells[0].Value != null) {
rtn = dataGridView1.Rows[i].Cells[0].Value.ToString();
}
return rtn;
}
But I like this better
string getCellValue(DataGridViewCell cell)
{
return (cell.Value != null ? cell.Value.ToString() : "");
}
SS => Qualified in Submarines
"We sleep soundly in our beds because rough men stand ready in the night to visit violence on those who would do us harm". Winston Churchill
|
|
|
|
|
I am creating a program that will simulate the functions of a robot by parsing a log file created by another program for a school placement. The problem here is I'm not really a programmer, I am a hardware/network guy but they assigned me this task anyways. If anyone can help with some resources that would help me out with this would be grateful.
|
|
|
|
|
There are many tool available in the market to read the log files.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
What format are your log files in, do you know? By that I meant do you know what program wrote them? or where they handwritten so to speak? If manual, do they follow a schema? (I'm thinking XML here)
|
|
|
|
|
The log is actually not really a file but created in ram and shown in a console like interface. However, I am not getting into that mess and have decided that the process to get the simulation running would be done by simply copying the log and pasting into a notepad document and saving. Short answer: txt. The logs are very structured and follow strict set of rules. I made a short set of instructions and this is what was spit out:
D 10:44:57 Starting program "Prog1" (lines 1 to 5)
A 10:44:57 initializing instrument
E 10:44:57 Line 1 : Dispense
tip 1 : dispense 0.00nl 1, 1 Deep Well, landscape [1,1]
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
E 10:44:59 Line 2 : Aspirate
tip 1 : aspirate 0.00nl 4, 5 Deep Well, landscape [1,2]
0.00nl "Water" Fixed <all volumes> Single
E 10:45:01 Line 3 : Aspirate
tip 1 : aspirate 10.56µl 4, 4 Deep Well, landscape [1,2]
10.00µl "Water" Fixed <3 - 50µl> Single
E 10:45:03 Line 4 : Dispense
tip 1 : dispense 20.56µl 6, 3 Deep Well, landscape [1,1]
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
E 10:45:05 Line 5 : Wash Tips
wash (2ml + 1ml), grid 20 and grid 20
|
|
|
|
|
To do it in a hurry, just infer what it looks like and parse it manually. If you want a more robust solution, write out a formal grammar for it, and use something like Percenburg Grammatica.
Theres another nice one whose name escapes me, which is used declaratively instead of using a grammar file and codegen. Argh. Ahah. Irony. Thank you CP search :P
|
|
|
|