No titlebar or taskbar window - Playing MIDI from resource.

Started by amras, November 05, 2006, 09:52:46 AM

Previous topic - Next topic

amras

I'm at early stage of developing a program based on custom shaped window. I'm stuck at trying to hide my application from taskbar. Somehow i just can't find a thing about how to do it  ::) My needs are simple - I need a window with no titlebar, nor taskbar button... Any clues? :)

hutch--

Maybe you should tell us WHY you want a window that does not show on the task bar. Most "applications" trying to do this are not friendly at all and if there is even a hint that this is the case here, this topic will disappear.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

amras

Hookay, so there's some background information:

My aim is to create a "eCard" - custom shape, music in the background, displaying some moving text. So far i'm done with custom shape and transparency, and it dissapears as you click it. Certainly not a virus :/

I've made some like two years ago, but now I want to improve the algo so taksbar won't be spoiled with unneeded title (as the graphics on the form should explain its purpose).

For those who still think I might be doing some nasty stuff, here's the source together with binary.

Still looking for solution how to play midi file directly from resource but guess I will save res as a file and play it from temp directory...

And back to my previous question - how to do it?

[attachment deleted by admin]

hutch--

This seems to do the job.


        invoke  CreateWindowEx,WS_EX_TOOLWINDOW,ADDR ClassName,ADDR DisplayName,
                WS_POPUP,ebx,eax,PictureW,PictureH,NULL,NULL,hInst,NULL
        mov     hWnd,eax
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

amras

Works great! :) Thanks a lot.

Now i'm struggling with my code to make it play midi directly from resource. I heard this way is closed as api soesn't support playing midi directly from resource, so i'm trying to do this the other way - by saving resource to temporary file and playing it FROM it. Hence my second problem:


    Local fhandle1:DWord
    Local numchar:DWord


    Invoke FindResource, hWnd, RsrcNameMIDI, RsrcTypeMIDI
    Mov hMIDIres, Eax                               
    Invoke SizeofResource, hWnd, hMIDIres   
    Mov hMIDISize, Eax                               
    Invoke LoadResource, hWnd, hMIDIres     
    Invoke LockResource, Eax                         
    Mov hMIDIres, Eax                               
                   
    Invoke CreateFile, Addr path, GENERIC_WRITE, FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0
    Mov fhandle1, Eax                               
    Invoke WriteFile, fhandle1, hMIDIres, hMIDISize, Addr numchar, 0      ; write midi file
    Invoke CloseHandle, fhandle1   


It's a modified code i found on this board. However, for reasons i still haven't figured out, program crashes on attempt to write file on disc with windows xp debug dialog... creation of file works just fine, but it's 0 bytes of size. Still looking for solution, any help would be very appreciated :)

Still have no idea what is numchar for - maybe this is the source of my problems?

PBrennick

amras,
hMIDISize is set by you to the number of bytes you want to write.
numchar is set by the API to the amount of bytes actually written.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

amras

Yes, I have found it just a while ago in win32.hlp, however problem still remains. I need either alternative solution of making my program play midi from itself, or a quick fix to this code above...

I'm pretty sure that last 2 lines cause the problem, at least program crashes there...

Anyone here with a program saving binary file from itself?

donkey

The taskbar is controlled by the ITaskBar interface, I wrote an example of how to control your application showing in it some time ago. Since I am actually going through a few archives this weekend I dug it out...

WARNING -- This is written in MASM, which tells some people here how old it is, probably pre-XP so I can't guarantee that it will work on anything above Win2K.

[attachment deleted by admin]
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

EddieB


sinsi

In part of your code you have
   Invoke FindResource, hWnd, RsrcNameMIDI, RsrcTypeMIDI


What is RsrcNameMIDI and RsrcTypeMIDI? The name can be a string or an integer but the type should be RT_RCDATA (I think) since
there is no MIDI resource type.

In the .rc file, have a line like
100 RCDATA "file.mid"

then in your code use
INVOKE FindResource,hmod,100,RT_RCDATA


Note that FindResource requires a module handle (hmod), not a window handle (hwnd). Do some error checking, since if the resource can't be found
then LoadResource and LockResource will return EAX=0 (null pointer = access violation = crash!).
Light travels faster than sound, that's why some people seem bright until you hear them.

amras

Thanks a lot, will try it in next few hours and post you my result. If I succeed, I'll post whole source here together with source comments on personalization parts (eg - window size, animation speed etc). Maybe someone could use it :) Once again thanks a lot for your support and answers :)