| View previous topic :: View next topic |
| Author |
Message |
KDJ
Joined: 06 Mar 2010 Posts: 1068 Location: Poland
|
Posted: Sun Mar 18, 2012 2:57 pm Post subject: |
|
|
Instructor
In the files Scripts-Eng.txt and Scripts-Rus.txt, in the list of methods is missing AkelPad.SetFrameInfo(). |
|
| Back to top |
|
 |
Instructor Site Admin
Joined: 06 Jul 2006 Posts: 4646
|
Posted: Sun Mar 18, 2012 6:28 pm Post subject: |
|
|
KDJ
Corrected. |
|
| Back to top |
|
 |
Andrey_A_A
Joined: 03 Jun 2010 Posts: 483 Location: Сочи, Хоста
|
Posted: Sat Apr 14, 2012 2:54 am Post subject: |
|
|
Можно ли вставить метод AkelPad.Link(N)
Часто приходится заменять, вырезать ... ссылки
Хочу заменить ссылку и сразу сохранить файл. Не нашёл как это сделать, может есть другой способ? |
|
| Back to top |
|
 |
Instructor Site Admin
Joined: 06 Jul 2006 Posts: 4646
|
Posted: Sat Apr 14, 2012 8:12 am Post subject: |
|
|
Andrey_A_A
SelectLinkUnderCaret.js | Code: | SelectLinkUnderCaret(AkelPad.GetEditWnd());
function SelectLinkUnderCaret(hWndEdit)
{
var lpSel;
var lpCaret;
var bSelected=false;
if (lpCaret=AkelPad.MemAlloc(_X64?24:12 /*sizeof(AECHARINDEX)*/))
{
AkelPad.SendMessage(hWndEdit, 3130 /*AEM_GETINDEX*/, 5 /*AEGI_CARETCHAR*/, lpCaret);
if (lpSel=AkelPad.MemAlloc(_X64?56:28 /*sizeof(AESELECTION)*/))
{
if (AkelPad.SendMessage(hWndEdit, 3149 /*AEM_INDEXINURL*/, lpCaret, lpSel))
{
AkelPad.SendMessage(hWndEdit, 3126 /*AEM_SETSEL*/, lpCaret, lpSel);
bSelected=true;
}
AkelPad.MemFree(lpSel);
}
AkelPad.MemFree(lpCaret);
}
return bSelected;
}
|
|
|
| Back to top |
|
 |
Andrey_A_A
Joined: 03 Jun 2010 Posts: 483 Location: Сочи, Хоста
|
Posted: Sat Apr 14, 2012 8:39 am Post subject: |
|
|
| Instructor, Спасибо!!! буду разбираться... |
|
| Back to top |
|
 |
KDJ
Joined: 06 Mar 2010 Posts: 1068 Location: Poland
|
Posted: Sun Apr 29, 2012 11:33 am Post subject: |
|
|
Instructor
After calling AkelPad.MessageBox (extended version), the dialog box, from which the method has been called (hWndDlg), disappears.
| Code: | AkelPad.MessageBox(hWndDlg, "That is the question", "Message Box",
32 /*MB_ICONQUESTION*/, 0,
1 /*IDOK*/, "&OK", 1 /*BMB_DEFAULT*/,
2 /*IDCANCEL*/, "&Cancel", 0); |
|
|
| Back to top |
|
 |
Instructor Site Admin
Joined: 06 Jul 2006 Posts: 4646
|
Posted: Mon Apr 30, 2012 11:50 am Post subject: |
|
|
KDJ
Different threads SendMessage can cause GUI freeze.
One of the way avoiding this is hide dialog:
| Code: | oSys.Call("user32::ShowWindow", hWndDlg, 0 /*SW_HIDE*/);
AkelPad.MessageBox(hWndDlg, "That is the question", "Message Box",
32 /*MB_ICONQUESTION*/, 0,
1 /*IDOK*/, "&OK", 1 /*BMB_DEFAULT*/,
2 /*IDCANCEL*/, "&Cancel", 0);
oSys.Call("user32::ShowWindow", hWndDlg, 5 /*SW_SHOW*/); |
|
|
| Back to top |
|
 |
KDJ
Joined: 06 Mar 2010 Posts: 1068 Location: Poland
|
Posted: Mon Apr 30, 2012 9:30 pm Post subject: |
|
|
Instructor
It seems to me, that there is no need to hide dialog window, because it is hidden automatically after MessageBox (extended) call.
But I wanted to, in order to dialog box will be visible at all times.
Below I put the script that shows differences in the behavior of standard and extended MessageBox:
MessageBox_test.js
| Code: | var oSys = AkelPad.SystemFunction();
var hInstanceDLL = AkelPad.GetInstanceDll();
var sClassName = "AkelPad::Scripts::" + WScript.ScriptName + "::" + hInstanceDLL;
var hMainWnd = AkelPad.GetMainWnd();
var hButton1;
var hButton2;
AkelPad.WindowRegisterClass(sClassName);
oSys.Call("user32::CreateWindowExW",
0, //dwExStyle
sClassName, //lpClassName
"MessageBox test", //lpWindowName
0x90CA0000, //dwStyle=WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX
300, //x
200, //y
270, //nWidth
140, //nHeight
hMainWnd, //hWndParent
0, //ID
hInstanceDLL, //hInstance
DialogCallback);
oSys.Call("user32::EnableWindow", hMainWnd, 0);
AkelPad.WindowGetMessage();
AkelPad.WindowUnregisterClass(sClassName);
function DialogCallback(hWnd, uMsg, wParam, lParam)
{
if (uMsg == 1) //WM_CREATE
{
hButton1 =
oSys.Call("user32::CreateWindowExW",
0, //dwExStyle
"BUTTON", //lpClassName
"&Standard", //lpWindowName
0x50010001, //dwStyle
20, //x
40, //y
100, //nWidth
25, //nHeight
hWnd, //hWndParent
0, //ID
hInstanceDLL, //hInstance
0); //lpParam
hButton2 =
oSys.Call("user32::CreateWindowExW",
0, //dwExStyle
"BUTTON", //lpClassName
"&Extended", //lpWindowName
0x50010000, //dwStyle
140, //x
40, //y
100, //nWidth
25, //nHeight
hWnd, //hWndParent
0, //ID
hInstanceDLL, //hInstance
0); //lpParam
}
else if (uMsg == 7) //WM_SETFOCUS
oSys.Call("user32::SetFocus", hButton1);
else if (uMsg == 256) //WM_KEYDOWN
{
if (wParam == 27) //VK_ESCAPE
oSys.Call("user32::PostMessageW", hWnd, 16 /*WM_CLOSE*/, 0, 0);
}
else if (uMsg == 273) //WM_COMMAND
{
if (lParam == hButton1)
AkelPad.MessageBox(hWnd, "That is the question", "MessageBox Standard",
0x21 /*MB_ICONQUESTION|MB_OKCANCEL*/);
else if (lParam == hButton2)
AkelPad.MessageBox(hWnd, "That is the question", "MessageBox Extended",
0x20 /*MB_ICONQUESTION*/, 0,
1 /*IDOK*/, "&OK", 1 /*BMB_DEFAULT*/,
2 /*IDCANCEL*/, "&Cancel", 0);
}
else if (uMsg == 16) //WM_CLOSE
{
oSys.Call("user32::EnableWindow", hMainWnd, 1);
oSys.Call("user32::DestroyWindow", hWnd);
}
else if (uMsg == 2) //WM_DESTROY
oSys.Call("user32::PostQuitMessage", 0);
return 0;
}
|
|
|
| Back to top |
|
 |
Instructor Site Admin
Joined: 06 Jul 2006 Posts: 4646
|
Posted: Sun May 06, 2012 12:10 pm Post subject: |
|
|
KDJ
There is no sense to make it visible because you will have GUI freezed. Extended dialog runs from main thread and you call it from its owner - Scripts dialog thread. This will cause GUI thread conflict.
You can try it by your own: code | Code: | else if (uMsg == 273) //WM_COMMAND
{
if (lParam == hButton1)
AkelPad.MessageBox(hWnd, "That is the question", "MessageBox Standard",
0x21 /*MB_ICONQUESTION|MB_OKCANCEL*/);
else if (lParam == hButton2)
{
var dwCurThreadID=oSys.Call("kernel32::GetCurrentThreadId");
var dwMainThreadID=oSys.Call("user32::GetWindowThreadProcessId", hMainWnd, 0);
if (oSys.Call("user32::AttachThreadInput", dwCurThreadID, dwMainThreadID, true))
{
oSys.Call("user32::EnableWindow", hWnd, 0);
AkelPad.MessageBox(hWnd, "That is the question", "MessageBox Extended",
0x20 /*MB_ICONQUESTION*/, 0,
1 /*IDOK*/, "&OK", 1 /*BMB_DEFAULT*/,
2 /*IDCANCEL*/, "&Cancel", 0);
oSys.Call("user32::EnableWindow", hWnd, 1);
oSys.Call("user32::AttachThreadInput", dwCurThreadID, dwMainThreadID, false);
}
}
} |
Last edited by Instructor on Sun May 06, 2012 12:19 pm; edited 1 time in total |
|
| Back to top |
|
 |
Instructor Site Admin
Joined: 06 Jul 2006 Posts: 4646
|
Posted: Sun May 06, 2012 12:12 pm Post subject: |
|
|
Добавлено: методы AkelPad.CallA, AkelPad.CallW, AkelPad.CallExA, AkelPad.CallExW.
Added: AkelPad.CallA, AkelPad.CallW, AkelPad.CallExA, AkelPad.CallExW methods.
Scripts plugin v10.8 |
|
| Back to top |
|
 |
KDJ
Joined: 06 Mar 2010 Posts: 1068 Location: Poland
|
Posted: Sun May 06, 2012 3:55 pm Post subject: |
|
|
| Instructor wrote: | KDJ
There is no sense to make it visible because you will have GUI freezed. Extended dialog runs from main thread and you call it from its owner - Scripts dialog thread. This will cause GUI thread conflict.
You can try it by your own: code | Code: | else if (uMsg == 273) //WM_COMMAND
{
if (lParam == hButton1)
AkelPad.MessageBox(hWnd, "That is the question", "MessageBox Standard",
0x21 /*MB_ICONQUESTION|MB_OKCANCEL*/);
else if (lParam == hButton2)
{
var dwCurThreadID=oSys.Call("kernel32::GetCurrentThreadId");
var dwMainThreadID=oSys.Call("user32::GetWindowThreadProcessId", hMainWnd, 0);
if (oSys.Call("user32::AttachThreadInput", dwCurThreadID, dwMainThreadID, true))
{
oSys.Call("user32::EnableWindow", hWnd, 0);
AkelPad.MessageBox(hWnd, "That is the question", "MessageBox Extended",
0x20 /*MB_ICONQUESTION*/, 0,
1 /*IDOK*/, "&OK", 1 /*BMB_DEFAULT*/,
2 /*IDCANCEL*/, "&Cancel", 0);
oSys.Call("user32::EnableWindow", hWnd, 1);
oSys.Call("user32::AttachThreadInput", dwCurThreadID, dwMainThreadID, false);
}
}
} |
|
It works a little better, but:
- is very complicated to use,
- if you switch to another window, AkelPad hangs. |
|
| Back to top |
|
 |
Instructor Site Admin
Joined: 06 Jul 2006 Posts: 4646
|
Posted: Sun May 06, 2012 7:27 pm Post subject: |
|
|
| It is what I'm talking about. |
|
| Back to top |
|
 |
KDJ
Joined: 06 Mar 2010 Posts: 1068 Location: Poland
|
Posted: Sun May 06, 2012 7:46 pm Post subject: |
|
|
Instructor
Maybe you should write your own function MessageBox like InputBox?
Or maybe write a script? |
|
| Back to top |
|
 |
FeyFre
Joined: 07 Aug 2007 Posts: 1892 Location: Vinnitsa, Ukraine
|
Posted: Sun May 06, 2012 10:23 pm Post subject: |
|
|
| Quote: | | Added: AkelPad.CallA, AkelPad.CallW, AkelPad.CallExA, AkelPad.CallExW methods. | Я так понимаю, они манипулируют вот этими?
| Code: | #define PDS_STRANSI 0x20000000 //Flag is set if caller passes Ansi strings in external call arguments (PLUGINDATA.lParam).
#define PDS_STRWIDE 0x40000000 //Flag is set if caller passes Unicode strings in external call arguments (PLUGINDATA.lParam).
//If PDS_STRANSI and PDS_STRWIDE not specified then one of these flags will be set automatically depending on Windows version. | Тогда вопрос:
Что мне(плагинам) делать, если вдруг придет с тем что не поддерживается? У меня у плагинов стоит всегда ставится PDS_NOANSI, а кто-то возьмет и пришлет с PDS_STRANSI. Как минимум, что мне ставить в PLUGINDATA::nUnload ? |
|
| Back to top |
|
 |
Instructor Site Admin
Joined: 06 Jul 2006 Posts: 4646
|
Posted: Mon May 07, 2012 9:36 am Post subject: |
|
|
FeyFre
Так можно:
| Code: | //If plugin already loaded, stay in memory and don't change active status
if (pd->bInMemory) pd->nUnload=UD_NONUNLOAD_UNCHANGE;
return; |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|