![]() |
General Programming »
DLLs & Assemblies »
General
Intermediate
DLLs are Simple! Part 4By Mahmoud KomeilyThis article describes how to create a Resource-Only DLL and how to using it for creating multimedia applications. |
HTML, VC6, VC7WinXP, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

As you know, creating multimedia applications with special effect like sound, animation, web-link and so on is time-consuming. But there is a method that is rapid and engaging.
Method is : Using Resource-Only DLL.
A resource-only DLL is a DLL that contains nothing but resources, such as icons, bitmaps, strings, and dialog boxes.
Note: In your HTML file, create two buttons with links "exit" and "execute" like below :
<p><a hidefocuse href="execute">
<img border="0" src="ExecNorm.gif" ALT="This may execute somethings"
style="cursor: hand; position: absolute; z-index: 1; left: 45; top: 120"
onmouseover="this.src='ExecHot.gif'" onmouseout="this.src='ExecNorm.gif'"
width="75" height="43" >
</a></p>
"IDR_HTML1 HTML DISCARDABLE "Skin.htm"
TO :
"Skin.htm HTML DISCARDABLE "Skin.htm"
Then add all needed files for imported HTML just below it:
/////////////////////
Skin.htm HTML DISCARDABLE "Skin.htm"
BG.gif HTML DISCARDABLE "BG.gif"
c.gif HTML DISCARDABLE "c.gif"
ExecHot.gif HTML DISCARDABLE "ExecHot.gif"
ExecNorm.gif HTML DISCARDABLE "ExecNorm.gif"
ExitHot.gif HTML DISCARDABLE "ExitHot.gif"
ExitNorm.gif HTML DISCARDABLE "ExitNorm.gif"
WMPAUD7.WAV HTML DISCARDABLE "WMPAUD7.WAV"
pupil.gif HTML DISCARDABLE "pupil.gif"
whites.gif HTML DISCARDABLE "whites.gif"
////////////////////
CHtmlView as Base Class; then press Finish button.
CHtmlView derived class; in my project "CShowcaseView".
OnInitialUpdate() member function, instead of default parameter of Navigate2 type give: res:// [Resource-Only Dll Name] // [Html file name]
e.g. : res://ResOnly.dll//Skin.htm
What is OnInitialUpdate()?
This member function is called by the framework after the view is first attached to the document, but before the view is initially displayed. Here you call Navigate2 function and force view for representing Skin.htm file. By "res:", you can refer to an HTML page embedded in the resources of a dynamic-link library (.dll) file. It is a protocol like "http:".
CShowcaseView) and select Add Virtual Function... command.
OnBeforeNavigate2 member function is called by the framework to cause an event to fire before a navigation occurs in the web browser. By this function, we can lead web browser to the URL we want.
OnBeforeNavigate2 have some parameters. First of all is target URL to navigate to, and end of all is a pointer to a cancel flag; an application can set this parameter to nonzero to cancel the navigation operation.
CString url=lpszURL; if (url.Right(4) == _T("exit")) { *pbCancel = TRUE; keybd_event( VK_MENU, 0, 0, 0 ); keybd_event( VK_F4, 0, 0, 0 ); keybd_event( VK_F4, 0, KEYEVENTF_KEYUP, 0 ); keybd_event( VK_MENU, 0, KEYEVENTF_KEYUP, 0 ); } else if(url.Right(7) == _T("execute")) { *pbCancel = TRUE; MessageBox("This button could execute some commands."); }
It is clear, it tests URL. If the last segment was "exit", it would have terminated program; but it was "execute"; it does something that you want.
Now it is ready. If you act correctly, that must be like my demo exe file.
Thankfully greet guru Paul DiLascia.
Don't remember to visit my website www.pishro-narmafzar.com
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 17 Mar 2005 Editor: Sumalatha K.R. |
Copyright 2005 by Mahmoud Komeily Everything else Copyright © CodeProject, 1999-2009 Web13 | Advertise on the Code Project |