|
[求助]奇怪的加载动态库的方法,请大家帮忙分析下
不太明白你的意思,不过,程序可以不添加诸如此类的语句#pragma comment( lib, "dll3"),只需将*.iib文件添加到VC的工程中来代替#pragma comment(lib, "dll3")的语句。其于这样做也可以说将*.lib加入了链接,只是不用#pragme...声明而已。 |
|
|
|
[讨论]VC有InputBox函数吗?
/* 注意,InputBox函数是C++语法,只能用于C++,不能用于C */ /********************************************/ /* InputBox.h */ /********************************************/ BOOL _InitInputBox(HWND hParent); // 可选,不过在调用InputBox函数之前最好调用一下该函数, // 该函数是初始化InputBox,主要就是传入一个父窗口句柄。 void _SetNumber(BOOL fIsNumber); // 可选,该函数是设置Edit只能输入数字 void _SetLowerCase(BOOL fIsLowerCase); // 可选,该函数是设置Edit只能输入小写字母 void _SetUpperCase(BOOL fIsUpperCase); // 可选,该函数是设置Edit只能输入大写字母 void _SetMaxLine(unsigned int nLineSize); // 可选,该函数是设置Edit可以输入最大字符数,默认最大是256个字符,不能超过这个数。 /*********************************************************/ /* InputBox函数 */ /* lpWndMsg ; 必选参数,用于提示用户 */ /* lpWndTitle ; 可选参数, 设置对话框默认标题 */ /* lpDefValue ; 可选参数,设置Edit默认值 */ /* xPos ; 可选参数,如果为零则居中窗口 */ /* yPos ; 可选参数,如果为零则居中窗口 */ /* lpHelpFile ; 可选参数,打开*.hlp帮助文件 */ /* nHelpIndex ; 可选参数,但如果设置了lpHelpFile参数, */ /* ; 这个参数就是Help文件的索引 */ /* 如果函数成功,返回一个char *指针,包含用户输入的内容 */ /*********************************************************/ char *_InputBox(char *lpWndMsg, char *lpWndTitle = "工程!", char *lpDefValue = "", int xPos = 0, int yPos = 0, char *lpHelpFile = "", int nHelpIndex = 0); #define InputBox _InputBox #define SetNumber _SetNumber #define InitInputBox _InitInputBox #define SetLowerCase _SetLowerCase #define SetUpperCase _SetUpperCase #define SetMaxLine _SetMaxLine /******************************************************/ /* InputBox.cpp */ /******************************************************/ #include <windows.h> int WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); BOOL _InitVar(); HWND _CreateWindow(HINSTANCE hInst); int _Run(HWND hWnd); HINSTANCE _hInstance; char *_lpWndMsg; char *_lpWndTitle; char *_lpDefValue; int _xPos; int _yPos; char *_lpHelpFile; int _nHelpIndex; HWND _hParent; HWND _hDesktop; HWND _hEdit, _hBtnOk, _hBtnCancel, _hBtnHelp; HWND _hMsgText; RECT _st_rcDesktop; RECT _st_rcWnd; HFONT _hWndFont; char _szBuffer[256]; char *_lpWndFontName = "宋体"; UINT _nMaxLine = 255; UINT _nEditStyle = WS_BORDER | WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_AUTOVSCROLL; BOOL _InitInputBox(HWND hParent) { if (!hParent) return FALSE; _hParent = hParent; if (!_hInstance) return _InitVar(); return TRUE; } BOOL _InitVar() { _hInstance = ::GetModuleHandle(NULL); _hDesktop = ::GetDesktopWindow(); ::GetWindowRect(_hDesktop,&_st_rcDesktop); if (!_xPos) _xPos = (_st_rcDesktop.right - 365) / 2; if (!_yPos) _yPos = (_st_rcDesktop.bottom - 130) / 2; return TRUE; } int WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { HDC hWndDc; WORD uBtnID; switch(uMsg) { case WM_DESTROY: if (_hWndFont) ::DeleteObject(_hWndFont); ::PostQuitMessage(0); break; case WM_CREATE: _hMsgText = ::CreateWindowEx(0, "Static", _lpWndMsg, WS_CHILD | WS_VISIBLE, 5, 5, 275, 70, hWnd, (HMENU)1000, _hInstance, 0); _hBtnOk = ::CreateWindowEx(0, "Button", "确定(&K)", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 285, 5, 65, 20, hWnd, (HMENU)IDOK, _hInstance, 0); _hBtnCancel = ::CreateWindowEx(0, "Button", "取消(&C)", WS_CHILD | WS_VISIBLE, 285, 30, 65, 20, hWnd, (HMENU)IDCANCEL, _hInstance, 0); _hBtnHelp = ::CreateWindowEx(0, "Button", "帮助(&H)", WS_CHILD | WS_VISIBLE, 285, 55, 65, 20, hWnd, (HMENU)IDHELP, _hInstance, 0); _hEdit = ::CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", _lpDefValue, _nEditStyle, 5, 80, 350, 20, hWnd, (HMENU)2000, _hInstance, 0); ::SendMessage(_hEdit,EM_SETLIMITTEXT,_nMaxLine,0); _hWndFont = ::CreateFont(12, 6, 0, 0, 12, 0, 0, 0, GB2312_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, _lpWndFontName); if (!::lstrlen(_lpHelpFile)) ShowWindow(_hBtnHelp,SW_HIDE); hWndDc = ::GetDC(hWnd); ::SelectObject(hWndDc,_hWndFont); ::ReleaseDC(hWnd,hWndDc); ::SendDlgItemMessage(hWnd,1000,WM_SETFONT,(WPARAM)_hWndFont,0); ::SendDlgItemMessage(hWnd,2000,WM_SETFONT,(WPARAM)_hWndFont,0); ::SendDlgItemMessage(hWnd,IDOK,WM_SETFONT,(WPARAM)_hWndFont,0); ::SendDlgItemMessage(hWnd,IDCANCEL,WM_SETFONT,(WPARAM)_hWndFont,0); ::SendDlgItemMessage(hWnd,IDHELP,WM_SETFONT,(WPARAM)_hWndFont,0); break; case WM_KEYDOWN: if (wParam == VK_RETURN) ::SendMessage(hWnd,WM_COMMAND,IDOK,0); break; case WM_SETFOCUS: ::SetFocus(_hEdit); break; case WM_COMMAND: uBtnID = LOWORD(wParam); switch(uBtnID) { case IDOK: ::GetDlgItemText(hWnd,2000,_szBuffer,256); ::DestroyWindow(hWnd); break; case IDCANCEL: ::DestroyWindow(hWnd); break; case IDHELP: ::WinHelp(hWnd,_lpHelpFile,HELP_INDEX,_nHelpIndex); break; }; break; default: return ::DefWindowProc(hWnd, uMsg, wParam, lParam); } return (TRUE); } HWND _CreateWindow(HINSTANCE hInst) { WNDCLASSEX st_WndClass; HWND hWnd; ::RtlZeroMemory(&st_WndClass,sizeof(st_WndClass)); st_WndClass.cbSize = sizeof(st_WndClass); st_WndClass.hInstance = hInst; st_WndClass.hbrBackground = (HBRUSH)COLOR_BTNSHADOW; st_WndClass.hCursor = LoadCursor(0, IDC_ARROW); st_WndClass.hIcon = LoadIcon(0, IDI_APPLICATION); st_WndClass.hIconSm = st_WndClass.hIcon; st_WndClass.lpfnWndProc = (WNDPROC)&WndProc; st_WndClass.lpszClassName = "InputBox_Class"; st_WndClass.style = CS_HREDRAW | CS_VREDRAW; ::RegisterClassEx(&st_WndClass); hWnd = ::CreateWindowEx(0, "InputBox_Class", _lpWndTitle, WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE, _xPos, _yPos, 365, 130, _hParent, 0, hInst, 0); return hWnd; } int _Run(HWND hWnd) { MSG st_Msg; if (!hWnd) return 0; ::ShowWindow(hWnd,SW_SHOW); ::UpdateWindow(hWnd); while(::GetMessage(&st_Msg,0,0,0)) { if (st_Msg.message == WM_KEYDOWN) { if (st_Msg.wParam == VK_RETURN) ::SendMessage(hWnd,st_Msg.message,st_Msg.wParam,st_Msg.wParam); } ::TranslateMessage (&st_Msg) ; ::DispatchMessage (&st_Msg) ; } return st_Msg.wParam; } char *_InputBox(char *lpWndMsg, char *lpWndTitle, char *lpDefValue, int xPos, int yPos, char *lpHelpFile, int nHelpIndex) { _lpWndMsg = lpWndMsg; _lpWndTitle = lpWndTitle; _lpDefValue = lpDefValue; _xPos = xPos; _yPos = yPos; _lpHelpFile = lpHelpFile; _nHelpIndex = nHelpIndex; if (!_hInstance) _InitVar(); _Run(_CreateWindow(_hInstance)); return _szBuffer; } void _SetNumber(BOOL fIsNumber) { if (fIsNumber) _nEditStyle |= ES_NUMBER; } void _SetLowerCase(BOOL fIsLowerCase) { if (fIsLowerCase) _nEditStyle |= ES_LOWERCASE; } void _SetUpperCase(BOOL fIsUpperCase) { if (fIsUpperCase) _nEditStyle |= ES_UPPERCASE; } void _SetMaxLine(unsigned int nLineSize) { if (nLineSize) if (nLineSize < _nMaxLine) _nMaxLine = nLineSize; } |
|
[讨论]CALL 函数名问题
这个是Delphi程序吧,Delphi程序一般都是先用Dede反编译,生成*.map文件,用OD导入就可以实现上面的效果了。 |
|
学WIN32编程不解之处
窗口回调函数是由系统调用的,并不是由程序自己调用的,其中的hWnd,uMsg,wParam,lParam参数也是由系统在调用该回调函数时传给程序使用的。所以用户可以判断由系统提供的各种消息来处理各种事情。 mov @stWndClass.lpfnWndProc,offset _ProcWinMain //这一句是告诉系统用户自定义的回调函数,系统的DispatchMessage就是向用户分派各种消息的函数,经过上面的mov @stWndClass.lpfnWndProc,offset _ProcWinMain定义,DispatchMessage函数就可以准确的调用到用户自定义的回调函数并分派消息给用户回调函数。 |
|
|
|
[讨论]VC有InputBox函数吗?
自己写一个InputBox库函数保存起来也可以啊,以后只需添加头文件,直接调用自己写的InputBox就行了。 |
|
[讨论]VC有InputBox函数吗?
是只有这样做。VB的InputBox也是创建一个对话框再放编辑框和两个按钮的。 |
|
[求助]关于读取内存问题
你发的代码没有错,应该是其他问题引起的,你可以用调试器调试一下,比如检查一下918CD4内存中的数据有没有被什么修改了等。 |
|
[求助]win32汇编里貌似没有CAPDRIVERCAPS这个结构,但是C有
Windows.inc不是由微软写的,没有也不奇怪,自己添加一个就行了。 |
|
[求助]radasm的菜单编辑器问题!
使用插入命令,RadAsm直接插入添加的菜单就是属于父级菜单,只有在生成子菜单时要使用"→"功能而已。 |
|
[求助]资源和程序连接 运行后没反映
"SysDateTimePick32"是comctl32.dll中的组件,所以要加上comctl32.lib库,而且要comctl32.dll加载这个控件,还必须使用InitCommonControlsEx函数用ICC_DATE_CLASSES参数初始化SysDataTimerPick32控件(而如果只是使用InitCommonControls函数comctl32.dll是不会初始化创建这个控件的,这样做主要是节省系统资源,做到有放矢的加载)。更具体的内容可以参看MSDN |
|
[求助]资源和程序连接 运行后没反映
; 第一,加上comctl32.lib库。 include comctl32.inc includelib comctl32.lib ; 第二,在.data?那里加上下面一个变量 st_InitComCtlEx INITCOMMONCONTROLSEX <> ; 第三,在程序start开始处加入如下代码即可 mov st_InitComCtlEx, sizeof INITCOMMONCONTROLSEX mov st_InitComCtlEx, ICC_DATE_CLASSES invoke InitCommonControlsEx,offset st_InitComCtlEx |
|
|
|
[求助]如何读取当前文件夹下的ini文件?
'测试了下,看来如wynney兄所说,GetCurrentDirectory的确有问题 '将GetCurrentDirectory改成GetModuleFileName吧。 Private Declare Function GetPrivateProfileString Lib "Kernel32" _ Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, _ ByVal lpKeyName As Any, ByVal lpDefault As String, _ ByVal lpReturnedString As String, ByVal nSize As Long, _ ByVal lpFileName As String) As Long Private Declare Function WritePrivateProfileString Lib "Kernel32" _ Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, _ ByVal lpKeyName As Any, ByVal lpString As Any, _ ByVal lpFileName As String) As Long Private Declare Function GetModuleFileName Lib "Kernel32" _ Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpPathBuff As String, _ ByVal nBuffSize As Long) As Long Private Sub Command1_Click() Dim szPathBuff As String Dim szPathIniName As String Dim Length As Long Dim b As Boolean Dim i As Integer, j As Integer szPathBuff = String(256, 0) szPathIniName = "sgyscfg.ini" Length = GetModuleFileName(App.hInstance, szPathBuff, 256) j = Length For i = 1 To Length If Mid(szPathBuff, j, 1) = "\" Then Exit For End If j = j - 1 Next i szPathIniName = Mid(szPathBuff, 1, j) & szPathIniName b = WritePrivateProfileString("帐号资料", "UserName", Text1.Text, szPathIniName) b = WritePrivateProfileString("帐号资料", "PassWord", Text2.Text, szPathIniName) End Sub Private Sub Command2_Click() Dim szPathBuff As String Dim szPathIniName As String Dim szBuff As String Dim Length As Long Dim l As Long Dim i As Integer, j As Integer szPathBuff = String(256, 0) szBuff = String(256, 0) szPathIniName = "sgyscfg.ini" Length = GetModuleFileName(App.hInstance, szPathBuff, 256) j = Length For i = 1 To Length If Mid(szPathBuff, j, 1) = "\" Then Exit For End If j = j - 1 Next i szPathIniName = Mid(szPathBuff, 1, j) & szPathIniName l = GetPrivateProfileString("帐号资料", "UserName", "", szBuff, 256, szPathIniName) Text1.Text = szBuff szBuff = String(256, 0) l = GetPrivateProfileString("帐号资料", "PassWord", "", szBuff, 256, szPathIniName) Text2.Text = szBuff End Sub |
|
[求助]如何读取当前文件夹下的ini文件?
Private Declare Function GetPrivateProfileString Lib "Kernel32" _ Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, _ ByVal lpKeyName As Any, ByVal lpDefault As String, _ ByVal lpReturnedString As String, ByVal nSize As Long, _ ByVal lpFileName As String) As Long Private Declare Function WritePrivateProfileString Lib "Kernel32" _ Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, _ ByVal lpKeyName As Any, ByVal lpString As Any, _ ByVal lpFileName As String) As Long Private Declare Function GetCurrentDirectory Lib "Kernel32" _ Alias "GetCurrentDirectoryA" (ByVal nBuffSize As Long, _ ByVal lpPathBuff As String) As Long Private Sub Command1_Click() Dim szPathBuff As String Dim szPathIniName As String Dim Length As Long Dim b As Boolean szPathBuff = String(256, 0) szPathIniName = "sgyscfg.ini" Length = GetCurrentDirectory(256, szPathBuff) If Mid(szPathBuff, Length, 1) <> "\" Then szPathIniName = "\" & szPathIniName End If szPathIniName = Mid(szPathBuff, 1, Length) & szPathIniName b = WritePrivateProfileString("帐号资料", "UserName", Text1.Text, szPathIniName) b = WritePrivateProfileString("帐号资料", "PassWord", Text2.Text, szPathIniName) End Sub Private Sub Command2_Click() Dim szPathBuff As String Dim szPathIniName As String Dim szBuff As String Dim Length As Long Dim l As Long szPathBuff = String(256, 0) szBuff = String(256, 0) szPathIniName = "sgyscfg.ini" Length = GetCurrentDirectory(256, szPathBuff) If Mid(szPathBuff, Length, 1) <> "\" Then szPathIniName = "\" & szPathIniName End If szPathIniName = Mid(szPathBuff, 1, Length) & szPathIniName l = GetPrivateProfileString("帐号资料", "UserName", "", szBuff, 256, szPathIniName) Text1.Text = szBuff szBuff = String(256, 0) l = GetPrivateProfileString("帐号资料", "PassWord", "", szBuff, 256, szPathIniName) Text2.Text = szBuff End Sub |
|
[求助]如何读取当前文件夹下的ini文件?
用GetCurrentDirectory函数获取程序的当前目录,再将目录和文件名连接起来就行了。 |
|
[求助]用vb6写注册机代码错误请高手帮帮忙呀,我要哭了,急死
缺少名称为sle_serialcode的TEXT控件,你在VB上放一个TEXT控件,改名为sle_serialcode即可。 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值