win api

Posted By: flits

win api - 12/25/08 12:58

i want to set a standard menu so i dont have to create a menu

no i have a problme white using api
it crash when i add the menu

if there is a other way to use api whitout losing control of mouse and key_bord then it will be great

Code:
#include <acknex.h>
#include <default.c>
#include <windows.h>



void set_api_main()
{
	HMENU menu=CreateMenu();
	HMENU hSubMenu=CreateMenu();
	InsertMenu(hSubMenu,0,MF_BYPOSITION|MF_STRING,1,"BEEP");
	InsertMenu(hSubMenu,1,MF_BYPOSITION|MF_STRING,2,"QUIT");
	InsertMenu(menu,0,MF_BYPOSITION|MF_STRING|MF_POPUP,hSubMenu,"File"); 
	
	//Change Window style to activate Maximize button
	SetWindowLong(hWnd,GWL_STYLE, WS_CAPTION+WS_SYSMENU+WS_MAXIMIZEBOX+WS_SIZEBOX); 
	SetMenu(hWnd,menu);//here it crash
	ShowWindow(hWnd,SW_SHOW);
	
}

function MyMessageFunction(UINT message, WPARAM wParam, LPARAM lParam);

function main()
{
	set_api_main();
	on_scanmessage = MyMessageFunction;
}

function MyMessageFunction(UINT message, WPARAM wParam, LPARAM lParam){
	if(message == WM_COMMAND){ wait(1);}	
}


thx flits
Posted By: WretchedSid

Re: win api - 12/25/08 14:09

this works fine
Code:
        long menu;
	long hSubMenu;
	
	HWND hwnd=hWnd;

	menu=CreateMenu();
	hSubMenu=CreateMenu();
	
	InsertMenu(hSubMenu,1,MF_BYPOSITION|MF_STRING,1,"BEEP");
	InsertMenu(hSubMenu,2,MF_BYPOSITION|MF_STRING,2,"QUIT");

	InsertMenu(menu,0,MF_BYPOSITION|MF_STRING|MF_POPUP,hSubMenu,"Datei");
	
	SetMenu(hwnd,menu);

Posted By: flits

Re: win api - 12/25/08 15:43

it still crashes on setMenu
Posted By: flits

Re: win api - 12/25/08 15:52

l0l you never gonna believe

i just put a wait(1); and it works
Posted By: Tobias

Re: win api - 12/25/08 15:58

The video device is opened in first frame, and before that hWnd is not valid (I think).
Posted By: flits

Re: win api - 12/25/08 18:27

i got a new question if i dont use winapi the mouse shows correctly his place
when i use it then it is far from right
Posted By: EvilSOB

Re: win api - 12/26/08 02:47

Be careful, is you function is triggered/executed and the user
and a keyboard key pressed, it may stay "jammed" on until they
press and release it again.
I have had this trouble with many API screen-control functions.
My UGLY fix was to put in this line in the code.
Code:
while(key_any!=0) wait(1);


Hpe this is of some help.
Posted By: flits

Re: win api - 12/30/08 19:03

i know now whats wrong but the fuctions isnt standart include in the widows.h

i need this function void LogicalToPhysicalPoint(HWND hWnd,LPPOINT lpPoint);
ore the reverse or the BOOL GetPhysicalCursorPos( LPPOINT lpPoint
);

does anyone know how to insert this ore how this precies works

seconds question does some how to create a drag drop menu like in sed en med as toolbars

flits
© 2024 lite-C Forums