In Visual C kan ik probleemloos messages onderscheppen, via wndproc. Nu wilde ik eens borland c proberen en daarin hetzelfde doen. Het is een default project waarin ik in project1.ccp het volgende heb aangepast:
Maar als ik op links druk sluit ie niet af. Waarom werkt dit niet? Moet de declaratie van wndproc anders in borland?
.modbreak: Plaats C++ code tussen [code=c++]...[/code] tags!
C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
| //--------------------------------------------------------------------------- #include <vcl.h> #include <windows.h> #pragma hdrstop //--------------------------------------------------------------------------- USEFORM("Unit1.cpp", Form1); LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); //--------------------------------------------------------------------------- LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { switch(Msg) { case WM_DESTROY: PostQuitMessage(WM_QUIT); break; case WM_KEYDOWN: switch(wParam) { case VK_LEFT: Application->Terminate(); break; case VK_RIGHT: break; case VK_UP: break; case VK_DOWN: break; } return 0; default: return DefWindowProc(hWnd, Msg, wParam, lParam); } return 0; } //--------------------------------------------------------------------------- WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { Application->Initialize(); Application->CreateForm(__classid(TForm1), &Form1); Application->Run(); } catch (Exception &exception) { Application->ShowException(&exception); } catch (...) { try { throw Exception(""); } catch (Exception &exception) { Application->ShowException(&exception); } } MSG Msg; while( GetMessage(&Msg, NULL, 0, 0) ) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return Msg.wParam; } //--------------------------------------------------------------------------- |
Maar als ik op links druk sluit ie niet af. Waarom werkt dit niet? Moet de declaratie van wndproc anders in borland?
.modbreak: Plaats C++ code tussen [code=c++]...[/code] tags!
[ Voor 6% gewijzigd door .oisyn op 07-07-2004 15:43 ]
ASUS Commando | Core2Duo E6600 @ 3Ghz air-cooled | Geforce 8800GTX | Raid-0 | 4 GB DDR2-800