查看: 2404|回复: 7

[原创发布] RM用DLL快速制作

[复制链接]

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
回帖
6005

烫烫烫开拓者

发表于 2010-12-18 19:06:54 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 yangff 于 2010-12-18 19:12 编辑

我们知道,要熟悉并能够使用MFC6这种世界上最2,最烂,现在好像只在中国最流行的一种语言,压力有点大。
作为一个学会了C++,Pascal,Basic,PHP,Ruby……还是不会用MGC6的愚者很想写一个DLL,怎么办呢??!
有一个叫做PowerBasic的XXXXXXX可以解决这个问题……
妈的我不写了¥……¥#%%#¥要吐血
  1. #COMPILER PBWIN 9
  2. #COMPILE DLL

  3. FUNCTION AddOne (BYVAL x AS LONG) EXPORT AS LONG

  4.     FUNCTION = x + 1

  5. END FUNCTION
复制代码
就这么简单……
完整时这样的
  1. '===============================================================================
  2. '
  3. '  Generic DLL Template for PowerBASIC for Windows
  4. '  Copyright (c) 1997-2005 PowerBASIC, Inc.
  5. '  All Rights Reserved.
  6. '
  7. '  LIBMAIN function Purpose:
  8. '
  9. '    User-defined function called by Windows each time a DLL is loaded into,
  10. '    and unloaded from, memory. In 32-bit Windows, LibMain is called each
  11. '    time a DLL is loaded by an application or process.  Your code should
  12. '    never call LibMain explicitly.
  13. '
  14. '    hInstance is the DLL instance handle.  This handle is used by the
  15. '    calling application to identify the DLL being called.  To access
  16. '    resources in the DLL, this handle will need to be stored in a global
  17. '    variable.  Use the GetModuleHandle(BYVAL 0&) to get the instance
  18. '    handle of the calling EXE.
  19. '
  20. '    fdwReason specifies a flag indicating why the DLL entry-point
  21. '    (LibMain) is being called by Windows.
  22. '
  23. '    lpvReserved specifies further aspects of the DLL initialization
  24. '    and cleanup.  If fdwReason is %DLL_PROCESS_ATTACH, lpvReserved is
  25. '    NULL (zero) for dynamic loads and non-NULL for static loads.  If
  26. '    fdwReason is %DLL_PROCESS_DETACH, lpvReserved is NULL if LibMain
  27. '    has been called by using the FreeLibrary API call and non-NULL if
  28. '    LibMain has been called during process termination.
  29. '
  30. ' Return
  31. '
  32. '    If LibMain is called with %DLL_PROCESS_ATTACH, your LibMain function
  33. '    should return a zero (0) if any part of your initialization process
  34. '    fails or a one (1) if no errors were encountered.  If a zero is
  35. '    returned, Windows will abort and unload the DLL from memory. When
  36. '    LibMain is called with any other value than %DLL_PROCESS_ATTACH, the
  37. '    return value is ignored.
  38. '
  39. '===============================================================================

  40. #COMPILER PBWIN 9
  41. #COMPILE DLL

  42. %USEMACROS = 1
  43. #INCLUDE "Win32API.inc"

  44. GLOBAL ghInstance AS DWORD


  45. '-------------------------------------------------------------------------------
  46. ' Main DLL entry point called by Windows...
  47. '
  48. FUNCTION LIBMAIN (BYVAL hInstance   AS LONG, _
  49.                   BYVAL fwdReason   AS LONG, _
  50.                   BYVAL lpvReserved AS LONG) AS LONG

  51.     SELECT CASE fwdReason

  52.     CASE %DLL_PROCESS_ATTACH
  53.         'Indicates that the DLL is being loaded by another process (a DLL
  54.         'or EXE is loading the DLL).  DLLs can use this opportunity to
  55.         'initialize any instance or global data, such as arrays.

  56.         ghInstance = hInstance

  57.         FUNCTION = 1   'success!

  58.         'FUNCTION = 0   'failure!  This will prevent the EXE from running.

  59.     CASE %DLL_PROCESS_DETACH
  60.         'Indicates that the DLL is being unloaded or detached from the
  61.         'calling application.  DLLs can take this opportunity to clean
  62.         'up all resources for all threads attached and known to the DLL.

  63.         FUNCTION = 1   'success!

  64.         'FUNCTION = 0   'failure!

  65.     CASE %DLL_THREAD_ATTACH
  66.         'Indicates that the DLL is being loaded by a new thread in the
  67.         'calling application.  DLLs can use this opportunity to
  68.         'initialize any thread local storage (TLS).

  69.         FUNCTION = 1   'success!

  70.         'FUNCTION = 0   'failure!

  71.     CASE %DLL_THREAD_DETACH
  72.         'Indicates that the thread is exiting cleanly.  If the DLL has
  73.         'allocated any thread local storage, it should be released.

  74.         FUNCTION = 1   'success!

  75.         'FUNCTION = 0   'failure!

  76.     END SELECT

  77. END FUNCTION


  78. '-------------------------------------------------------------------------------
  79. ' Examples of exported Subs and functions...
  80. '
  81. FUNCTION MyFunction1 ALIAS "MyFunction1" (BYVAL Param1 AS LONG) EXPORT AS LONG

  82.     ' code goes here
  83.     MSGBOX "MYDLL.DLL has recevied: " + STR$(Param1)
  84.     FUNCTION = 1  ' return 1 to calling program

  85. END FUNCTION


  86. SUB MySub1 ALIAS "MySub1" (BYVAL Param1 AS LONG) EXPORT

  87.     ' code goes here

  88. END SUB
复制代码
简单多了啊~

评分

参与人数 2星屑 +100 收起 理由
禾西 + 10 說明美——我說的是頭像
偶尔杀人越货 + 90 我勒个去,不当BZ才能给这么点分.

查看全部评分

梦石
0
星屑
45
在线时间
79 小时
注册时间
2010-8-18
回帖
171
发表于 2010-12-18 19:20:37 | 显示全部楼层
坚决的沙发,一年多不见YANG腐腐果然有进化成神的潜力呢
最近开始忙,暂时不会更新什么了
回复

使用道具 举报

青山绿水长留生

梦石
0
星屑
50
在线时间
369 小时
注册时间
2010-12-17
回帖
431
发表于 2010-12-18 19:23:03 | 显示全部楼层
头像闪亮

点评

我本来就不想设置头像的……  发表于 2010-12-18 19:58
回复

使用道具 举报

敌敌畏

梦石
0
星屑
80
在线时间
52 小时
注册时间
2008-5-12
回帖
1667
发表于 2010-12-18 19:29:09 | 显示全部楼层
如果前后都没有那不成没图案的一元硬币了?
PS.我只知道WN没有XJJ
回复

使用道具 举报

梦石
0
星屑
190
在线时间
1 小时
注册时间
2010-8-19
回帖
2
发表于 2010-12-18 19:51:29 | 显示全部楼层
你好啊   
回复

使用道具 举报

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
回帖
6005

烫烫烫开拓者

 楼主| 发表于 2010-12-19 10:59:09 | 显示全部楼层
好吧我承认我是来展示我的头像的……
哎呀,蛋疼什么的最有爱了
回复

使用道具 举报

宛若

梦石
0
星屑
1888
在线时间
529 小时
注册时间
2007-8-19
回帖
1466

极短24参与开拓者

发表于 2010-12-19 11:19:28 | 显示全部楼层
MFC三聚氰胺贴面板
  三聚氰胺环保板,一种以刨花板为基材,表面经“三聚氰胺”(MELAMINE)专业加工处理,具耐磨,抗刻划,耐高温,易清洁,耐酸碱等优点的复合型饰板,英文简称为MFC(三聚氰胺贴面板)。MFC广泛被采用为板式家具,办公家具及厨房家具的主要用材。
我才不是来吐槽的呢- -
[url=http://rpg.blue/thread-219730-1-1.html]http://unhero.sinaapp.com/wi.php[/url]
[color=Red]如你所见这是个死坑,没错这就是打我的脸用的[/color]
回复

使用道具 举报

天仙

梦石
0
星屑
720
在线时间
184 小时
注册时间
2008-4-15
回帖
4872

贵宾

发表于 2010-12-19 12:37:36 | 显示全部楼层
我是來打醬....打招呼的
VA脚本开工中...
偷窃脚本1.0 - 已完成
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部