|
Please post in English ... use Google translator if necessary.
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
|
|
|
|
|
Hello everybody, this is my first message on this forum.
I have this code for click in a specific position xy, works fine, but I'd like click without use user mouse, what is the correct way? thanks!
current code with real movement:
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern bool SetCursorPos(int x, int y);
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);
private const int MOUSEEVENTF_LEFTDOWN = 0x02;
private const int MOUSEEVENTF_LEFTUP = 0x04;
private static void LeftMouseClick(int Xposition, int Yposition)
{
SetCursorPos(Xposition, Yposition);
mouse_event(MOUSEEVENTF_LEFTDOWN, Xposition, Yposition, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, Xposition, Yposition, 0, 0);
SetCursorPos(935, 535);
}
source code:
https://www.codeproject.com/Articles/32556/Auto-Clicker-C
|
|
|
|
|
Is there any reason why you aren't asking this in the forum at the end of the article you got the code from? The original author will be a lot more familiar with his code than we will.
(And he might have a vague idea what the heck you are going on about: I don't have a clue ... remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with. That code doesn't need a "real" mouse.)
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks for the kind welcome However I no asked at the end of article because this code move cursor, instead I'd like click without any cursor movements of user.
Thanks same
|
|
|
|
|
When a user clicks the mouse, it triggers an event. Your code runs an event handler in response to the event. If the code in the event handler is extracted out into a separate routine, the event handler can then just call the extracted code routine. Then, your click-without-using-the-mouse (which I presume is activated by something that you have written) can just call the same extracted code routine.
|
|
|
|
|
This is usually the way to do it.
If you generalize it slightly, it may not always work: Especially if we are talking about a hardware level handler, reacting to interrupts, the interrupt handler may have access to hardware registers etc. that you cannot access from an ordinary background level (or whatever it is called in your local lore). The interrupt handler may have access to both physical registers, privileged instructions and protected memory that user code does not.
The handler may call a user space/level function accessible to application code as well, but information provided to this function may come from a privileged context. You may or may not be able to provide valid "fake values" from your user level context. Also, operations performed by this extracted function may require hardware privileges not available in a user level context.
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Speech;
using System.Speech.Synthesis;
using System.Speech.Recognition;
using System.Threading;
using System.Diagnostics;
namespace PC_AI_BOT_2020
{
public partial class Form1 : Form
{
// form declarations...
SpeechSynthesizer ss = new SpeechSynthesizer();
PromptBuilder pb = new PromptBuilder();
SpeechRecognitionEngine sre = new SpeechRecognitionEngine();
Choices clist;
public Form1()
{
InitializeComponent();
}
private void Btnstart_Click(object sender, EventArgs e)
{
// start (button_click)
btnstart.Enabled = false;
btnstop.Enabled = true;
clist.Add(new string[] { "hello", "how are you", "what is the current time", "open crome", "thanks you", "close" });
Grammar gr = new Grammar(new GrammarBuilder(clist));
try
{
sre.RequestRecognizerUpdate();
sre.LoadGrammar(gr);
sre.SpeechRecognized += Sre_speechrecognized;
sre.SetInputToDefaultAudioDevice();
sre.RecognizeAsync(RecognizeMode.Multiple);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "error");
}
}
void Sre_speechrecognized(Object sender, SpeechRecognizedEventArgs e)
{
switch (e.Result.Text.ToString())
{
case "hello":
ss.SpeakAsync("hello marcus");
break;
case "how are you today":
ss.SpeakAsync("i am doing grate marcus how about you");
break;
case "wht is the current time":
ss.SpeakAsync("current time is " + DateTime.Now.ToLongTimeString
());
break;
case "thank you":
ss.SpeakAsync("pleasure is mine marcus");
break;
case "open crome":
Process.Start("crome", "http;//www.google.com");
break;
case "close":
Application.Exit();
break;
}
txtcontents.Text += e.Result.Text.ToString() + Environment.NewLine;
}
private void Btnstop_Click(object sender, EventArgs e)
{
// stop (button_click )
sre.RecognizeAsyncStop();
btnstart.Enabled = true;
btnstop.Enabled = false;
}
}
}
|
|
|
|
|
What error?
What does it do that you didn't expect, or not do that you did?
What have you tried to do to find out why?
Are there any error messages, and if so, where and when? What did you do to make them happen?
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
And if you get a problem with Youtube code, then two things spring to mind:
1) Talk to the idiot who posted the tutorial: it's his code, he should know how it works. He probably won't, as most Youtube tutorials are produced by people who have no idea what they are doing, but at least it warns others ...
2) If code doesn't work, start with the debugger and see what is going on while it is running.
But just posting a chunk of random code and saying "it doesn't work" when we have no idea what it is supposed to do in the first place is an exercise in futility ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
What error?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Quote: Let me know best practices for audit data handling.
|
|
|
|
|
Better than what?
we have no idea what you are doing, or how you are handling it at the moment, so we couldn't begin to compare practices if we wanted to ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Write triggers or use the transaction log.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
The best practice is to do it correctly. So use Google to find samples and tutorials on the subject and study them closely.
|
|
|
|
|
Richard MacCutchan wrote: The best practice is to do it correctly. Can you back up that opinion with any fact?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
|
Hello.
My Name is Ko.
I want to make mapping drive use ftp/sftp.
What kind of dll can help me?
I used dokan, but I failed.
So. I find cNetworkDrive.
[https://www.codeproject.com/Articles/6847/Map-Network-Drive-API]
But this project has only share folder.
Help me plz.
|
|
|
|
|
You can't map a FTP link to a drive: they use different protocols.
To access an FTP link, you need to use an FTP client - I use FileZilla[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi.
I used FileZilla.
But I want to make something similar to NetDrive.
I need mapping network drive.
|
|
|
|
|
|
It doesn't exist. You cannot map a drive to a FTP server. FTP doesn't speak the same protocols used by any file system Windows supports.
|
|
|
|
|
Well,
There are some new features in Windows 10 that actually allow you to mount a remote filesystem. The 'Cloud' filesystem is protocol agnostic. So you could easily implement this with FTP, HTTP, Bittorrent or whatever.
Windows Projected File System (ProjFS)[^]
There is also a managed API for this feature[^].
Best Wishes,
-David Delaune
Edit:
I just want to add that you can enable this feature via powershell with:
Enable-WindowsOptionalFeature -Online -FeatureName Client-ProjFS -NoRestart
modified 14-Oct-20 2:23am.
|
|
|
|
|
Well that's new. Learn something new every day.
|
|
|
|
|
Randor wrote: The 'Cloud'
Dave Kreskowiak wrote: Well that's new. Learn something new every day.
Old Man Yells At Cloud[^]
|
|
|
|
|
hello,
I'm creating an application that reads data from a PLC and writes it into a database.
In my GUI the user can select which data he wants to log into the database, but I'm wondering how to solve this.
sometimes the user wants to log only one item in the database :
INSERT INTO myTabel (name_data1) VALUES ("123")
but other times I must be able to choose more data :
INSERT INTO myTabel (name_data1, name_data2, name_data3) VALUES ("123", "456", "789")
how would I code this? The column names name_data1, name_data2, name_data3, ... in my database should be able to change according to which data is chosen
for this purpose I use a list of 2 strings
["name_data1", "123"],
["name_data2", "456"],
["name_data3", "789"]
so the problem also is that I do not know how the table will look like at the moment I insert the data, it all depends on which data the user chooses to be inserted into the database
|
|
|
|
|
Hi,
you can create a table and add columns to it when the need arises, however that would be bad design for several reasons; the table structure would be unpredictable, it would probably be very sparse (most fields remain empty), and processing it could be quite cumbersome.
I'd suggest you use a very simple table with essentially two columns, say my_key and my_value , both string.
Your example
["name_data1", "123"],
["name_data2", "456"]"
["name_data3", "789"]
would then sit in three rows, exactly as you described it yourself!
Of course you might want to also provide a primary key, a created timestamp, and maybe a creator field.
If the data entered is related, you need some kind of parent field or group field, so you can indicate how the records belong together.
I certainly advise you to create some processing code before deciding your final table structure, so you don't paint yourself into a corner.
Luc Pattyn [My Articles]
If you can't find it on YouTube try TikTok...
|
|
|
|
|