peter123 Posted October 22, 2007 Share Posted October 22, 2007 Hi Everjone, I have found this program, Which text compiles into an exe file. I like to make the same program in Autoit3, but i can't make it :S can I maybe ask for Help? PeterText2EXE.rar Link to comment Share on other sites More sharing options...
Zedna Posted October 22, 2007 Share Posted October 22, 2007 Post screenshot. I don't trust you (potential malicious code) and I will not run this EXE. From screenshot I can tell you more. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
peter123 Posted October 22, 2007 Author Share Posted October 22, 2007 I don't trust you Thanks this is the site where you can download it, if you don't trust me a screen shot: http://www.blaiz.net/TEXT2EXE.JPGnow what you can do with this program is start it , en you can write a some text. This text can you save it as .exeAnd that is only what i want.What i can't make is "save it as .exe":S Link to comment Share on other sites More sharing options...
Zedna Posted October 22, 2007 Share Posted October 22, 2007 OK. This can be done quite easy: - make AutoIt main GUI - programatically create RichEdit control (at start) - load prepared RTF file into RichEdit with EM_STREAMIN API --> see callback UDF in examples Note: prepared RTF text can be compiled into AutoIt's EXE by FileInstall or by #AutoIt3Wrapper_Res_File_Add Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
peter123 Posted October 22, 2007 Author Share Posted October 22, 2007 @zedna can you maybe help me more? i can't find "#AutoIt3Wrapper_Res_File_Add" in the help file! or can i download it? Link to comment Share on other sites More sharing options...
Zedna Posted October 22, 2007 Share Posted October 22, 2007 (edited) @zednacan you maybe help me more?i can't find "#AutoIt3Wrapper_Res_File_Add" in the help file!or can i download it?Callback UDFAutoIt3WrapperMy resources UDF Edited October 22, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted October 22, 2007 Share Posted October 22, 2007 (edited) @zedna can you maybe help me more? i can't find "#AutoIt3Wrapper_Res_File_Add" in the help file! or can i download it? Notes: - works only COMPILED (because RTF source is loaded from EXE resources) - must be compiled with latest version of Scite4AutoIt3 and reshacker.exe in Auto3Wrapper directory - at compile time must be test.rtf in script directory - see my post with my resource UDF here Note: This is modified Richedit.au3 example from piccaso's DllCallBack UDF EDIT: This script has RTF file defined at compile time. If you wish to make some Load (RTF), Save (EXE) functionality like in Text2Exe then prepare compiled EXE from this script without first line containing #AutoIt3Wrapper_Res_File_Ad d= Then Save (EXE) will do just adding RTF file to resources of that prepared EXE by reshacker.exe -add expandcollapse popup#AutoIt3Wrapper_Res_File_Add=test.rtf, rcdata, TEST_RTF_1 #NoTrayIcon #include <GUIConstants.au3> #include "DllCallBack.au3" #include "resources.au3" Global Const $EM_STREAMIN = 0x400+73 Global Const $EM_STREAMOUT = 0x400+74 Global Const $SF_RTF = 2 Global $EDITSTREAM = DllStructCreate("DWORD pdwCookie;DWORD dwError;PTR pfnCallback;") Global $hWnd_Main = GUICreate("Text2Exe", 610, 410) Global $RTFClassName If @OSTYPE = "WIN32_WINDOWS" Then ; 95/98/Me DllOpen("RICHED20.DLL") $RTFClassName = "RichEdit20A" Else ; NT/2000/XP/2003/Vista DllOpen("MSFTEDIT.DLL") $RTFClassName = "RichEdit50W" EndIf $hInstance = DllCall("kernel32.dll","ptr","GetModuleHandle","ptr",0) $hInstance = $hInstance[0] $dwStyle = BitOR($WS_CHILD, $ES_WANTRETURN, $ES_NOHIDESEL, $WS_HSCROLL, $WS_VSCROLL, $WS_VISIBLE, $ES_MULTILINE) $hRichedit = DllCall("user32.dll","hwnd","CreateWindowEx", _; HWND CreateWindowEx( "dword",$WS_EX_CLIENTEDGE, _ ; DWORD dwExStyle, // extended window style "str",$RTFClassName, _ ; LPCTSTR lpClassName, // pointer to registered class name "str","", _ ; LPCTSTR lpWindowName, // pointer to window name "dword",$dwStyle, _ ; DWORD dwStyle, // window style "int", 5, _ ; int x, // horizontal position of window "int", 5, _ ; int y, // vertical position of window "int", 600, _ ; int nWidth, // window width "int", 400, _ ; int nHeight, // window height "hwnd", $hWnd_Main, _ ; HWND hWndParent, // handle to parent or owner window "ptr", 0, _ ; HMENU hMenu, // handle to menu or child-window identifier "ptr", $hInstance, _ ; HANDLE hInstance, // handle to application instance "ptr",0 _ ; LPVOID lpParam // pointer to window-creation data ) ; ); $hRichedit = $hRichedit[0] $pEditStreamCallback = _DllCallBack("_EditStreamCallback","ptr;ptr;long;ptr") DllStructSetData($EDITSTREAM,"pfnCallback",$pEditStreamCallback) DllCall("user32.dll","int","SendMessage","hwnd",$hRichedit,"uint",$EM_STREAMIN,"int",$SF_RTF,"ptr",DllStructGetPtr($EDITSTREAM)) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _DllCallBack_Free($pEditStreamCallback) Exit EndSwitch WEnd Func _EditStreamCallback($pdwCookie,$pbBuff,$cb,$pcb) Local $szRTF = DllStructCreate("char[" & $cb & "]",$pbBuff) Local $sRTF = _ResourceGetAsString("TEST_RTF_1") ; get RTF text from resource Local $_pcb = DllStructCreate("long",$pcb) DllStructSetData($szRTF,1,$sRTF) DllStructSetData($_pcb,1,StringLen($sRTF)) Return 0 EndFuncDllCallBack.au3test.rtfresources.au3 Edited October 23, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
DirtDBaK Posted October 22, 2007 Share Posted October 22, 2007 and thats why i dont use RTF, too much code... also i've never had a prgm that requires rtf over and edit control.... Nice work though!!!! [center][/center] Link to comment Share on other sites More sharing options...
Zedna Posted October 22, 2007 Share Posted October 22, 2007 (edited) and thats why i dont use RTF, too much code... also i've never had a prgm that requires rtf over and edit control....Nice work though!!!!Unfortunately RichText control isn't natively supported by AutoIt.Gary started RichEdit UDF and I want to help him with that but I haven't so much time.With such RichEdit UDF it could be only a few lines of code. Edited October 22, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now