hey i have a window and a checkbox and when i want to have it so that when u click on the checkbox it opens a new window.. i have the code for the new window in another .asm file so how could i do this??? thanx
Posted on 2001-06-24 20:59:00 by Kezza
in your wndproc you need to intercept the checkbox click(actually a button).
.IF uMsg==WM_COMMAND
   mov eax,wParam
      .if ax==Box1ID                                              ;check for your checkbox ID
         shr eax,16 
            .if ax==BN_CLICKED                                    ;if it was your ID was it clicked?
	       invoke SendMessage,hBox1,BM_GETCHECK,0,0           ;if so check to see if its checked or unchecked
                  .if eax == BST_CHECKED                          ;if its checked show the window
                     invoke ShowWindow,hNewWindow,SW_SHOWNORMAL
                  .elseif eax == BST_UNCHECKED                    ;if unchecked hide the window
	             invoke ShowWindow,hNewWindow,SW_HIDE
                  .endif
            .endif
      .endif
since your code for your other window is in another file you need to use the include directive so that you can include the code in your program where its suppose to go. so in your wm_create you would have a line such as: include nameoffile.asm that works of course if you only have code for the wm_create section of your code in the external file. hope that clear enough. smurf This message was edited by smurf, on 6/24/2001 9:22:51 PM
Posted on 2001-06-24 21:19:00 by smurf
Hmm..Let the newbie me attempt to answer this question.Correct me if I'm wrong. What u need to do is: Method 1: 1)Make the code(in the other .asm file)a proc. 2)declare it in ur current file using EXTRN 3)Call for the proc in ur current .asm 4)Link the both of them.(this method is based on all my knowledge of ASM now.) Method 2(might not work): Copy that part of code in the other .asm file and add them to ur current .asm file. These might not be the best ways. SO, u better not listen to mine 1st. Wait for the professionals to arrive and give comments.
Posted on 2001-06-24 21:23:00 by JCL
Hmm..From what Smurf has written, I think mine would not work, since my concepts are based on 16bit Dos ASM. BUt is my path of thought correct, if this application is for dos?
Posted on 2001-06-24 21:26:00 by JCL
JCL, this is 32bit. alot of the discussion going on here are 32bit. but don't worry. (i haven't read all of the post in this thread, i normally read the last post whenever i visit a thread. if it's important, i read them upward.) it's good to see that you're helping. smurf is a newbie, you're a newbie, so am i. newbies ROCK! ----------------------------------------------------------- whenever you have something to post, just post them. don't way for the guru to arrive. :D they tend to get lazy while newbies wants to learn and help each other out. :D :D :D :D :D :D This message was edited by disease_2000, on 6/25/2001 3:01:42 AM
Posted on 2001-06-25 02:59:00 by disease_2000
OK. But can someone look at what i have suggested and tell me whether it was capable of answering Kezza's problem?
Posted on 2001-06-25 06:57:00 by JCL
JCL, what you suggested (as method #1) is the method by which separate object files are linked at compile time. While technically acurate, it doesn't so much answer the question. Effectivly you were answering "write code that works"! As this will (if done correctly :D ) solve Kezza's problem, it is an answer of sorts! As for method 2, this should also work just as well as method one. There is no reason you cannot put all your procs in one asm file. The only times you really want to separate them is for read-ability, reuse-ability, or in the case of VERY big projects, speed. By separating objects, your files will be smaller, and so more readable (all functions are together). Having separate files, and defining them externally, you can create a kind of library (without making a lib), and just define externs, and link at compile time. It can save time because you don't recompile the changed source. Mirno
Posted on 2001-06-25 07:11:00 by Mirno
Hmm, but i thought that's what Kezza has asked for? Anyway, is my method workable for ASM32bit? Or maybe the concepts involved is a totally new one.
Posted on 2001-06-25 07:32:00 by JCL
Hey everyone thanx for ur help, I have the following code, but it wont compile becoz it doesnt like the ax==hwndCheck bit cuz different sizes or something so I tried making it eax and that doesnt work either so does someone know what I can do? or maybe i shouldnt be using hwndCheck? but thats the only thing i thought smurf could mean by box1id thanx mov eax,wParam .if ax==hwndCheck shr eax,16 .if ax==BN_CLICKED invoke SendMessage,hwndCheck,BM_GETCHECK,0,0 .if eax==BST_CHECKED invoke SetWindowText,hwndEdit,ADDR Text1 ;The line below i just commented out just to see ;if I could get something to happen when the checkbox ;is checked ;invoke ShowWindow,???hNewWindow???,SW_SHOWNORMAL .elseif eax==BST_UNCHECKED ;invoke ShowWindow,???hNewWindow???,SW_HIDE .endif .endif .endif
Posted on 2001-06-28 20:54:00 by Kezza
kezza when you create a control you have the options of setting the control id(identifier) and the handle to the control.
    invoke CreateWindowEx, NULL,
                           ADDR ButtonClassName,
                           CheckBoxText,
                           WS_CHILD + WS_VISIBLE + BS_AUTOCHECKBOX + BS_NOTIFY,
                           0,0,150,25,
                           hWin,
                           Box1ID,                              ;<--- set your identifier.
                                                                     ;in your .const section
                                                                     ;place a new line such as
                                                                     ;Box1ID equ 2001
                           hInstance,
                           NULL
    mov hwndCheck,eax                                           ;<--- set your handle
then in your wm_command message you want to check for the Box1ID in ax. basically checking for the identity of your checkbox. smurf
Posted on 2001-06-28 21:36:00 by smurf
There are a number of ways to build multi-file projects that build into an EXE or DLL file. The simplest way is to use the "include" directive that literally includes the text of the included file directly into the code you have written at the location where you include it. You can write a module that can either be linked during the linker stage or alternatively be built with other modules into a library that can be directly included into your code with the "includelib" directive. The "include" approach is better suited for small to medium projects but if you are building a big project, building libraries is finally more efficient. Regards, hutch@pbq.com.au
Posted on 2001-06-28 22:36:00 by hutch--