Jump to content

Recommended Posts

Posted

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.JPG

now what you can do with this program is start it :P, en you can write a some text.

This text can you save it as .exe

And that is only what i want.

What i can't make is "save it as .exe"

:S

Posted (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

#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
EndFunc

DllCallBack.au3

test.rtf

resources.au3

Edited by Zedna
Posted

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]

Posted (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 by Zedna

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...