F-IN-BOX DLL Edition Help >> Extensions >> Notifications

FPCN_LOADEXTERNALRESOURCE

Message

[ C++ ]
FPCN_LOADEXTERNALRESOURCE

Structure

[ C++ ]
struct SFPCLoadExternalResource
{    
    NMHDR hdr;
    
    LPCTSTR lpszRelativePath;
    LPSTREAM lpStream;
};

Description

The FPCN_LOADEXTERNALRESOURCE is sent when a movie tries to load an external resource (xml, jpeg, etc.) using a relative path. The message is sent only if the movie is loaded from memory.

For instance, a movie loads an image using the following code:

[ ActionScript ]
loadMovie("images/external_image.jpg", "square");

You can provide the content of this image by handling the notification message FPCN_LOADEXTERNALRESOURCE:

[ C++ ]
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	switch (uMsg) 
	{
...
            case WM_NOTIFY:
            {
                NMHDR* pNMHDR = (NMHDR*)lParam;

                if (pNMHDR->hwndFrom == g_hwndFlashPlayerControl)
                {
                    switch (pNMHDR->code)
                    {
                        case FPCN_LOADEXTERNALRESOURCE:
                        {
                            SFPCLoadExternalResource* pInfo = (SFPCLoadExternalResource*)lParam;

                            if (0 == lstrcmpi(pInfo->lpszRelativePath, _T("images/external_image.jpg")))
                            {
                                HMODULE hModule = GetModuleHandle(NULL);
                                HRSRC hResInfo = FindResource(hModule, _T("IMAGE1"), _T("JPEG"));
                                HGLOBAL hResData = LoadResource(hModule, hResInfo);
                                LPVOID lpResourceData = LockResource(hResData);
                                DWORD dwResourceSize = SizeofResource(hModule, hResInfo);
                        
                                ULONG ulWritten;
                                pInfo->lpStream->Write(lpResourceData, dwResourceSize, &ulWritten);
                            }

                            break;
                        }
                    }
                }

                break;
            }
       }
...
}


Copyright © Softanics. All rights reserved.
F-IN-BOX is a trademark of Softanics.
Macromedia and Shockwave Flash are trademarks of Adobe