load ocx from file rather than resource?

DLL Edition of the F-IN-BOX
aghatak
Posts: 4
Joined: Thu Oct 29, 2009 7:58 am

load ocx from file rather than resource?

Postby aghatak » Tue Dec 08, 2009 11:32 am

hi,

id like to call FPC_LoadOCXCodeFromMemory but i dont want to embed the ocx as a resource (i just want to ship a file).

whats the easiest way to do this?

thanks
amitabh

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Tue Dec 08, 2009 12:51 pm

Thank you for your question.

You can find sample code here:
http://www.f-in-box.com/dll/help/index/ ... emory.html

Code: Select all

HANDLE hFile = CreateFile(_T("flash.ocx"),   
                          GENERIC_READ,   
                          FILE_SHARE_READ,   
                          NULL,   
                          OPEN_EXISTING,   
                          FILE_ATTRIBUTE_NORMAL,   
                          NULL);   
 
DWORD dwFlashOCXCodeSize = GetFileSize(hFile, NULL);   
 
HANDLE hFileMapping = CreateFileMapping(hFile,   
                                        NULL,   
                                        PAGE_READONLY,   
                                        0,   
                                        dwFlashOCXCodeSize,   
                                        NULL);   
 
LPVOID lpFlashOCXCodeData = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);   
 
HFPC hFPC = FPC_LoadOCXFromMemory(lpFlashOCXCodeData, dwFlashOCXCodeSize);   
 
if (NULL == hFPC)   
{   
    // Error   
}           
 
UnmapViewOfFile(lpFlashOCXCodeData);   
CloseHandle(hFileMapping);   
CloseHandle(hFile);   


Thank you.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

aghatak
Posts: 4
Joined: Thu Oct 29, 2009 7:58 am

Postby aghatak » Tue Dec 08, 2009 1:21 pm

sorry - stupid of me - was reading the wrong part of the documentation :(

thanks!


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 6 guests