News:

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

Of Mice and Messages

Started by NoCforMe, October 04, 2011, 07:36:55 PM

Previous topic - Next topic

dedndave

yah - and Ketil's source files are nice to read, too   :P
let me see if i can find his old text editor as an example....

dang - can't find it

Gunner

That is why I posted the link to WinASM, it is a similar IDE and became open source recently.
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

dedndave

well, so far, i can make sizable boxes   :P



i had to use WS_CLIPSIBLINGS - that may be the problem on your other program

NoCforMe

Quote from: dedndave on October 09, 2011, 06:07:07 PM
i had to use WS_CLIPSIBLINGS - that may be the problem on your other program

Well, I tried that, and it didn't fix the problem I'm having.

However: the plot thickens.

Currently my little child windows are resizeable. If I drag one without resizing it, it gets repainted correctly after being drug under the status bar. But if I resize it, then it gets messed up when you do this.

Does this give anyone a clue as to what's going on here?

dedndave

i was having problems when creating a new child
the new one was underneath any previously created child (if they overlapped)
instead of using MoveWindow to change the window position, try using SetWindowPos
this function has some flags that allow you to control the Z-order, as well as certain aspects of the redraw process
most notably, a flag for SWP_DRAWFRAME

using SetWindowPos after window creation solved my Z-order problem
i had already tried SetForegroundWindow, SetFocus, SetActiveWindow, EnableWindow   :P

these are the style flags i am using for child windows
WS_CHILD or WS_THICKFRAME or WS_VISIBLE or WS_CLIPSIBLINGS
maybe i am missing one - i would have thought the newly created window would be on top

NoCforMe

I tried that (SetWindowPos() instead of MoveWindow()). Interesting: it fixed the border-drawing problem.

But it created a new problem: the text inside the child window isn't redrawn until you release the mouse button. ??????

Further investigation required.

(The flags I used are SWP_DRAWFRAME OR SWP_NOSIZE OR SWP_NOZORDER OR SWP_SHOWWINDOW, since I wasn't changing either the window size or its Z-order.)

dedndave

hmmmm - interesting

you might try using HWND_TOP for the hWndInsertAfter parameter
then, play with the uFlags parameter, starting with just the SWP_SHOWWINDOW flag
it sounds as though you have the SWP_NOCOPYBITS flag set, which you do not
maybe the SWP_DRAWFRAME causes it to draw just the frame   :P

i haven't got to the text part yet - lol
i do have boxes that size properly
when you left click on a box (including its sizing border), it comes to the top

i was just working out a strategy for moving the boxes
as far as i can see, there should be no need for DragDetect
when you get a WM_MOUSEMOVE message, bit 0 of wParam tells you if the left button is up or down
if it is up, you simply update the cursor position in the status bar and exit
if it is down, you do that, then move the box, as well
sounds simple enough   :bg

dedndave

oh - you might check your display settings - just to make sure...

Display Properties
Appearance tab
Effects button
be sure you have the "Show window contents while dragging" box checked

NoCforMe

Quote from: dedndave on October 10, 2011, 04:18:09 AM
you might try using HWND_TOP for the hWndInsertAfter parameter

Tried it, no improvement.

Quotethen, play with the uFlags parameter, starting with just the SWP_SHOWWINDOW flag
it sounds as though you have the SWP_NOCOPYBITS flag set, which you do not
maybe the SWP_DRAWFRAME causes it to draw just the frame   :P

Yep, that flag fixed the no-text problem, but now the messed-up borders are back!

Quoteas far as i can see, there should be no need for DragDetect
when you get a WM_MOUSEMOVE message, bit 0 of wParam tells you if the left button is up or down
if it is up, you simply update the cursor position in the status bar and exit
if it is down, you do that, then move the box, as well
sounds simple enough   :bg

But what if you just click in the window without moving the mouse? I guess no harm, no foul, eh? Although I don't think DragDetect() is my problem.

Quoteoh - you might check your display settings - just to make sure...

Display Properties
Appearance tab
Effects button
be sure you have the "Show window contents while dragging" box checked

In Win2K, it's in the Effects tab, but it's checked in any case.

dedndave

well - it was worth a shot   :P
notice that the hWndInsertAfter parameter is only valid without the SWP_NOZORDER flag set
SetWindowPos is like MoveWindow on steroids - lol

tomorrow, i should have a sizable, movable button
i will be able to see how it behaves with text, then

NoCforMe

Hey, Dave, wondering if you could do me a flavor: Could you go through the source  for ResEd and find out where the code is that creates controls (like, say, when you add a text control to a dialog)? Whatever is done in there works 100%, so it might be useful to find out just how it's being done.

I've looked through the code, and MEGO. How could you say that that's good code? There's hardly a single comment in it (the only ones I could find were labels when data types were being defined). Since we can't read the author's mind, it's very difficult to figure out what's being done.

dedndave

there are a number of programs named "ResEd" and "ResEdit"
are you refering to Ketil's program ?
where did you get the source ?

btw, here are a couple others...
http://www.resedit.net/
http://www.wilsonc.demon.co.uk/d10resourceeditor.htm
the later has source, but it's in Delphi   :P
still, you can see what functions are called

NoCforMe

Quote from: dedndave on October 10, 2011, 06:20:44 PM
there are a number of programs named "ResEd" and "ResEdit"
are you refering to Ketil's program ?
where did you get the source ?

It's the one you pointed me to in post #82. The package includes all the source. (Or I guess I downloaded the source separately, but it's all there.)

dedndave

ok - that is Ketil's program
his own site is down, but someone set up a mirror for him (Bogdan, i think)
let me have a look....

dedndave

well - a quick glance
what i did was search for files that contain the text "CreateWindowEx"
here is that list...
DlgEdit.asm
FileIO.asm
Project.asm
Property.asm
RAResEd.Asm
RCDataEdit.asm
ResEd.Asm
ToolbarEdit.asm
ToolBox.asm
XPManifestEdit.asm


of course, not all controls are created that way
you may also search for anything with the word "dialog", for example

some of the stuff you want to see may be in his DLL or LIB's, too