赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
 
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 yangff 于 2010-12-18 19:12 编辑
我们知道,要熟悉并能够使用MFC6这种世界上最2,最烂,现在好像只在中国最流行的一种语言,压力有点大。
作为一个学会了C++,Pascal,Basic,PHP,Ruby……还是不会用MGC6的愚者很想写一个DLL,怎么办呢??!
有一个叫做PowerBasic的XXXXXXX可以解决这个问题……
妈的我不写了¥……¥#%%#¥要吐血- #COMPILER PBWIN 9
- #COMPILE DLL
- FUNCTION AddOne (BYVAL x AS LONG) EXPORT AS LONG
- FUNCTION = x + 1
- END FUNCTION
复制代码 就这么简单……
完整时这样的- '===============================================================================
- '
- ' Generic DLL Template for PowerBASIC for Windows
- ' Copyright (c) 1997-2005 PowerBASIC, Inc.
- ' All Rights Reserved.
- '
- ' LIBMAIN function Purpose:
- '
- ' User-defined function called by Windows each time a DLL is loaded into,
- ' and unloaded from, memory. In 32-bit Windows, LibMain is called each
- ' time a DLL is loaded by an application or process. Your code should
- ' never call LibMain explicitly.
- '
- ' hInstance is the DLL instance handle. This handle is used by the
- ' calling application to identify the DLL being called. To access
- ' resources in the DLL, this handle will need to be stored in a global
- ' variable. Use the GetModuleHandle(BYVAL 0&) to get the instance
- ' handle of the calling EXE.
- '
- ' fdwReason specifies a flag indicating why the DLL entry-point
- ' (LibMain) is being called by Windows.
- '
- ' lpvReserved specifies further aspects of the DLL initialization
- ' and cleanup. If fdwReason is %DLL_PROCESS_ATTACH, lpvReserved is
- ' NULL (zero) for dynamic loads and non-NULL for static loads. If
- ' fdwReason is %DLL_PROCESS_DETACH, lpvReserved is NULL if LibMain
- ' has been called by using the FreeLibrary API call and non-NULL if
- ' LibMain has been called during process termination.
- '
- ' Return
- '
- ' If LibMain is called with %DLL_PROCESS_ATTACH, your LibMain function
- ' should return a zero (0) if any part of your initialization process
- ' fails or a one (1) if no errors were encountered. If a zero is
- ' returned, Windows will abort and unload the DLL from memory. When
- ' LibMain is called with any other value than %DLL_PROCESS_ATTACH, the
- ' return value is ignored.
- '
- '===============================================================================
- #COMPILER PBWIN 9
- #COMPILE DLL
- %USEMACROS = 1
- #INCLUDE "Win32API.inc"
- GLOBAL ghInstance AS DWORD
- '-------------------------------------------------------------------------------
- ' Main DLL entry point called by Windows...
- '
- FUNCTION LIBMAIN (BYVAL hInstance AS LONG, _
- BYVAL fwdReason AS LONG, _
- BYVAL lpvReserved AS LONG) AS LONG
- SELECT CASE fwdReason
- CASE %DLL_PROCESS_ATTACH
- 'Indicates that the DLL is being loaded by another process (a DLL
- 'or EXE is loading the DLL). DLLs can use this opportunity to
- 'initialize any instance or global data, such as arrays.
- ghInstance = hInstance
- FUNCTION = 1 'success!
- 'FUNCTION = 0 'failure! This will prevent the EXE from running.
- CASE %DLL_PROCESS_DETACH
- 'Indicates that the DLL is being unloaded or detached from the
- 'calling application. DLLs can take this opportunity to clean
- 'up all resources for all threads attached and known to the DLL.
- FUNCTION = 1 'success!
- 'FUNCTION = 0 'failure!
- CASE %DLL_THREAD_ATTACH
- 'Indicates that the DLL is being loaded by a new thread in the
- 'calling application. DLLs can use this opportunity to
- 'initialize any thread local storage (TLS).
- FUNCTION = 1 'success!
- 'FUNCTION = 0 'failure!
- CASE %DLL_THREAD_DETACH
- 'Indicates that the thread is exiting cleanly. If the DLL has
- 'allocated any thread local storage, it should be released.
- FUNCTION = 1 'success!
- 'FUNCTION = 0 'failure!
- END SELECT
- END FUNCTION
- '-------------------------------------------------------------------------------
- ' Examples of exported Subs and functions...
- '
- FUNCTION MyFunction1 ALIAS "MyFunction1" (BYVAL Param1 AS LONG) EXPORT AS LONG
- ' code goes here
- MSGBOX "MYDLL.DLL has recevied: " + STR$(Param1)
- FUNCTION = 1 ' return 1 to calling program
- END FUNCTION
- SUB MySub1 ALIAS "MySub1" (BYVAL Param1 AS LONG) EXPORT
- ' code goes here
- END SUB
复制代码 简单多了啊~ |
评分
-
查看全部评分
|