Various functions

Started by jdoe, August 29, 2006, 12:56:25 AM

Previous topic - Next topic

jdoe


This is my contribution to GeneSys Project. Almost all of these functions come in ANSI and UNICODE version.

----------------------------------------------------------------------------------------------------------------------------------

BrowseForFolder.asm
CenterWindow.asm
GetClipboardText.asm
GetParentFolder.asm
GetPathExtension.asm
IsPeFile.asm
MsgBox.asm
SetClipboardText.asm
StrCat.asm
StrCmp.asm
StrCpy.asm
StrLen.asm


Shantanu Gadgil

Hi jdoe,
Cool functions!  :U

Could you please post only the function names in the post rather than the _entire_ code?

I say function names because that would help searching the forum.

Regards,
Shantanu
To ret is human, to jmp divine!

jdoe

Quote from: shantanu_gadgil on September 02, 2006, 04:50:54 AM
Hi jdoe,
Cool functions!  :U

Could you please post only the function names in the post rather than the _entire_ code?

I say function names because that would help searching the forum.

Regards,
Shantanu

Shantanu,

I know about searching.

Now this is better.   :U




PBrennick

Hi jdoe,
I downloaded your attachment and updated my database accordingly.  Okay, so now I have the entire set, all have been updated to include the credit text that we worked out together.  There is a file in the attachment I am posting here, it is called CreditText.txt

When I am finished with all the modules, I will update the library and DLL.  The attachment should be used to update your local copies so that we are synchonized.

Hi Shantanu,
I am going to add the crc32 stuff now.

Thank you both for your contributions. Shantanu, jdoe is ahead of you. :wink
Paul


[attachment deleted by admin]
The GeneSys Project is available from:
The Repository or My crappy website

PBrennick

All the new functions have been added and the new version of the Project has been uploaded. You can see what has been added you can look at the Repository and Mirror.

I would like to thank everyone for their contributions.

Enjoy using GeneSys
Paul
The GeneSys Project is available from:
The Repository or My crappy website

jdoe

Hi,

I have this MsgBoxA function for a while now (in my old VB6 library as well), and I just saw that it don't work good. The problem with it is that the default button is not getting set (see attachment for screenshot). What I want to do with it is just have a centered message box on the owner window.




.586

.MODEL FLAT, STDCALL

OPTION CASEMAP:NONE


INCLUDE \GeneSys\include\windows.inc
INCLUDE \GeneSys\include\kernel32.inc
INCLUDE \GeneSys\include\user32.inc


CenterWindow                 PROTO :DWORD, :DWORD


.DATA?

ALIGN 4

hCBTProc                     DWORD ?


.CODE

MsgBoxA PROC p_hWnd:DWORD, p_lpszText:DWORD, p_lpszCaption:DWORD, p_uType:DWORD

   .if (p_hWnd != NULL)
       invoke GetCurrentThreadId
       push eax
       push NULL
       push offset CBTProc
       push WH_CBT
       call SetWindowsHookExA
       mov hCBTProc, eax
   .endif

   invoke MessageBoxA, p_hWnd, p_lpszText, p_lpszCaption, p_uType

   ret

MsgBoxA ENDP

ALIGN 4
;
; Returned value must be 0 for processing messages except if nCode is less than zero.
; When HCBT_ACTIVATE is processed, the hook procedure is unhooked.
;
; wParam = Handle of MsgBox window
;
CBTProc PROC PRIVATE p_nCode:DWORD, p_wParam:DWORD, p_lParam:DWORD

   mov eax, p_nCode

   .if (eax == HCBT_ACTIVATE)

       invoke GetParent, p_wParam
       invoke CenterWindow, p_wParam, eax

       invoke UnhookWindowsHookEx, hCBTProc

   .elseif (sdword ptr eax < 0)

       invoke CallNextHookEx, hCBTProc, p_nCode, p_wParam, p_lParam

       ret

   .endif

   xor eax, eax
   ret

CBTProc ENDP

END



Paul, I will give you this one if the problem can be solved   :wink



[attachment deleted by admin]

PBrennick

jdoe,
I am sure we can figure it out.

Paul and Erol
The GeneSys Project is available from:
The Repository or My crappy website

jdoe

Thanks for being optimistic Paul.

Maybe I'm not using the right hook procedure for what I'm trying to do but with all the search i've done, I always find c++ example with CBTProc and I'm sure of my MASM code translation.

BTW, Paul, I'm still working on BrowseSaveAs. Be patient.

Vortex

Jdoe,

I found a nice article explaining how to centralize a message box :

CBT Message Box \ A Win32 API centering enhancement for message boxes.

http://www.codeguru.com/cpp/w-p/win32/messagebox/article.php/c4541/

You need to calculate the central coordinates of the customized message box and the use MoveWindow to move the child window to the centre.

Here is another article about customizing message boxes :

http://www.catch22.net/tuts/msgbox.asp


jdoe

Thanks a lot Vortex. It's kind of no sense that SetWindowPos don't work and MoveWindow work. I just not paid attention to this little difference that make all the difference. It must be the last thing I didn't tried to make it work.

Thanks again    :U


PBrennick

jdoe,
Are you going to post the working code?

Paul
The GeneSys Project is available from:
The Repository or My crappy website

jdoe

Quote from: PBrennick on October 07, 2006, 10:10:53 AM
jdoe,
Are you going to post the working code?

Paul



Check your mail   :U


PBrennick

jdoe,
Got it, thank you very much.
Paul
The GeneSys Project is available from:
The Repository or My crappy website