i have a question the code i refer is added to the iczelion tut no 03 win.asm (i have added it in between .else below WM_DESTROY)
this seems to work pops up a button and also uses the cursor (202)
originally i had a MessageBox in place of CreateWindowEx it was popping up but it was not using the cursor
why doesnt a MessageBox use the cursor while CreateWindowExa shows the cursor without any problems
is there any way around this ( imean using masm)
i checked around in google all i could lay my hands were som vb code which was advocating using SetWindowsHooks hooking WH_CBT
or i saw a cuttingedge article a whole new .net class in msdn
.elseif uMsg == WM_CREATE
invoke CreateWindowExA,NULL,addr clan,addr clan,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT
,CW_USEDEFAULT,300,300,NULL,NULL,hInstance,NULL
mov hound,eax <--- i have it in .data
invoke ShowWindow, hound,SW_SHOWNORMAL
invoke UpdateWindow, hound
invoke LoadCursor,hInstance,202
invoke SetCursor,eax
invoke Sleep,5000
this seems to work pops up a button and also uses the cursor (202)
originally i had a MessageBox in place of CreateWindowEx it was popping up but it was not using the cursor
why doesnt a MessageBox use the cursor while CreateWindowExa shows the cursor without any problems
is there any way around this ( imean using masm)
i checked around in google all i could lay my hands were som vb code which was advocating using SetWindowsHooks hooking WH_CBT
or i saw a cuttingedge article a whole new .net class in msdn
bluffer,
Functionality for MessageBox is not deigned to be extended, it is a minimalist function in the operating system to display some data and get a limited range of responses. With various non-standard tricks it can probably be done but why bother, there are other more flexible ways to display data with far more options.
Resource dialogs, in memory dialogs and manual CreateWindowEx() windows can all do far more and the code is not very big to do it.
Functionality for MessageBox is not deigned to be extended, it is a minimalist function in the operating system to display some data and get a limited range of responses. With various non-standard tricks it can probably be done but why bother, there are other more flexible ways to display data with far more options.
Resource dialogs, in memory dialogs and manual CreateWindowEx() windows can all do far more and the code is not very big to do it.
thanks hutch for your fast answer
yeah i googled around and came to the same conclusion that one can force messagebox to use a custom cursor by using some nonstandard tricks
but i seem to have a vc++ code which some how makes the messagebox display a custom cursor
i looked around in it i dont see it using any SetWindowsHooks and such
all it does is LoadCursor and SetClassLong (*,GCL_HCURSOR,*)
i tried coding SetClassLong() but it doesnt display my cursor
i would like to know if there is any possibility at all without using SetWindowsHooks to make it dispaly a custom cursor in MASM
yeah i googled around and came to the same conclusion that one can force messagebox to use a custom cursor by using some nonstandard tricks
but i seem to have a vc++ code which some how makes the messagebox display a custom cursor
i looked around in it i dont see it using any SetWindowsHooks and such
all it does is LoadCursor and SetClassLong (*,GCL_HCURSOR,*)
i tried coding SetClassLong() but it doesnt display my cursor
i would like to know if there is any possibility at all without using SetWindowsHooks to make it dispaly a custom cursor in MASM
well i wasnt satisfied so i looked at the c++ app again
and well it was setting the button class cursor using SetClassLong
and i didnt have a button so i just created a dummy button
and then used MessageBox and the messagebox ok button now shows the
cursor i thought ill save this info :)
here is how it works (i use icz tute no 3 win.asm)
the code i inserted inside it between it .IF and .Else
and well it was setting the button class cursor using SetClassLong
and i didnt have a button so i just created a dummy button
and then used MessageBox and the messagebox ok button now shows the
cursor i thought ill save this info :)
here is how it works (i use icz tute no 3 win.asm)
the code i inserted inside it between it .IF and .Else
.elseif uMsg == WM_CREATE ; a dummy window with button class
invoke CreateWindowExA,NULL,addr clan,addr clan,\
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,\
300,300,NULL,NULL,hInstance,NULL
mov hound,eax ;save handle
mov edx,201 ;first cursor rsrc id
recursor:
push edx ;used as counter and ref
invoke LoadCursor,hInstance,edx ; :)
invoke SetClassLong,hound,GCL_HCURSOR,eax ;setcursor Btn invoke MessageBox,0,addr ClassName,addr AppName,0 ;ok :)
invoke Sleep,200 ; fun showing 3 diff cursors
pop edx
inc edx
cmp edx,203
jna recursor
Nice trick!
bilbo
By the way, it works also if you create a null-sized dummy button window!
bilbo
By the way, it works also if you create a null-sized dummy button window!
tx you liked it
yeah i just copy pasted a button code from somewhre i did not play with it
if you already have a button in your project you even dont need to create
this dummy button all you have to do is
SetClassLong(hWnd,GCL_HCURSOR,hCursor) on button and whoosh the MessageBox gets the cursor :)
yeah i just copy pasted a button code from somewhre i did not play with it
if you already have a button in your project you even dont need to create
this dummy button all you have to do is
SetClassLong(hWnd,GCL_HCURSOR,hCursor) on button and whoosh the MessageBox gets the cursor :)