Umm, I don't know where to start talking but I have a question on how to add/modify a windows API function? For example the function GetDlgItemText retrieves a text from an edit box. Now, I was looking for function that retrieves float values from an edit box. Of course this is possible by converting a string to float, but I want something direct. Yes this is possible through a macro but is there another way to do it? Something like your own API that handles directly with the edit control? :)
Posted on 2002-02-27 16:40:43 by stryker
Why not,
or create dll with all aditionall functions you need.
or create additional proc in m32lib for static version (this way you
don't need to dist. dll)
GetDlgItemFloat s very easy to do.
in the proc
-hctrl=(GetDlgItem,hDlg,ItemID)
-buffer=(GetWindowText,hctrl,addr buffer)
-StrToFloat in m32lib
that's all
Posted on 2002-02-27 17:08:38 by The Svin
Umm that is one thing but, is there a way to interact directly with an edit control. I mean without using any of the current windows API function? More like how, GetDlgItemText works? Something like you're changing the code of the GetDlgItemText function. Anyway, I already have a macro going on, but would like to know more of the source code on how MS got the text from an edit box...I know this is something that only MS knows, but does anyone have any idea?
Posted on 2002-02-27 17:15:14 by stryker
I think that when you call GetDlgItemText it sends a message to the edit controle's window proc wich fills the buffer you suplied. So an edit controle is always going to return a string if you want a float I can think of two things either processing the string once you have it or creating your own edit control.
Posted on 2002-02-27 17:21:54 by Quantum
umberg6007,

It may be possible to do what you are after but I doubt that it will work over a number of windows versions.

The problem will be how the float value is placed in the edit control in the first place. It obviously must be converted to display it as a string and once this is done, you probably can only get the string and convert it back.

If its your own code you just grab the float value before it is converted to string but if its an OS function, there is no reason to assume that it will be done the same way across different versions and is probably an undocumented method of providing a documented interface.

Regards,

hutch@movsd.com
Posted on 2002-02-27 17:27:57 by hutch--
This is possible through string to float but I would like to know how MS retrieves the text, what are the routines behind GetDlgItemText. If we knew how to interact directly with the edit control or any controls on windows we could change or optimized the whole windows API. :) Then again, this is impossible, only MS has the source codes for the win32 API functions :( . Would be great if MS could release some :)

Thanks for the thoughts!!!
Posted on 2002-02-27 17:29:23 by stryker
Do you think any of APIs do low level access to controls :)
Nooooooooooo.
Mostly the same code as for example in M32lib Apis call Apis:)
Trace apis - I found it usefull (ooh - is it reverse ingeniring prohibited here? Then I'd better shut up :))

Any way in the particualar code you might get handle to inner buffer of edit to perform some things faster.
But only native Win32(aka NT) will allow it - in 9x you'll get GPF
if try to read\write from the handle.
Posted on 2002-02-27 17:52:44 by The Svin
Svin,

something like that but for a much more better reason. :) speed. :) I was trying to avoid that word "RE" and was looking for other alternatives, but found none :( Anyway I'm happy with the windows API, I just want to add some nice funtionality. :) Should we call MS and ask them if they could add this function? :grin:
Posted on 2002-02-27 17:57:40 by stryker
We can do it without their akward help,
they already wrote to much headake for me.
Last thing they proud of - is that Win2000 has 40 000 000 lines
of code now instead of 27 000 000 lines in NT 4.
Well I'm usually proud if I did something by fewer lines,
we have absolutly different opinions of what is createrea for good programming and good OS.
Posted on 2002-02-27 18:12:04 by The Svin
At the risk of bringing down the omnipotence of Microsoft down on my head, as far as I know, tracing through a system DLL or doing an assembler dump on it is not illegal as you are not modifying it or cracking it or using it for any illegal purpose whatsoever.

With the standard of Microsoft documentation, there are times when working out what an API does is not an easy task so tracing it in assembler or in your MSVC debugger is a necessity. As long as you don't hack it and then try and sell it, you are probably OK there.

Just remember that Microsoft was prosecuted for reverse engineering the Stacker software from STAC electronics and subsequently sold it for profit in DOS version 6.0.

In no sense would I advocate any person doing what Microsoft did and got caught for doing it. We must respect other people's software and intellectual property.

Regards,

hutch@movsd.com
Posted on 2002-02-27 23:40:42 by hutch--
I would assume even M$ would not do something as stupid as having undocumented functions to get the text from an edit control.

For something so basic, GetDlgItemText would only be a wrap to GetDlgItem and GetWindowsText (which is only a wrap to WM_GETTEXT).

Really there is nothing to optimize. Considering that processing of a message through a message proc is the major bottleneck.
Posted on 2002-02-28 02:43:45 by huh
api hook can do it.
there're two ways to do, first one is find proc address,write "jmp xxx" to your new proc address, pushad, do you want,popad,jmp to original address.
but diff cpu ,diff code,and it's dangerous,we can not ensure syn while writting memory.

2nd is modify module import table. search all module in process,change getdlgitemtext proc address to your own,jeffrey has told us all.
Posted on 2002-02-28 12:25:31 by xqterry