AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Crazy Scripting : Create ResourceOnly DLL (ICON+BITMAP+RCD)
Goto page Previous  1, 2
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sun May 25, 2008 4:55 pm    Post subject: Reply with quote

ladiko wrote:
could i use your work


yes, please. Smile

@daonlyfreez: Lexikos has already shown me on how to use the Res protocol here:


My problem is different.. I have to use AddFontMemResourceEx to load a font from resource, which loads as a private font and not visible to any application including AHK. All I have is the hIcon of the font and the only way it seems - is to use WM_SETFONT on AHK control.

Rolling Eyes
Back to top
View user's profile Send private message Send e-mail
n-l-i-d
Guest





PostPosted: Sun May 25, 2008 5:42 pm    Post subject: Reply with quote

SKAN wrote:
You have already shown how to refer images from HTML .. but how to use an embedded font .. i.e., use it from HTML ?

I did not try, but my best guess is that WM_SETFONT would not work on an IE control.


You can only use the existing (installed) fonts on the computer with the html/css settings of the file you are showing.

However, if you use the css @font-face tag pointing to an eot (font) file, and show the html in Internet Explorer (or the control), you can use font-files that need not be installed on the client's computer. The url value accepts http and file, so maybe it works with res too, if you add the eot file as a resource?

Quote:
<STYLE TYPE="text/css">
<--!
@font-face {
font-family: SomeFontName;
font-style: normal;
font-weight: normal;
src:url(http://www.somesite.com/somefont.eot);
}
-->
</STYLE>


Hope this makes it more clear what I meant to point out... Razz
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sun May 25, 2008 7:17 pm    Post subject: Reply with quote

n-l-i-d wrote:
Hope this makes it more clear what I meant to point out... Razz


I do not understand much .. but nice to hear that it would work..
Thanks friend. Smile
Back to top
View user's profile Send private message Send e-mail
n-l-i-d
Guest





PostPosted: Sun May 25, 2008 7:25 pm    Post subject: Reply with quote

Allrighty, then here it is: Spice up your AutoHotkey GUI with custom fonts in an IE-control.

Use stylish, weird, or specific language fonts like you see fit!

1. Download WEFT (freeware) and install
2. Find yourself some nice (free to use and distribute) font(s), download and install
3. Create a page in Microsoft Office Word in which you use the fonts you intend to use in your project (not everything you want to publish, just some words with the fonts used, the file will be destroyed anyway)
4. Save this page as html (Save As... -> Web page)
5. Run WEFT and follow the instructions, N.B.:
* You should Cancel the "Intended Web Server" dialog
* WEFT has restriction options, make sure you set them correctly.
6. The resulting EOT (Embedded OpenType) font file(s) can now be incorporated into your IE-control!

7. Create an AHK Gui with an IE-COM control.

8. Create html with the following css code in the head of the document

Quote:
<STYLE TYPE="text/css">
<--!
@font-face {
font-family: SomeFontName;
font-style: normal;
font-weight: normal;
src:url(file://fullandforwardslashedpathtoyourscriptfolder/somefont.eot);
}
-->
</STYLE>


(The IE control probably needs the full path)

9. Now you can use SomeFontName like any font in the css definitions of the rest of your html and show the final html with your custom font in the IE control

10. You can deinstall the fonts again

From here: Hosting Web Pages in Hindi using embedded fonts with WEFT (with screenshots)

Online examples

User ofcourse needs Internet Explorer to be installed (does not work on other browsers).

I myself cannot test this right now, but it should work, and it is a very nice GUI addition.
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sun May 25, 2008 7:31 pm    Post subject: Reply with quote

Shocked

Very Nice .. Many thanks Very Happy
Back to top
View user's profile Send private message Send e-mail
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sun Sep 05, 2010 3:43 am    Post subject: DllCreateEmpty() Reply with quote

    DllCreateEmpty()
  • Shorter and Faster than CreateDLL() used in ROD-Ex owing to the 'Apply Patch' technique used.
  • Supports Unicode filename ( use fullpath prefixed with "\\?\" )
  • Places a Creation TimeDateStamp inside DLL
  • Created DLL is more Compact - only 1024 bytes


Code:
DllCreateEmpty( F="empty.dll" ) { ; www.autohotkey.com/forum/viewtopic.php?p=381161#381161
;Creates Empty Resource-Only DLL (1024 bytes)  / CD:05-Sep-2010 | LM:01-Jun-2011 - by SKAN
 IfNotEqual,A_Tab, % TS:=A_NowUTC, EnvSub,TS,1970,S 
 Src := "0X5A4DY3CXC0YC0X4550YC4X1014CYD4X210E00E0YD8XA07010BYE0X200YECX1000YF0X1000YF4X1"
 . "0000YF8X1000YFCX200Y100X4Y108X4Y110X2000Y114X200Y11CX4000003Y120X40000Y124X1000Y128X1"
 . "00000Y12CX1000Y134X10Y148X1000Y14CX10Y1B8X7273722EY1BCX63Y1C0X10Y1C4X1000Y1C8X200Y1CC"
 . "X200Y1DCX40000040"
, VarSetCapacity( Trg,1024,0 ), Numput( TS,Trg,200 ), DA:=0x40000000
 Loop, Parse, Src, XY                                                           
   Mod( A_Index,2 ) ? O := "0x" A_LoopField : NumPut( "0x" A_LoopField, Trg, O )
 If ( hF := DllCall( "CreateFile", Str,F, UInt,DA, UInt,2,Int,0,UInt,2,Int,0,Int,0 ) ) > 0
   B := DllCall( "_lwrite", UInt,hF,Str,Trg,UInt,1024 ),  DllCall( "CloseHandle",UInt,hF )
 Loop %F%
Return B ? A_LoopFileLongPath :
}


Quote:
Note to self:
Exercise #3
Unlike Exercise #2 where AStr is used to force ANSI filename, this function uses CreateFile() to support unicode filename.
Handles obtained with CreateFile() & OpenFile() are not compatible with _lclose().. and so CloseHandle() is being used here.
But _lwrite(), _llseek() and _lread() works properly with any file handle and are shorter/easier to use.



Last edited by SKAN on Wed Jun 01, 2011 1:38 pm; edited 3 times in total
Back to top
View user's profile Send private message Send e-mail
Gauss



Joined: 10 Sep 2009
Posts: 203

PostPosted: Tue Nov 16, 2010 11:11 am    Post subject: Reply with quote

Skan,

I came across a lot of your scripts not working on the new version of Ahk_L

I'm I wrong?
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Tue Nov 16, 2010 11:23 am    Post subject: Reply with quote

Gauss wrote:
lot of your scripts not working on the new version of Ahk_L


Could be.. I will re-write them as and when the demand rises. Smile
Back to top
View user's profile Send private message Send e-mail
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Fri Mar 18, 2011 3:11 pm    Post subject: CreateDLLv2() Reply with quote

CreateDLLv2() has been written to replace CreateDLL() in ROD-Ex to avoid AntiVirus false alarms.
For example, you may refer VirusTotal scan results for res.dll bundled with Popcorn Movie Db [v3.1.0].
I will update ROD-Ex with CreateDLLv2() when I make it AHK_L compatible.

Thanks to paulmeister for reporting it.

Code:
CreateDLLv2( F="empty.dll" ) { ;    www.autohotkey.com/forum/viewtopic.php?p=429997#429997
;Creates Empty Resource-Only DLL (1024 bytes)  / CD:05-Sep-2010 | LM:18-Mar-2011 - by SKAN
 IfNotEqual,A_Tab, % TS:=A_NowUTC, EnvSub,TS,1970,S   
 Src := "0X5A4DY3CXB8YB8X4550YBCX2014CYCCX210E00E0YD0XC05010BYD8X6600YE4X1000YE8X1000YECX"
 . "5F990000YF0X1000YF4X200YF8X5YFCX5Y100X4Y108X9000Y10CX200Y114X2Y118X40000Y11CX1000Y120"
 . "X100000Y124X1000Y12CX10Y140X1000Y144X1E4Y158X8000Y15CX8Y1B0X7273722EY1B4X63Y1B8X6340Y"
 . "1BCX1000Y1C0X6400Y1C4X200Y1D4X40000040Y1D8X6C65722EY1DCX636FY1E0XCY1E4X8000Y1E8X200Y1"
 . "ECX6600Y1FCX42000040Y208X4Y20CX10000Y210X10Y214X80000018Y220X4Y224X10000Y228X1Y22CX80"
 . "000030Y238X4Y23CX10000Y240X409Y244X48Y248X1058Y24CX18CY250X4E4Y258X34018CY25CX560000Y"
 . "260X5F0053Y264X450056Y268X530052Y26CX4F0049Y270X5F004EY274X4E0049Y278X4F0046Y27CX3400"
 . "00Y280XFEEF04BDY284X10000Y288X20000Y290X10000Y298X3FY2A0X4Y2A4X2Y2B4XECY2B8X530000Y2B"
 . "CX720074Y2C0X6E0069Y2C4X460067Y2C8X6C0069Y2CCX490065Y2D0X66006EY2D4X6FY2D8XC8Y2DCX300"
 . "000Y2E0X300034Y2E4X300039Y2E8X420034Y2ECX30Y2F0X24004CY2F4X460001Y2F8X6C0069Y2FCX4400"
 . "65Y300X730065Y304X720063Y308X700069Y30CX690074Y310X6E006FY318X650052Y31CX6F0073Y320X7"
 . "20075Y324X650063Y328X4F002DY32CX6C006EY330X200079Y334X4C0044Y338X4CY33CXE0030Y340X460"
 . "001Y344X6C0069Y348X560065Y34CX720065Y350X690073Y354X6E006FY35CX4F0052Y360X200044Y364X"
 . "320076Y36CX100034Y370X500001Y374X6F0072Y378X750064Y37CX740063Y380X650056Y384X730072Y3"
 . "88X6F0069Y38CX6EY390X2E0031Y394X2E0030Y398X2E0030Y39CX30Y3A0X44Y3A4X560000Y3A8X720061"
 . "Y3ACX690046Y3B0X65006CY3B4X6E0049Y3B8X6F0066Y3C0X40024Y3C4X540000Y3C8X610072Y3CCX7300"
 . "6EY3D0X61006CY3D4X690074Y3D8X6E006FY3E0X4B00409"

 VarSetCapacity(Trg,1024,0),  Numput(TS,Trg,192),  AC := 0x40000000
 Loop, Parse, Src, XY
   Mod( A_Index,2 ) ? O := "0x" A_LoopField : NumPut( "0x" A_LoopField, Trg, O )
 If ( hF := DllCall( "CreateFile", Str,F, UInt,AC,UInt,2,Int,0,UInt,2,Int,0,Int,0 ) ) > 0
   B := DllCall( "_lwrite", UInt,hF,Str,Trg,UInt,1024 ),  DllCall( "CloseHandle",UInt,hF )
Return B ? F :
}
Back to top
View user's profile Send private message Send e-mail
Delusion @ Guest
Guest





PostPosted: Fri Mar 18, 2011 9:53 pm    Post subject: Reply with quote

great!
i will update Popcorn Movie DB when i have some time to work on the script again Very Happy
Back to top
hoppfrosch



Joined: 25 Jan 2006
Posts: 190
Location: Froschtümpel

PostPosted: Wed Aug 10, 2011 12:40 pm    Post subject: Reply with quote

Any news on AHK_L compatibility?
Back to top
View user's profile Send private message Visit poster's website
zeus19



Joined: 14 Apr 2011
Posts: 26

PostPosted: Fri Dec 23, 2011 7:56 am    Post subject: Reply with quote

Hi SKAN,
I tried you script (with version 2 dll create), and it created the resource.dll file, but I can't load the image. Could you check it for me?
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sat Dec 24, 2011 6:25 am    Post subject: Reply with quote

zeus19 wrote:
Could you check it for me?


What exactly does not work?
Can you please give me a sample DLL that is not working?
Back to top
View user's profile Send private message Send e-mail
zeus19



Joined: 14 Apr 2011
Posts: 26

PostPosted: Sun Dec 25, 2011 1:42 pm    Post subject: Reply with quote

SKAN wrote:
zeus19 wrote:
Could you check it for me?


What exactly does not work?
Can you please give me a sample DLL that is not working?


here the dll file, please help! I try to pack the icon files in the dll, and hope that i can convert them all to the exe file without any extended files.
DLL file:http://www.mediafire.com/?p2acj8481i8g6k2

here the folder include your scripts, and my ico file.
http://www.mediafire.com/?mo5e959c9cdry3e
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 5336
Location: San Diego, California

PostPosted: Sat Jan 21, 2012 1:21 pm    Post subject: Reply with quote

Hi SKAN,
I came to this thread from your post in this thread
Have a hard time understanding load images from dll
http://www.autohotkey.com/forum/viewtopic.php?p=199794#199794

specfically:
Creating a JPEG only DLL and retrieving the images

In that post you have a demo to download ROD-Demo1.zip

The ImageView.ahk file has the number of images hard-coded

Code:
Loop 14  ; number of images in resource.dll,  under RT_RCDATA
  RCD_Ordinals .= ( A_Index=1 ? "" : "|" ) ( 9000+A_Index-1 )


Would it be possible to move the quantity to the resource file?
If so, can you advise how?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group