seidowit@mergvax (Ronald Seidowitz) (06/16/89)
I feel really dumb asking this question, but I am new to assembly language programming under windows. I am trying to assemble a "hello world" program and am having a great deal of trouble with the RegisterClass call. The call to RegisterClass is fine, but when loading the window procedure address into the wndclass structure, the segment portion of the address seems to be wrong. I used the SEG directive from MASM on the procedure name label and the program assembles and links ok. However, at run time the segment that gets loaded causes the machine to die with an illegal instruction in the CreateWindow call when it tries to call the WndProc procedure. Both WinMain and WndProc are defined in the same segment in the .asm file. But when the program runs, the segment address that get loaded by the assembler is not the same as the CS register during WinMain's execution. Since both functions are defined in the same code segment, if I poke the value of CS into the wndclass structure where the segment address of the window procedure goes, the program runs fine. My real problem is: if one is supposed to use a long pointer to the WndProc, how does one find the segment portion of the function address when there is no cmacros.inc macro for segments, and the SEG operator of the assembler creates incorrect code? HELP!!!!!!!! Ron. Send mail to: Ron Seidowitz ...!decvax.dec.com!mergvax.uucp!seidowit Thanx in advance.