• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Tab key / procedure

## Recommended Posts

Hi All, I am currently learning Windows programming, and now I have a problem to set the tab orders for the controls e.g I have two Edit controls called: "edit1" and "edit2" does anyone knows how can I use the Tab key to move the input focus from "edit1" to "edit2". P.S In the Programming Windows 95 book, it said you can use window subclassing, I tried that, but it won''t let me compile, with the following error message: Error: colors1.c(239,69):Type mismatch in parameter ''lpPrevWndFunc'' in call to ''CallWindowProcA'' please if could help me. lots of thanks DES3D

##### Share on other sites
If it''s a simple window or actually even a complex window, use a dialog editor and use a dialog box as main window. This is actually kindof the way windows was designed. Dialog boxes have the same color background as the neutral 3D color so controls belnd seamlessly and it handles the tab key as well as severl other like space, enter, pageup, pagedown, home, end, arrow keys and such. Works great!
See ya,
Ben

##### Share on other sites

Most probably your subclass wnproc is declared incorrectly

Try
LRESULT CALLBACK TheSubClassProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam){}

if the STRICT macro is defined (it should be). If not you need to declare it as FAR WINAPI*.

..

##### Share on other sites
Thanks Cyberben and Void''s replies

for Cyberben,
Yes, I knew the diag box is very good, but I want to learn to use the window,

for Void,
my declaration is right, but it still complain about the last line: "return CallWindowProc..."

LRESULT CALLBACK ScrollProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
...
...
return CallWindowProc (fnOldScr, hwnd, iMsg, wParam, lParam) ;
}

how can use the strict macro??

• ### Forum Statistics

• Total Topics
627700
• Total Posts
2978695

• 21
• 14
• 12
• 10
• 12