i reconstructed the code, posted in http://www.powerbasic.com/support/pb...ad.php?t=22589
it's more elegant, because new code doesn't use wordpad and reads clipboard into richedit box.
how to use:
1) compile and include this program in startup folder (not necessary, but more comfortable)
2) after copying code from bbs by ctrl-c, press alt-f10
<font face="courier new, courier" size="3"><pre>
#compile exe
#register none
#dim all
#include "win32api.inc"
#include "commctrl.inc"
#include "richedit.inc"
%id_richedit = 101
callback function dlgproc
static natom as dword, hedit as long
select case cbmsg
case %wm_initdialog
natom = globaladdatom ("my hotkey" + str$(timer))
registerhotkey cbhndl, natom, 1, %vk_f10 ' alt-f10
initcommoncontrols
control add "richedit", cbhndl, %id_richedit, ", 0, 0, 300, 300, _
%ws_child or %es_multiline or %es_wantreturn
control handle cbhndl, %id_richedit to hedit
case %wm_size
showwindow cbhndl, 0
case %wm_destroy
unregisterhotkey cbhndl, natom
globaldeleteatom natom
case %wm_hotkey
local ctext as string, ltext as long
sendmessage hedit, %wm_settext, 0, byval %null
sendmessage hedit, %em_pastespecial, 0, byval %null
ltext = sendmessage(hedit, %wm_gettextlength, 0, 0) + 1
ctext = space$(ltext)
sendmessage hedit, %wm_gettext, ltext, strptr(ctext)
open "~tmp.bas" for output as #1: print #1, ctext;: close #1
ltext = shell ("pbedit ~tmp")
end select
end function
function pbmain
local hdlg as long, hriched as long
hriched = loadlibrary("riched32.dll")
dialog new 0, "copy bas from bbs (alt-f10)",,, 300, 40, %ws_sysmenu, _
%ws_ex_topmost or %ws_ex_toolwindow to hdlg
dialog show modal hdlg call dlgproc
freelibrary hriched
end function
[/CODE]
it's more elegant, because new code doesn't use wordpad and reads clipboard into richedit box.
how to use:
1) compile and include this program in startup folder (not necessary, but more comfortable)
2) after copying code from bbs by ctrl-c, press alt-f10
<font face="courier new, courier" size="3"><pre>
#compile exe
#register none
#dim all
#include "win32api.inc"
#include "commctrl.inc"
#include "richedit.inc"
%id_richedit = 101
callback function dlgproc
static natom as dword, hedit as long
select case cbmsg
case %wm_initdialog
natom = globaladdatom ("my hotkey" + str$(timer))
registerhotkey cbhndl, natom, 1, %vk_f10 ' alt-f10
initcommoncontrols
control add "richedit", cbhndl, %id_richedit, ", 0, 0, 300, 300, _
%ws_child or %es_multiline or %es_wantreturn
control handle cbhndl, %id_richedit to hedit
case %wm_size
showwindow cbhndl, 0
case %wm_destroy
unregisterhotkey cbhndl, natom
globaldeleteatom natom
case %wm_hotkey
local ctext as string, ltext as long
sendmessage hedit, %wm_settext, 0, byval %null
sendmessage hedit, %em_pastespecial, 0, byval %null
ltext = sendmessage(hedit, %wm_gettextlength, 0, 0) + 1
ctext = space$(ltext)
sendmessage hedit, %wm_gettext, ltext, strptr(ctext)
open "~tmp.bas" for output as #1: print #1, ctext;: close #1
ltext = shell ("pbedit ~tmp")
end select
end function
function pbmain
local hdlg as long, hriched as long
hriched = loadlibrary("riched32.dll")
dialog new 0, "copy bas from bbs (alt-f10)",,, 300, 40, %ws_sysmenu, _
%ws_ex_topmost or %ws_ex_toolwindow to hdlg
dialog show modal hdlg call dlgproc
freelibrary hriched
end function
[/CODE]
Comment