Hi all
Somebody help me:grin:
i want know how to load a text file to richedit
Posted on 2004-04-14 23:14:18 by neverending
Posted on 2004-04-15 02:06:12 by Eternal Idol Birmingham
Hi :grin:
This is my question again
I want know how to pass string to proceduce. Example

ShowString proc StringGeted ;I don't know what i must write here, what the type of this variable.

;This show the string that we have taked from outside of proc
invoke MessageBox,hWnd,addr StringGeted,addr AppName,MB_OK

ret
end ShowString

;out side proc
invoke ShowString,SADD("Hello").
:stupid:
Posted on 2004-04-15 02:29:01 by neverending
This is an example program:

.386
.model stdcall,flat

include windows.inc
include user32.inc
include kernel32.inc

includelib user32.lib
includelib kernel32.lib

ShowString PROTO :DWORD

.data
Buff db "holas",0
AppName db "Little Example",0

.code
Main:

push offset Buff
call ShowString

invoke ShowString,offset Buff
invoke ExitProcess,0
ret

ShowString PROC strptr:DWORD
invoke MessageBox,0,strptr,addr AppName,MB_OK
ret
ShowString ENDP

End Main

Regards,
Mariano.

:alright:
Posted on 2004-04-15 03:05:52 by Eternal Idol Birmingham
Thank alot. You're very fast :grin:
That is DWORD type .
:alright:
Posted on 2004-04-15 03:20:17 by neverending
You are welcome and I do my best hehe.

Are you coming from the C\C++ world? Well, DWORD is an unsigned integer (32 bits, 4 bytes) which is the amount of bytes that are used to form an address pointer.

So you can use offset when you are working with an array of bytes from the .data section or simply by the name of the variable when you use dinamyc allocation and a pointer.

Example below:

.386
.model stdcall,flat

include windows.inc
include user32.inc
include kernel32.inc

includelib user32.lib
includelib kernel32.lib

ShowString PROTO :DWORD

.data
Buff db "holas",0
AppName db "Little Example",0
Pointer dd 0

.code
Main:

invoke GetProcessHeap
invoke HeapAlloc,eax,HEAP_ZERO_MEMORY,1024
mov Pointer,eax

invoke lstrcpy,Pointer,offset Buff

push Pointer
call ShowString

invoke ShowString,Pointer

invoke GetProcessHeap
invoke HeapFree,eax,0,Pointer


invoke ExitProcess,0
ret

ShowString PROC strptr:DWORD
invoke MessageBox,0,strptr,addr AppName,MB_OK
ret
ShowString ENDP

End Main

Always free the allocated memory and by the way 'holas' is like hi in Spanish.

Regards,
Mariano.

:alright:
Posted on 2004-04-15 03:26:44 by Eternal Idol Birmingham
Hi, i'm again
Now i have a question again:
How to return one string from proc to outside.

:stupid:
Posted on 2004-04-19 05:19:01 by neverending
The stdcall convention returns the result of functions in the eax register, take a look at this new code. We return the value of the buffer (HeapAlloc) in the eax register and we use it from the main function.

.386
.model stdcall,flat

include windows.inc
include user32.inc
include kernel32.inc

includelib user32.lib
includelib kernel32.lib

ShowString PROTO :DWORD
ReturnText PROTO

.data
Buff db "holas",0
AppName db "Little Example",0
NewText db "this is simple assembly code",0
Pointer dd 0

.code
Main:

invoke ReturnText
mov Pointer,eax

invoke ShowString,Pointer

invoke GetProcessHeap
invoke HeapFree,eax,0,Pointer


invoke ExitProcess,0
ret

ShowString PROC strptr:DWORD
invoke MessageBox,0,strptr,addr AppName,MB_OK
ret
ShowString ENDP

ReturnText PROC
LOCAL Buffer:DWORD
invoke GetProcessHeap
invoke HeapAlloc,eax,HEAP_ZERO_MEMORY,1024
mov Buffer,eax
invoke lstrcpy,Buffer,offset NewText
mov eax,Buffer
ret
ReturnText ENDP

End Main

Regards,
Mariano.

:alright:
Posted on 2004-04-19 05:28:48 by Eternal Idol Birmingham
Thank you :alright:
You helped me alot
Posted on 2004-04-19 07:14:54 by neverending
Hi Eternal Idol Birmingham :tongue:
I have small question
I'm a newbie. :grin:
I've never worked with heap, and i don't understand much the line:
invoke HeapAlloc,eax,HEAP_ZERO_MEMORY,1024
What mean of 1024 , i have know that is the number that you Specifies the number of bytes to be allocated. But why you use 1024 , can i use another number.
:stupid:
Posted on 2004-04-19 08:46:41 by neverending
You can use (almost) whatever you want :)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/heapalloc.asp

Regards,
Mariano.

:alright:
Posted on 2004-04-19 08:48:25 by Eternal Idol Birmingham
Hi all, got stuck in an awkward problem - I'am using the xxxRichedit Controls
posted by a certain Russian gent as freeware source - and then badly translated
(grin) to English.  I hope you've heard of it.

Basically it provides printing (and other stuffies) easily to your application.
;-(

I get everything to work - printing & previewing. BUT --> multiple calls to the
functions (CreatePreview and Printproc ) produce GPF's or it says No Printer.
It's almost as if the function calls don't release the printdriver or memory HDC after it's done.

Anybody got an idea what i'am on about? Basically i call a Print preview from a
modal dialog - any further calls to the preview (about after 3) locks up the application
and windows shuts it down.

The calling convention is :-> invoke CreatePreview,hWin,hRichED
not much i could have done wrong is there?

Thanks lots
Draakie
Posted on 2005-09-09 07:13:57 by Draakie
hi! it was me translated their readme, although never used them :) well, i'll send e-mail to the author, but while can you post crashing example so it can be tested to find out the bug? i'll check translation one more time, but not sure it will be faster then monday. regards!
Posted on 2005-09-09 07:59:08 by Shoo
Hi all, please test new version XXRichEdit (see attach REdit.zip).
Other controls, examples and sources on http://www.chib.boom.ru (XXControls V0.0.4.1).
Attachments:
Posted on 2005-09-10 00:50:39 by Chib
Impressive work :)

It is working fine here. Windows2000 SP4, 256 Ram, 800 Mhz


Do you think that is possible to achieve this result ---> ? http://www.podetti.com/NewMenu

They are very great looking menus, but they uses MFC. Since you suceeded to build it only with APIs, do you think that is posible to get the result of those menus, too ?


Best Regards

Guga
Posted on 2005-09-10 01:56:55 by Beyond2000!
I study this is source (http://www.podetti.com/NewMenu), and the most best I try from there to take.
Posted on 2005-09-11 03:25:15 by Chib
Hi Chib,

Thanks again  ;)

Best Regards,

Guga
Posted on 2005-09-11 12:49:38 by Beyond2000!