News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

What kind of # is This ???

Started by ic2, January 30, 2007, 07:12:57 PM

Previous topic - Next topic

ic2

I don't know nothing about numbers other than how much changes i'm suppose to gt back after a purchase with no interest tag on to complicate things. 

If i remember right, I founded a fault in my programming that generated a bad number in the rect.left and top position while testing  WritePrivateProfileString that made my window disappear off the screen.  One of the number when something like this   714994 or it could have been a eight and not six consecutive numbers in this form, I don't remember but it should give a person of experience an the idea of what type of number this is.

This is not the first time it happen but it has been a long time since i seen one.  Anyway, now i got interest to find out what kind of number it is... It's not binary, hex or ASCII.  Is it known as a 32 bit number or what.

Whatever it is I want to know how to convert it to ASCII and BACK on the fly.

What do i use.  I tried string2dword,atodw, a2dw etc and get nothing that make since.

Hope some one can help.

Ic2


j_groothu

I'm a noob, but I'll take a stab,

Rect.Left is a LONG ( 32-bit signed integer , which is a signed DWORD), so it can have negative numbers,
masmlib help file calls them a "signed 32 bit integer" in some function reference.

dwtoa from masm32 lib should work conversion from long to ascii . ( and give a minus '-' sign in the string ?)

atol should convert a string back to the long.

can someone confirm or deny if this would work ? I hope I understood your question properly ic2  :eek

[EDIT: I also noticed there are the sstr$  & sval macros in macros.asm, ....sstr$ macro invokes dwtoa... sval macro invokes atol ... cool looking code in there  :dazzled:]

[LATER:, I see, WritePrivateProfileString() needs a pointer to a zero terminated string lpszString so those procs/macros should work....]

ChrisLeslie

If you have something like "714994" presented to you, then it is a value represented in decimal notation and making use of ascii symbols. If you try to convert it to binary then you will get something that probably will really not make any sense to you. Sometimes decimal numbers can be converted to hex or octal in order to make it easier to see relevant bits, bytes and nibbles. But I suspect your problem is that you don't know how to interpret the value that you get in the context of the application's problem.

Chris

ic2

You certainly did j_groothu :) And i bet you are right. 

Finally found something that is making me interested in coding with math.  Maybe i want convert it and learn how to use it but.  But I still will be converting just to see what it suppose to look like and do.

Would you or someone know the two numbers that will center any app on the screen or visible Top Left corner.   I can manually calculate things from there and learn quicker as I read up on it.

Thanks a TON j_groothu

......

ChrisLeslie

All i want to do is use that type number in my Can I use it as is would be even better but I need something to help me calculate where i want my window to stay even if i have to convert it to it original form and caculate that too.  Can we do this" If so how....

Since Window use it to take an app from view off to the left of the screen when i screw up I should be able to set it in a rect point and use it myself.  That's is all I want to do. Something difference I appreciate all the help i can get to get past this. 

How would I center using it.

Thanks for the response

j_groothu

um not 100% sure but top / left = 0,0 ? give it a try.

centring I think would involve doing some math with GetScreenWidth() and GetScreenHeight() WinAPI calls, there might be a better way using window styles or something...


ChrisLeslie

Take a look at the masm32 examples - example01/generic/generic.asm. In it there is a procedure to calculate the top x and y coordinates to center a Window given the current screen metrics. Those coordinates are then passed on to the CreateWindowEx call in WinMain. Study this example closely, and it is well commented. If you want the Window to be top left position just use zero coordinates.  I hope that is what you are actually asking about?

j_groothu, shouldnt you be at school at the moment  :bdg

Chris

j_groothu

LOL, that was true, I slept in , "Today's Lesson - Advanced Oscilloscopes"  :8)

ic2

It's amazing when programming in ASM.  I done went from writing a simple program to trying to be a Windows mathematician all in two days.

I see now, you are right ChrisLeslie... i don't know how to interpret the value that i got in the context of my application's problem.  Since that statement I done got serious enough to trying to dig into the OS, Explorer or something to find some answers.  I been reading everything, everywhere all day now I stuck on learning memory management. Will it ever end...

You guys made me more determine to learning Asm on an much higher level despite the outcome.  The truth is, if my high school teachers were more like the people at this Forum i would have a Doctor degree today.

Just stopping in to say Thanks for  everything before i dive into this mess  that i may never want to come out of ..  :) :) :)

All is Well