flat assembler
Message board for the users of flat assembler.

Index > Windows > HELP: resource

Author
Thread Post new topic Reply to topic
tutenhamon



Joined: 16 Jan 2010
Posts: 27
Location: Polska (Poland)
tutenhamon 13 Sep 2010, 21:28
I compiled this

Code:
include 'win32ax.inc' 

DIAL = 37 
ID_TITLE = 100 
ID_CLAS = 101 
ID_GET = 105 
ID_CLOWS = 106 

.data 
klasa rb 256 
tytuB   rb 256 

dlg      dd ? 
Handle dd ? 
hwnd dd ? 
endl db 10,13 
.code 
start: 

invoke    GetModuleHandle,0 
invoke    DialogBoxParam,eax,DIAL,HWND_DESKTOP,DialogProc,0 
invoke    ExitProcess,0 

proc DialogProc hwnd,msg,wparam,lparam 

.if [msg] = WM_INITDIALOG 
.elseif [msg] = WM_COMMAND 
.if [wparam] = ID_CLOWS 
invoke SendMessage,[hwnd],WM_CLOSE,0,0 
.endif 
.elseif [msg] = WM_CLOSE 
invoke EndDialog,[hwnd],0 
.endif 

ret 
endp 

.end start 

section '.rsrc' resource data readable 

directory RT_DIALOG,dialogs 

resource dialogs,DIAL,LANG_POLISH,demonstration 

dialog demonstration,'Create message box',70,70,190,175,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME 
dialogitem 'STATIC',"&TytuB:",-1,10,10,70,8,WS_VISIBLE 
dialogitem 'EDIT',"",ID_TITLE,10,20,170,13,WS_VISIBLE+WS_BORDER+WS_TABSTOP 
dialogitem 'STATIC',"&Klasa:",-1,10,40,70,8,WS_VISIBLE 
dialogitem 'EDIT',"",ID_CLAS,10,50,170,13,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL 
dialogitem 'BUTTON',"Pobie|",ID_GET,85,150,45,15,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON 
dialogitem 'BUTTON',"Zamknij",ID_CLOWS,135,150,45,15,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON 
enddialog    


When I run program.
I see this

Image

Why window style is bad?
Post 13 Sep 2010, 21:28
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 13 Sep 2010, 22:05
If you don't process the message you should set EAX to zero, so this would be a correct DialogProc:
Code:
proc DialogProc hwnd,msg,wparam,lparam 

.if [msg] = WM_INITDIALOG

   mov eax, TRUE
.elseif [msg] = WM_COMMAND

   .if [wparam] = ID_CLOWS

      invoke SendMessage,[hwnd],WM_CLOSE,0,0
   .endif
   mov eax, TRUE
.elseif [msg] = WM_CLOSE

   invoke  EndDialog,[hwnd],0
   mov eax, TRUE
.else

   mov eax, FALSE
.endif 

ret
endp    


If you meant that your problem is that your dialog is looking like old Windows 2000 style then you need to do just one more thing: http://board.flatassembler.net/topic.php?t=3256 (read the entire thread)

(Notice that the corrections I've made earlier are still needed because here your program was unusable before the fixes)
Post 13 Sep 2010, 22:05
View user's profile Send private message Reply with quote
tutenhamon



Joined: 16 Jan 2010
Posts: 27
Location: Polska (Poland)
tutenhamon 14 Sep 2010, 14:46
Yes procedure DialogProc isn't done
I know about manifest.
Me problem is:
no border in application and doubled controls in window
Post 14 Sep 2010, 14:46
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 14 Sep 2010, 17:36
tutenhamon,

That's quite strange. On my XP SP2 dialog displays without duplicates (still looking weird, though: only child controls are drawn; Loco is right about DlgProc return value).

Can you attach resulting .Exe?
Post 14 Sep 2010, 17:36
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 14 Sep 2010, 17:38
tutenhamon, have you at least tried the DialogProc I've provided? It resolved all the visualization issues here...
Post 14 Sep 2010, 17:38
View user's profile Send private message Reply with quote
tutenhamon



Joined: 16 Jan 2010
Posts: 27
Location: Polska (Poland)
tutenhamon 14 Sep 2010, 18:49
LocoDelAssembly yes, you are right (I was not understand you )
I not expected of problem in procedure.
if I put xor eax,eax at end procedure problem was solved.
Post 14 Sep 2010, 18:49
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 16 Sep 2010, 12:19
Also you may wish to add a string at the begin of the source (after "win32a.inc"):
Code:
include 'encoding\win1250.inc'
    

to show polish characters properly
Post 16 Sep 2010, 12:19
View user's profile Send private message Visit poster's website Reply with quote
tutenhamon



Joined: 16 Jan 2010
Posts: 27
Location: Polska (Poland)
tutenhamon 17 Sep 2010, 16:38
shoorick very very big thanks
Post 17 Sep 2010, 16:38
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.