flat assembler
Message board for the users of flat assembler.

Index > Windows > How to create custom desined windows?

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
How to create custom designed windows like MSN ou Google Talk do?

Example:
Image
Post 20 Nov 2006, 15:33
View user's profile Send private message Reply with quote
Garthower



Joined: 21 Apr 2006
Posts: 158
Location: Ukraine
Garthower
If such image of windows isn't incorporated in system you are able to do it only using skins. I.e. at first you draw design of windows how you consider it need, then these pictures trace on a window. About buttons - a principle same, you draw a picture on the button. Certainly, it only in general. But the essence such - basic time of realization will borrow not a writing of a code, and drawing of pictures Wink
Post 20 Nov 2006, 16:00
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav
trust me, it's not so hard
Post 20 Nov 2006, 19:17
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav
i created this in fasm Wink


Description: google talk styled form
Download
Filename: main.rar
Filesize: 2.54 KB
Downloaded: 298 Time(s)


_________________
[not enough memory]
Post 20 Nov 2006, 22:14
View user's profile Send private message Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
Looks pretty good.
Could please provide me a simple commented source-code? (if it's not asking too much)
Post 21 Nov 2006, 00:52
View user's profile Send private message Reply with quote
Garthower



Joined: 21 Apr 2006
Posts: 158
Location: Ukraine
Garthower
Vasilev Vjacheslav wrote:
trust me, it's not so hard


And I also didn't speak, that it's very hard. I have told, that it RATHER borrows time much Wink
Post 21 Nov 2006, 12:05
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
Rayslava



Joined: 07 Mar 2006
Posts: 7
Location: Moscow, Russia
Rayslava
So, share the source plz. We'll be very thankful Wink
Post 21 Nov 2006, 21:21
View user's profile Send private message ICQ Number Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
cod3b453
1) Create a window with just WS_VISIBLE style

2) Remove the WS_CAPTION by

Code:
invoke GetWindowLong,[hWnd],GWL_STYLE
mov ebx,eax
and eax,WS_CAPTION
xor eax,ebx
invoke SetWindowLong,[hWnd],GWL_STYLE,eax
    


3) Use SetWindowRgn to set the shape of the window CreateRoundRectRgn should do the rounded corners for you, other fun shapes use Create[Rect/Elliptic/Poly]Rgn and CombineRgn.

4) In your window procedure: WM_PAINT for painting everything on the window including custom titlebar or whatever; WM_MOUSEMOVE can be useful to make close buttons or similar without making a button control which can be drawn directly into the window.

HTH
Post 22 Nov 2006, 23:32
View user's profile Send private message Reply with quote
asmfan



Joined: 11 Aug 2006
Posts: 392
Location: Russian
asmfan
Vasilev Slava, you have a little bug in your example - you spoil the EDI register containing the PAINTSTRUCT before call EndPaint with font handle.
Post 23 Nov 2006, 12:39
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav
here is the source code for this form (don't forget to give proper credits when you will use this in your project, thanks)

ps. edi bug fixed


Description: source code
Download
Filename: gg_src.rar
Filesize: 4.9 KB
Downloaded: 287 Time(s)


_________________
[not enough memory]
Post 24 Nov 2006, 10:47
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Vasilev Vjacheslav, can you please edit your attachment to add the compiled resource? (fasm can't compile rc scripts Razz)
Post 24 Nov 2006, 16:16
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav
this rc-file can be compiled with microsoft resource compiler

ps. i will be very appreciated if Tomasz put my code to examples section on main page as custom interface creating, if possible
Post 24 Nov 2006, 19:00
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
But this will be the first example that doesn't work with a single tool (fasm). Maybe porting the RC script to fasm? I forgot to test Reverend's tool but now I'm on Linux again Mad

[edit]Now I tried porting it by myself but fails at dialogbox creation Sad

Code:
section '.rsrc' resource data readable
  directory RT_DIALOG,dialogs,\
            RT_BITMAP,bitmaps,\
            RT_RCDATA, regions

  resource dialogs,\
           ID_DLGMAIN,LANG_ENGLISH+SUBLANG_DEFAULT,main

  resource bitmaps,\
           ID_BMP,LANG_ENGLISH+SUBLANG_DEFAULT,info

  resource regions,\
           ID_RGN,LANG_ENGLISH+SUBLANG_DEFAULT,region

  dialog main, 0,70,70,332,176,DS_SETFONT+DS_CENTER+WS_POPUP+WS_VISIBLE, , ,'Tahoma', 8
    dialogitem 'BUTTON','_',ID_BTN1,274,3,11,10,BS_OWNERDRAW+BS_CENTER+BS_FLAT+WS_TABSTOP
    dialogitem 'BUTTON','x',ID_BTN2,288,3,11,10,BS_OWNERDRAW+BS_CENTER+BS_FLAT+WS_TABSTOP
  enddialog

  bitmap info,'info.bmp'

  resdata region
    file 'main.rgn'
  endres
; eof    
[/edit]
Post 24 Nov 2006, 20:11
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Code:
G:\Documents and Settings\Hernan\Desktop>rc -?


Microsoft (R) Windows (R) Resource Compiler, Version 5.00.1823.1 - Build 1823
Copyright (C) Microsoft Corp. 1985-1998. All rights reserved.    


Code:
G:\Documents and Settings\Hernan\Desktop>rc main.rc
main.rc(10) : fatal error RC1015: cannot open include file 'afxres.h'.    


After removing the include
Code:
G:\Documents and Settings\Hernan\Desktop>rc main.rc


main.rc (20): error RC2144 : PRIMARY LANGUAGE ID not a number


main.rc (58): error RC2135 : file not found: LANGUAGE


main.rc (67): error RC2135 : file not found: 10    


Pleeeaaassseee, post the compiled res Sad
Post 24 Nov 2006, 22:09
View user's profile Send private message Reply with quote
MichaelH



Joined: 03 May 2005
Posts: 402
MichaelH
LocoDelAssembly, I suspect you already have Microsoft Platform SDK. Anyone who hasn't and is into fasm windows programming should download the latest Platform SDK from MS (and back it up in case you lose it as it's a big download Sad )

In your "User varibles for ?" Environment varibles, in "INCLUDE", place the path to afxres.h, e.g -

C:\Program Files\Microsoft Platform SDK\Include\mfc (or where ever you have it installed).

Open a new cmd window and rc should compile any rc file.


Vasilev Vjacheslav, thanks for this example, it is very much appreciated!
Post 25 Nov 2006, 00:07
View user's profile Send private message Reply with quote
MichaelH



Joined: 03 May 2005
Posts: 402
MichaelH
Vasilev Vjacheslav, I was looking at your code and noticed GradientFill is a import from msimg32.dll. On further research I found when looking at msimg32.dll imports and exports, GradientFill is just a redirect to gdi32.dll GdiGradientFill.

I replaced all the calls to msimg32.dll GradientFill with calls to gdi32.dll GdiGradientFill and sure enough it worked with no alterations.

GdiGradientFill is not in the fasm include gdi32.inc and the existence of msimg32.dll suggest what? ..... gdi32.dll GdiGradientFill is not in all Windows versions?????, hence adding it to gdi32.inc is a bad idea?????
Post 25 Nov 2006, 01:57
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav
MichaelH, yes, i also noticed it, but it's useless (that is why i don't do it)

also i will port resource soon
Post 25 Nov 2006, 13:12
View user's profile Send private message Reply with quote
Vasilev Vjacheslav



Joined: 11 Aug 2004
Posts: 392
Vasilev Vjacheslav
LocoDelAssembly, it's seems there are bug in fasm 'dialogitem' macro, take a look on resource section after compiling
Post 25 Nov 2006, 13:26
View user's profile Send private message Reply with quote
farrier



Joined: 26 Aug 2004
Posts: 274
Location: North Central Mississippi
farrier
From the resource.inc file in the fasm/include/macro directory:

Code:
macro dialogitem class,title,id,x,y,cx,cy,style,exstyle
    


dialogitem takes 9 parameters.

[Edit]
This is wrong: from fasm.pdf

Quote:
The dialogitem has eight required parameters and one optional.
[/Edit]
farrier

_________________
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!


Last edited by farrier on 27 Nov 2006, 00:10; edited 2 times in total
Post 25 Nov 2006, 13:50
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Win32 Headers>>1.6 Resources wrote:
The dialog can take up to eleven parameters, first seven being required.


Or I'm using the incorrect include file?

MichaelH, no, I used the one that comes with MASM package so I'll download the SDK then.

Vasilev Vjacheslav, OK, I'll take a look.
Post 25 Nov 2006, 14:01
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.