News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

GDI and richedit

Started by daydreamer, May 05, 2019, 12:03:40 AM

Previous topic - Next topic

aw27

So, hwndButton is a local variable of function InitInstance.

jj2007

That code throws lots of errors, it seems somebody has to add the necessary includes etc.

TimoVJL

maybe GetDlgItem help, if you don't want to use a global button handles.
May the source be with you

daydreamer

Quote from: AW on May 26, 2019, 03:08:43 PM
So, hwndButton is a local variable of function InitInstance.
Thanks
So annoying with c++ overload
The second Hwndbutton 's is globals with same name,but not connected to buttons,not defined
Got it working changing text on B1
Any way to change warning level so it warns about overload?
Thanks timo
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

#19
Magnus,

I have read through this thread and I still don't know what you are trying to do. A button is just a simple UI component that does not have anything to do with Graphic Device Interface (GDI). It is also a control that you don't have much adjustment with, only text and size. A button press can be accessed as a message from either its handle which is a unique ID number OR its control number.

Now if you want to code a custom button which is not all that hard to do, you create a window using CreateWindowEx() then display whatever interface on it you want. It can be a bitmap or a rectangle where you generally set the text with an API like DrawText(). Let un know what you are try to get as an end result and we may be able to help you.

LATER : Here is the bare minimum for changing a button text while clicking on it.

daydreamer

#20
Quote from: hutch-- on May 26, 2019, 10:28:06 PM

LATER : Here is the bare minimum for changing a button text while clicking on it.
great thanks Steve :thumbsup: :eusa_clap:
now I can work on graphics with GUI version of question and with different answers to click buttons with,which I want to reuse for different answers/questions
a riddle for example
maybe an idea to have a variable called used in switch RIGHTANSWER that is set to the ID of the button with right answer
GDI is for draw some nice background and some person that asks the riddles



my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

testing time
facts from wikipedia
Please test,disabled call to tunnel drawing code
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

When resizing, it stops with a stack overrun.

daydreamer

Quote from: jj2007 on June 09, 2019, 05:04:01 AM
When resizing, it stops with a stack overrun.
which OS?
dragging window edges?or minimize/maximize?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

hutch--

Magnus,

Crashes on resize here. Win 10 64 Pro.

daydreamer

I myself noted a less serious bug,maybe someone noticed there appear double answers of right answer on buttons,one is coded to be right answer and the other you get wrong answer because of lacking check for double answers

thanks for testing,Hutch,Jochen
I tested myself dragging and it works few pixels before I get exception handler shows up in debug and shows reference to updatewindow and where my GDI drawtext is,too many paint messages is stacked and calls too?
add some exception handling code?


my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

Quote from: daydreamer on June 09, 2019, 08:43:16 PM
which OS?
dragging window edges?or minimize/maximize?

dragging window edges on Win7-64

Tedd

It looks like you're creating GDI resources (pens, brushes) on every draw, but not cleaning them up again (DeleteObject), only to create them all over again on the next draw, and the next, and the next, and.. oh dear.
It's generally better to create them once at startup, then use them as needed, and delete them on exit.

Another issue is that you're from calling InvalidateRect in response to all WM_COMMAND messages, even ones you're not interested in. Only call InvalidateRect when there is something to be drawn.
For a silly example: note the current question, then click the About menu item -- the question changes.
Potato2

daydreamer

Quote from: Tedd on June 12, 2019, 10:37:52 PM
It looks like you're creating GDI resources (pens, brushes) on every draw, but not cleaning them up again (DeleteObject), only to create them all over again on the next draw, and the next, and the next, and.. oh dear.
It's generally better to create them once at startup, then use them as needed, and delete them on exit.

Another issue is that you're from calling InvalidateRect in response to all WM_COMMAND messages, even ones you're not interested in. Only call InvalidateRect when there is something to be drawn.
For a silly example: note the current question, then click the About menu item -- the question changes.
I gonna fix that with messages
thanks,maybe better to solve showing score and right wrong different,than to draw it
want to place drawing in a separate thread,so it doesnt make controls laggy

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

Tedd

Quote from: daydreamer on June 13, 2019, 01:08:12 AM
thanks,maybe better to solve showing score and right wrong different,than to draw it
want to place drawing in a separate thread,so it doesnt make controls laggy
There shouldn't be any problem with drawing, as long as you do it correctly :tongue:
I don't expect a separate thread will be necessary unless you're planning on doing lots of continuous drawing, i.e. animations.
Potato2