Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9078909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:44:05+00:00 2026-06-16T19:44:05+00:00

I’m trying to write an ASM version of a Java app I developed recently,

  • 0

I’m trying to write an ASM version of a Java app I developed recently, as a project in Win32 ASM, but as the title states, I’m having problems with GdiGradientFill; I’d prefer, for the moment, to use FASM, and avoid higher level ASM constructs, such as INVOKE and the use of the WIN32 includes.

What I have, atm:

PUSH    [hWnd]                                                  
CALL    [User32.GetWindowDC]                                
MOV     [hDC], EAX                          
PUSH    rectClient                              
PUSH    [hWnd]                          
CALL    [User32.GetClientRect]  

PUSH    [rectClient.left]
POP     [colorOne.xPos]
PUSH    [rectClient.top]
POP     [colorOne.yPos] 
MOV     [colorOne.red],     0xC000
MOV     [colorOne.green],   0xC000
MOV     [colorOne.blue],    0xC000
MOV     [colorOne.alpha],   0x0000

PUSH    [rectClient.right]
POP     [colorTwo.xPos]
PUSH    [rectClient.bottom]
POP     [colorTwo.yPos] 
MOV     [colorTwo.red],     0x0000
MOV     [colorTwo.green],   0x2800
MOV     [colorTwo.blue],    0x7700
MOV     [colorTwo.alpha],   0x0C00

MOV     [gRect.UpperLeft],  0
MOV     [gRect.LowerRight], 1

PUSH    GRADIENT_FILL_RECT_H                            
PUSH    1                               
PUSH    gRect                               
PUSH    2                           
PUSH    colorOne                            
PUSH    [hDC]                               
CALL    [GDI32.GdiGradientFill]

However, the code returns only a FALSE, and after going through both MSDN
(http://msdn.microsoft.com/en-us/library/windows/desktop/dd373585(v=vs.85).aspx)

and some other examples (http://www.asmcommunity.net/board/index.php?topic=4100.0), I still can’t see what I am doing wrong, can anyone see the flaw here?

An additional problem has been with my attempts to use Msimg32’s GradientFill, as this always leads to a crash, however, I have seen some reports that Win2K+ OS’s simply pass the parameters from Msimg32 to GDI32; is this accurate, or has anyone else experienced problems with this form?

Pastebin link for whole code: http://pastebin.com/GEHDw6Qe

Thanks for any help, SS

EDIT:
Code is now working, honestly, I have no idea what has changed, I can’t see anything different between the previous and now working data, other than changing the PUSH / POP sequence to MOV EAX, [rectClient.left], ect (The PUSH / POP method works, also) – Many thanks to those who offered assistance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:44:06+00:00Added an answer on June 16, 2026 at 7:44 pm

    You’re passing what looks like a RECT as the 4th parameter to GdiGradientFill. The function expects a GRADIENT_TRIANGLE.

    Also, PUSH/POP is a very weird way to copy from one memory location to another. You’re doing 4 memory accesses instead of two. Copy via a register; this is not Java.

    Are you sure GetWindowDC is what you need? That one returns the DC for the whole window, title and border and all. For just the client area, people normally use GetDC(). When done, call ReleaseDC().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I want to count how many characters a certain string has in PHP, but
I am using JSon response to parse title,date content and thumbnail images and place
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.