Initial commit: MQL5 Scripts Collection (MetaTrader 5)
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
@@ -0,0 +1,20 @@
|
||||
# 🚀 Unlock the Power of Trading!
|
||||
|
||||
Welcome to this open-source trading project. Here you will find powerful tools to enhance your trading journey. If you find this project useful, please consider starring ⭐, sharing, or donating to support further development!
|
||||
|
||||
---
|
||||
|
||||
**Support the project:**
|
||||
- Star this repository on GitHub
|
||||
- Share it with your trading friends
|
||||
- [Donate here](https://www.paypal.com/donate/?hosted_button_id=YOUR_BUTTON_ID) to help us grow!
|
||||
|
||||
---
|
||||

|
||||

|
||||
|
||||
## Source Files
|
||||
- `clipboard.mq5`
|
||||
|
||||
---
|
||||
> Made with ❤️ for the trading community.
|
||||
@@ -0,0 +1,59 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| Clipboard.mq4 |
|
||||
//| PavelIvanovich(api) |
|
||||
//| p231970@hotmail.com |
|
||||
//| MQL5 version and unicode support by Alexey Sergeev |
|
||||
//| profy.mql@gmail.com |
|
||||
//+------------------------------------------------------------------+
|
||||
#property version "1.00"
|
||||
#property description "Getting contents of the clipboard"
|
||||
|
||||
#import "user32.dll"
|
||||
bool OpenClipboard(int hwnd);
|
||||
int GetClipboardData(int uFormat);
|
||||
bool CloseClipboard();
|
||||
int GetAncestor(long hWnd,int gaFlags);
|
||||
int GetAncestor(int hWnd,int gaFlags);
|
||||
#import "kernel32.dll"
|
||||
int GlobalLock(int hMem);
|
||||
bool GlobalUnlock(int hMem);
|
||||
string lstrcatW(int dst,string src);
|
||||
#import
|
||||
//+------------------------------------------------------------------+
|
||||
//| Script program start function |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnStart()
|
||||
{
|
||||
int hMain;
|
||||
string clip="";
|
||||
//---
|
||||
if(_IsX64)
|
||||
hMain=GetAncestor(ChartGetInteger(ChartID(),CHART_WINDOW_HANDLE),2);
|
||||
else
|
||||
hMain=GetAncestor((int)ChartGetInteger(ChartID(),CHART_WINDOW_HANDLE),2);
|
||||
//---
|
||||
if(OpenClipboard(hMain))
|
||||
{
|
||||
int hglb=GetClipboardData(1/*CF_TEXT*/);
|
||||
if(hglb!=0)
|
||||
{
|
||||
int lptstr=GlobalLock(hglb);
|
||||
|
||||
if(lptstr!=0) { clip=lstrcatW(lptstr,""); GlobalUnlock(hglb); }
|
||||
}
|
||||
CloseClipboard();
|
||||
}
|
||||
|
||||
// translate ANSI to UNICODE
|
||||
ushort chW; uchar chA; string rez;
|
||||
for(int i=0; i<StringLen(clip); i++)
|
||||
{
|
||||
chW=StringGetCharacter(clip, i);
|
||||
chA=uchar(chW&255); rez=rez+CharToString(chA);
|
||||
chA=uchar(chW>>8&255); rez=rez+CharToString(chA);
|
||||
}
|
||||
|
||||
MessageBox("Clipboard: \n"+rez,"Clipboard");
|
||||
return(0);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Reference in New Issue
Block a user