flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Windows > need help regarding rich edit STREAMIN callback function | 
| Author | 
 | 
| vbVeryBeginner 07 Jan 2006, 04:13 hi,
 i can't figure out, why my text wouldn't show in the richedit window using the following code. could somebody please give me some advice. Code: t1 db 'The callback function return...',13,10,0 t2 db 'An EM_AUTOURLDETECT message enables or di...',13,10,0 struct EDITSTREAM dwCookie dd ? dwError dd ? pfnCallback dd ? ends Code: invoke lstrlen,t1 mov [siSize],eax mov [chatEs.dwCookie],t2 mov [chatEs.dwError],1 mov [chatEs.pfnCallback],proc_streamin_callback invoke SendMessage,[ppH],EM_STREAMIN,SF_TEXT,chatEs and the callback function Code: proc proc_streamin_callback dwCookie,pbBuff,maByte,transByte push ebx esi edi ; the maByte value is 4kb push [siSize] pop [transByte] invoke RtlMoveMemory,[pbBuff],[dwCookie],[transByte] invoke MessageBox,NULL,[pbBuff],f0,MB_OK ; mov eax,0 <- result error if eax = 0 pop edi esi ebx ret endp 
 | |||||||||||
|  07 Jan 2006, 04:13 | 
 | 
| vbVeryBeginner 07 Jan 2006, 19:07 hi farrier,
 i got this if i mov eax,0   thats why i commented it out i read that too from PSDK, psdk wrote: 
 but i don't know which part i am wrong.  | |||
|  07 Jan 2006, 19:07 | 
 | 
| jdawg 07 Jan 2006, 21:58 When you make a MessageBox, eax is the location of the return value of the button being pushed.  Try making a little exception handler for the  MessageBox before you return from the procedure.  something like this.
 Code: proc proc_streamin_callback dwCookie,pbBuff,maByte,transByte push ebx esi edi ; the maByte value is 4kb push [siSize] pop [transByte] invoke RtlMoveMemory,[pbBuff],[dwCookie],[transByte] invoke MessageBox,NULL,[pbBuff],f0,MB_OK cmp eax,ID_OK ;allows you to hold for a button press which will then allow you to write to eax je @f @@: mov eax,0 pop edi esi ebx ret endp | |||
|  07 Jan 2006, 21:58 | 
 | 
| vbVeryBeginner 07 Jan 2006, 23:20 well, even if i commented the invoke MessageBox, the error still occurs.
 Code: invoke RtlMoveMemory,[pbBuff],[dwCookie],[transByte] ;comment ---- invoke MessageBox,NULL,[pbBuff],f0,MB_OK mov eax,0 ;<- result error if eax = 0 pop edi esi ebx actually the MessageBox is a test function to see if i successfully copied the string t2 into pBuff, and it seems the string is copied into the buffer. but it just won't show up in richedit control. Code: cmp eax,ID_OK ;allows you to hold for a button press which will then allow you to write to eax sorry, i couldn't understand wat you mean. | |||
|  07 Jan 2006, 23:20 | 
 | 
| RedGhost 08 Jan 2006, 03:35 hi, i have this from a very old project, sorry its nasm (before i discovered the magic of fasm xD)
 Code: %define cookie ebp+8 %define pbbuf ebp+12 %define cb ebp+16 %define pcb ebp+20 @streaminproc: push ebp mov ebp, esp push ebx push esi push edi push 0 push dword[pcb] push dword[cb] push dword[pbbuf] push dword[cookie] call [ReadFile] xor eax, 1 pop edi pop esi pop ebx mov esp, ebp pop ebp retn 16 ;--- _________________ redghost.ca | |||
|  08 Jan 2006, 03:35 | 
 | 
| vbVeryBeginner 08 Jan 2006, 04:06 thanks redghost,
 that is to use the readfile function to handle to streamin process. wat i wish to attain is just to simply move a string into the rich edit control. i think it should be simple, but somehow, i don't know why, and which part i made mistake.   ps:i know the SetWindowText :p k, but need to use streamin for some reason. | |||
|  08 Jan 2006, 04:06 | 
 | 
| farrier 08 Jan 2006, 14:32 vbVeryBeginner,
 Well, if you want to do it the easy way: Try EM_REPLACESEL and EM_SETSEL. To add text to the current cursor positon, EM_SETSEL with -1, -1 to unselect all text and EM_REPLACESEL with TRUE, pointer_to_text All my experience has been exactly like RedGhost, using EM_STREAMIN with ReadFile to do printing from an RTF control. hth, farrier _________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! | |||
|  08 Jan 2006, 14:32 | 
 | 
| vbVeryBeginner 08 Jan 2006, 23:30 ya farrier, i see that from tomasz's quetannon example too.
 but i find it weird, why i can't use the EM_STREAMIN to insert just a sentence of ascii? and when i mov eax,0, the application clashed. but according to psdk, this callback function is not limited on the just readfile and writefile. | |||
|  08 Jan 2006, 23:30 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.