Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB conversion 1

Status
Not open for further replies.

badukist

Programmer
Jun 26, 2003
146
RO
Hi all
A simple question, if someone knows
How to convert VB &H0 value to VFP numeric?
Thanks
 
badukist

To add to Mike's comment, you can use the &HO in VFP by defining itas in this example:

# DEFINE HH_DISPLAY_TOPIC &H0

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
"&H" is VB's way of doing Hex notation. However in VFP you would use "0x" instead so...

VB VFP
&H0 = 0x0

Slighthaze = NULL
craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Many thanks for your replies!
I wanted to try GradientFill API and the VB sample had constants in this form.
Unfortunately, don't work, only a black rectangle instead gradient :-(
 
badukist

Try this in init of the form:

Code:
LOCAL lnRow

ThisForm.ScaleMode = 3
ThisForm.DrawWidth = 1

FOR lnRow = 0 TO ThisForm.Height
 ThisForm.ForeColor = RGB(0,0,255-255*lnRow/ThisForm.Height)
 ThisForm.Line(0, lnRow, ThisForm.Width, lnRow)
NEXT lnRow

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike (G),
Code:
# DEFINE HH_DISPLAY_TOPIC  &H0
Won't work in VFP, you'll need to "convert" it to:
Code:
# DEFINE HH_DISPLAY_TOPIC  0x0 && &H0
Rick
 
Badukist,

I don't know how your VB code looks like. Here is the example of using GradientFill:

Local lnhDC, lnWidth, lnHeight
Local lcVertex, lcVert1, lcVert2, lcRect

Declare Long GetDC in User32 Long nhWnd
Declare Long ReleaseDC in User32 Long nhWnd, Long hDC
Declare Long GradientFill in Msimg32 ;
Long hDC, String pVertex, Long dwNumVertex, ;
String pMesh, Long dwNumMesh, Long dwMode

lnhDC = GetDC( _Screen.hWnd )
lnWidth = _Screen.Width
lnHeight = _Screen.Height

lcVert1 = Num2DWord( 0 ) + Num2DWord( 0 ) + ;
Num2Word( 0x0000 ) + Num2Word( 0x0000 ) + ;
Num2Word( 0x0000 ) + Num2Word( 0x0000 )
lcVert2 = Num2DWord( lnWidth ) + Num2DWord( lnHeight ) + ;
Num2Word( 0x0000 ) + Num2Word( 0x0000 ) + ;
Num2Word( 0xFF00 ) + Num2Word( 0x0000 )
lcVertex = lcVert1 + lcVert2
lcRect = Num2DWord( 0 ) + Num2DWord( 1 )
GradientFill( lnhDC, lcVertex,2, lcRect,1, 0 )

ReleaseDC( _Screen.hWnd, lnhDC )
Clear Dlls
Clear all


Procedure Num2Word(tnNum)
Local lc0, lc1
lc1 = chr(int(tnNum / 256))
lc0 = chr(mod(tnNum, 256))

Return lc0 + lc1
EndProc


Procedure Num2DWord(tnNum)
Local lc0, lc1, lc2, lc3, lcResult
lc3 = chr(int(tnNum / 16777216))
tnNum = mod(tnNum, 16777216)

lc2 = chr(int(tnNum / 65536))
tnNum = mod(tnNum, 65536)

lc1 = chr(int(tnNum / 256))
lc0 = chr(mod(tnNum, 256))
lcResult = lc0 + lc1 + lc2 + lc3

Return lcResult
EndProc


-- AirCon --
 
Thanks a lot AirCon.
This is what I'm looking for.
 
You are welcome Badukist.
The example above was a straight translation from C++ example at MSDN


-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top