0 registered members (),
1,459
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
windows functions?
#300714
12/04/09 17:06
12/04/09 17:06
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
OP
Expert
|
OP
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
hi there..
i wanted to ask if someone knows a way/tutorial/help for my problem:
I want to create editor menüs. At the moment, i do this with bitmaps, panels and buttons. but isn´t there a way to use the windows bordes, frames, tooltip windows, menüs ...etc... inside the A7 window?
Last edited by Espér; 12/04/09 17:10.
|
|
|
Re: windows functions?
[Re: Espér]
#300719
12/04/09 18:03
12/04/09 18:03
|
Joined: Oct 2007
Posts: 5,210 Ä°stanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
|
yes there is but not very easy.
best practice for that would be using c# wrapper and c# itself.
3333333333
|
|
|
Re: windows functions?
[Re: Quad]
#300724
12/04/09 18:13
12/04/09 18:13
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
OP
Expert
|
OP
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
hmm.. Sylar gave me the following code... Can someone explain me how to ask wich menüpoint was selected??? Means - How to ask if new, end, open ...ect is selected.
#include <windows.h>
long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam);
function test()
{
long menu;
long hSubMenu;
long hSubMenu2;
HWND hwnd=hWnd;
menu=CreateMenu();
hSubMenu=CreateMenu();
hSubMenu2=CreateMenu();
InsertMenu(hSubMenu,1,MF_BYPOSITION|MF_STRING,1,"Neu");
InsertMenu(hSubMenu,2,MF_BYPOSITION|MF_STRING,2,"Öffnen");
InsertMenu(hSubMenu,3,MF_BYPOSITION|MF_STRING,3,"Speichern");
InsertMenu(hSubMenu,4,MF_BYPOSITION|MF_STRING,4,"Beenden");
InsertMenu(hSubMenu2,1,MF_BYPOSITION|MF_STRING,5,"Test1");
InsertMenu(hSubMenu2,2,MF_BYPOSITION|MF_STRING,6,"Test2");
InsertMenu(menu,0,MF_BYPOSITION|MF_STRING|MF_POPUP,hSubMenu,"Datei");
InsertMenu(menu,1,MF_BYPOSITION|MF_STRING|MF_POPUP,hSubMenu2,"Bearbeiten");
SetMenu(hwnd,menu);
}
void main()
{
video_set(800,600,32,2);
level_load(NULL);
wait(2);
test();
on_scanmessage = ScanMessage;
}
long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (WM_COMMAND) {
case message:
switch (wParam) {
case 1:
printf("Es wurde auf 'neu' geklickt");
return(1);
case 2:
printf("Es wurde auf 'öffnen' geklickt");
return(1);
// USW:
default:
break;
}
break;
default:
break;
}
}
Sylar won´t help me, because he misunderstood a message from me..
|
|
|
Re: windows functions?
[Re: Lukas]
#300731
12/04/09 18:48
12/04/09 18:48
|
Joined: Oct 2007
Posts: 5,210 Ä°stanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
|
yes InsertMenu(hSubMenu,1,MF_BYPOSITION|MF_STRING,1,"Neu"); InsertMenu(hSubMenu,2,MF_BYPOSITION|MF_STRING,2,"Öffnen");
this numbers are passed as wparam, so you know which is which
3333333333
|
|
|
Re: windows functions?
[Re: Espér]
#300753
12/04/09 21:26
12/04/09 21:26
|
Joined: Oct 2007
Posts: 5,210 Ä°stanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
|
on_scanmassage is the function that listens/catches messages that have been sent to lite-c window. you need to write this function yourself(which is ScanMessage in the script you posted) and process messages. ie WM_COMMAND is a message. when such messages sent on_scanmessage function is triggered. You check which message came in and act respectively.
Last edited by Quadraxas; 12/04/09 21:26.
3333333333
|
|
|
Re: windows functions?
[Re: Quad]
#300799
12/05/09 12:36
12/05/09 12:36
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
OP
Expert
|
OP
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
ok.. i wrote this code now:
//-------------------------------------------------------------------------------------------------
// • Einbinden der Scripts
//-------------------------------------------------------------------------------------------------
#include <acknex.h>
#include <default.c>
#include <windows.h>
//-------------------------------------------------------------------------------------------------
// • Einbinden der Pfade
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
// • Funktionen
//-------------------------------------------------------------------------------------------------
long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam);
function menucreate()
{
long menuheader;
long submenu1;
long submenu12;
HWND hwnd=hWnd;
// CreateMenu(); ist der Befehl dazu, der gibt ein Handle auf das neue Menü zurück
menuheader = CreateMenu();
submenu1 = CreateMenu();
submenu12 = CreateMenu();
// InsertMenu(); ist der Befehl der Menüpunkte erstellt
// InsertMenu(longpointer, Position, Flags, sublongpointer / id, "Anzeigestring");
InsertMenu(submenu1, 1, MF_BYPOSITION|MF_STRING|MF_POPUP, submenu12, "Neu");
InsertMenu(submenu1, 2, MF_BYPOSITION|MF_STRING, 2, "Öffnen");
InsertMenu(submenu1, 3, MF_BYPOSITION|MF_STRING, 3, "Beenden");
InsertMenu(submenu12, 4, MF_BYPOSITION|MF_STRING, 4, "Karte");
InsertMenu(submenu12, 5, MF_BYPOSITION|MF_STRING, 5, "Map");
InsertMenu(submenu12, 6, MF_BYPOSITION|MF_STRING, 6, "Quest");
InsertMenu(menuheader, 0, MF_BYPOSITION|MF_STRING|MF_POPUP, submenu1, "Datei");
SetMenu(hwnd,menuheader);
}
//-------------------------------------------------------------------------------------------------
// • Mainscripts
//-------------------------------------------------------------------------------------------------
function main()
{
fps_max= 60;
video_mode = 8;
video_aspect = 1.777;
level_load(NULL);
wait(3);
menucreate();
on_scanmessage = ScanMessage;
}
//-------------------------------------------------------------------------------------------------
// • Longs
//-------------------------------------------------------------------------------------------------
long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (WM_COMMAND) {
case message:
switch (wParam) {
case 2:
printf("Es wurde auf 'Öffnen' geklickt");
return(1);
case 3:
printf("Es wurde auf 'Beenden' geklickt");
return(1);
case 4:
printf("Es wurde auf 'Neue Karte' geklickt");
return(1);
case 5:
printf("Es wurde auf 'Neue Map' geklickt");
return(1);
case 6:
printf("Es wurde auf 'Neue Quest' geklickt");
return(1);
default:
break;
}
break;
default:
break;
}
}
But now nothing reacts when the project is started.. i need to end the process via the task manager. What´s wrong?
Last edited by Espér; 12/05/09 12:37.
|
|
|
Re: windows functions?
[Re: Espér]
#300830
12/05/09 17:45
12/05/09 17:45
|
Joined: Oct 2007
Posts: 5,210 Ä°stanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
|
hey 2 problems, 1.
long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (WM_COMMAND) {
case message:
should be switch (message) { case WM_COMMAND: because the variable here is the message, WM_COMMAND is only a #defined constant 2. you are only handling WM_COMMAND message, there are alot of other possible messages could be goind around, so you should return a value fot hem. make the last default return 0; that's all i guess.
Last edited by Quadraxas; 12/05/09 17:45.
3333333333
|
|
|
|