ImageVerifierCode 换一换
格式:DOC , 页数:18 ,大小:88.50KB ,
资源ID:7133217      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-7133217.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(GUID生成器代码.doc)为本站会员(scg750829)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

GUID生成器代码.doc

1、/D:/daima/guidgen/aboutdlg.hclass CAboutDlg : public CDialogImplpublic:enum IDD = IDD_ABOUTBOX ;BEGIN_MSG_MAP(CAboutDlg)MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)COMMAND_ID_HANDLER(IDOK, OnCloseCmd)COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)END_MSG_MAP()LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wP

2、aram*/, LPARAM /*lParam*/, BOOLreturn TRUE;LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOLreturn 0;/D:/daima/guidgen/GuidGen.cpp/ GuidGen.cpp : /#include “stdatl.h“#include #include #include #include #include “resource.h“#include “aboutdlg.h“#include “maindlg.h“CAppModule _

3、Module;int Run(LPTSTR /*lpCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)CMessageLoop theLoop;_Module.AddMessageLoop(CMainDlg dlgMain;if(dlgMain.Create(NULL) = NULL)ATLTRACE(_T(“Main dialog creation failed!n“);return 0;dlgMain.ShowWindow(nCmdShow);int nRet = theLoop.Run();_Module.RemoveMessageLoop(

4、);return nRet;int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int nCmdShow)#if (_WIN32_IE = 0x0300)INITCOMMONCONTROLSEX iccx;iccx.dwSize = sizeof(iccx);iccx.dwICC = ICC_BAR_CLASSES; / change to support other controls:InitCommonControlsEx(#else:InitCommonContr

5、ols();#endif_Module.Init(NULL, hInstance);int nRet = Run(lpCmdLine, nCmdShow);_Module.Term();return nRet;/D:/daima/guidgen/GuidGen.rc/Microsoft Developer Studio generated resource script./#include “resource.h“#define APSTUDIO_READONLY_SYMBOLS/ Generated from the TEXTINCLUDE 2 resource./#include “atl

6、res.h“/#undef APSTUDIO_READONLY_SYMBOLS/ English (U.S.) resources#if !defined(AFX_RESOURCE_DLL) | defined(AFX_TARG_ENU)#ifdef _WIN32LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US#pragma code_page(1252)#endif /_WIN32#ifdef APSTUDIO_INVOKED/ TEXTINCLUDE/1 TEXTINCLUDE DISCARDABLE BEGIN“resource.h0“END2 TEXT

7、INCLUDE DISCARDABLE BEGIN“#include “atlres.h“rn“0“END3 TEXTINCLUDE DISCARDABLE BEGIN“CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST “resGuidGen.exe.manifest“rn“0“END#endif / APSTUDIO_INVOKED/ Dialog/IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 187, 102STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMEN

8、UCAPTION “About“FONT 8, “MS Sans Serif“BEGINDEFPUSHBUTTON “OK“,IDOK,130,81,50,14CTEXT “ATL GUIDGEN Application v1.0nn(c) Copyright 1998“,IDC_STATIC,25,57,78,32ICON IDR_MAINFRAME,IDC_STATIC,55,26,20,20GROUPBOX “,IDC_STATIC,7,7,115,88ENDIDD_GUIDGEN_DIALOG DIALOG DISCARDABLE 0, 0, 246, 193STYLE WS_MINI

9、MIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENUCAPTION “Create GUID“FONT 8, “MS Sans Serif“BEGINLTEXT “Choose the desired format below, then select “Copy“ to copy the results to the clipboard (the results can then be pasted into your source code). Choose “Exit“ when done.“,IDC_STATIC,6,6,178,37GROUPBOX

10、 “ GUID Format “,IDC_STATIC,4,43,178,73CONTROL “rn“IDS_STRING105 “/ %08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02XrnDEFINE_GUID(, rn0x%lx, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x);rn“IDS_STRING106 “/ %08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02Xrnstatic const GUID = rn 0x%l

11、x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x ;rn“IDS_STRING107 “%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02Xrn“ENDSTRINGTABLE DISCARDABLE BEGINIDP_ERR_CREATE_GUID “Unable to create new GUID.“IDP_ERR_OPEN_CLIP “Clipboard is busy. Unable to copy result to clipboard.“IDS_ABOUTBOX

12、“rn“IDS_STRING105 “/ %08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02XrnDEFINE_GUID(, rn0x%lx, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x);rn“IDS_STRING106 “/ %08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02Xrnstatic const GUID = rn 0x%lx, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x

13、%x, 0x%x, 0x%x ;rn“IDS_STRING107 “%08lX-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02Xrn“ENDSTRINGTABLE DISCARDABLE BEGINIDP_ERR_CREATE_GUID “Unable to create new GUID.“IDP_ERR_OPEN_CLIP “Clipboard is busy. Unable to copy result to clipboard.“IDS_ABOUTBOX “int m_nGuidType;GUID m_guid;CMainDlg() : m_nGu

14、idType(0)virtual BOOL PreTranslateMessage(MSG* pMsg)return :IsDialogMessage(m_hWnd, pMsg);void UpdateData()m_nGuidType = 0;m_nGuidType = IsDlgButtonChecked(IDC_RADIO2) ? 1 : m_nGuidType;m_nGuidType = IsDlgButtonChecked(IDC_RADIO3) ? 2 : m_nGuidType;m_nGuidType = IsDlgButtonChecked(IDC_RADIO4) ? 3 :

15、m_nGuidType;_ASSERTE(m_nGuidType = 0 SysMenu.AppendMenu(MF_STRING, IDM_ABOUTBOX, szAboutMenu);SysMenu.Detach();/ register object for message filteringCMessageLoop* pLoop = _Module.GetMessageLoop();pLoop-AddMessageFilter(this);CRegKey reg;long lRet = reg.Open(HKEY_CURRENT_USER, _T(“SoftwareMicrosoftA

16、TLSamplesGUIDGEN“), KEY_READ);if(lRet = ERROR_SUCCESS)DWORD dwVal;#if (_ATL_VER = 0x0700)lRet = reg.QueryDWORDValue(_T(“GUID Type“), dwVal);#elselRet = reg.QueryValue(dwVal, _T(“GUID Type“);#endifif(lRet = ERROR_SUCCESS)m_nGuidType = (int)dwVal;CheckRadioButton(IDC_RADIO1, IDC_RADIO4, IDC_RADIO1 + m

17、_nGuidType);if(!NewGUID()CloseDialog(IDABORT);DisplayGUID();return TRUE;void GetFormattedGuid(TCHAR* rString)/ load appropriate formatting stringTCHAR szBuf256;:LoadString(_Module.GetResourceInstance(), IDS_FORMATS+m_nGuidType, szBuf, 255);wsprintf(rString, szBuf, / first copy.m_guid.Data1, m_guid.D

18、ata2, m_guid.Data3, m_guid.Data40, m_guid.Data41, m_guid.Data42, m_guid.Data43,m_guid.Data44, m_guid.Data45, m_guid.Data46, m_guid.Data47,/ second copy.m_guid.Data1, m_guid.Data2, m_guid.Data3, m_guid.Data40, m_guid.Data41, m_guid.Data42, m_guid.Data43,m_guid.Data44, m_guid.Data45, m_guid.Data46, m_

19、guid.Data47);void DisplayGUID()TCHAR szBuf512;GetFormattedGuid(szBuf);SetDlgItemText(IDC_RESULTS, szBuf);BOOL NewGUID()m_guid = GUID_NULL;:CoCreateGuid(if(m_guid = GUID_NULL)TCHAR szBuf256;:LoadString(_Module.GetResourceInstance(), IDP_ERR_CREATE_GUID, szBuf, 255);MessageBox(szBuf, _T(“GUIDGen“), MB

20、_OK);return FALSE;return TRUE;LRESULT OnNewGUID(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOLDisplayGUID();return 0;LRESULT OnSelChange(WORD wNotifyCode, WORD /*wID*/, HWND /*hWndCtl*/, BOOLDisplayGUID();return 0;LRESULT OnOK(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOLif(

21、!OpenClipboard()TCHAR szBuf256;:LoadString(_Module.GetResourceInstance(), IDP_ERR_OPEN_CLIP, szBuf, 255);MessageBox(szBuf, _T(“GUIDGen“), MB_OK);return 0;TCHAR strResult512;GetFormattedGuid(strResult);int nTextLen = (lstrlen(strResult) + 1) * sizeof(TCHAR);HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE

22、, nTextLen);if(hGlobal != NULL)LPVOID lpText = GlobalLock(hGlobal);memcpy(lpText, strResult, nTextLen);EmptyClipboard();GlobalUnlock(hGlobal);#ifdef _UNICODESetClipboardData(CF_UNICODETEXT, hGlobal);#elseSetClipboardData(CF_TEXT, hGlobal);#endifCloseClipboard();return 0;LRESULT OnCancel(WORD /*wNoti

23、fyCode*/, WORD wID, HWND /*hWndCtl*/, BOOLlong lRet = reg.Open(HKEY_CURRENT_USER, _T(“SoftwareMicrosoftATLSamplesGUIDGen“), KEY_WRITE);if(lRet != ERROR_SUCCESS)lRet = reg.Open(HKEY_CURRENT_USER, _T(“SoftwareMicrosoft“), KEY_WRITE);if(lRet = ERROR_SUCCESS)CRegKey reg1;lRet = reg1.Create(reg.m_hKey, _

24、T(“ATL“), REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE);if(lRet = ERROR_SUCCESS)CRegKey reg2;lRet = reg2.Create(reg1.m_hKey, _T(“Samples“), REG_NONE, REG_OPTION_NON_VOLATILE, KEY_WRITE);if(lRet = ERROR_SUCCESS)CRegKey reg3;lRet = reg3.Create(reg2.m_hKey, _T(“GUIDGen“), REG_NONE, REG_OPTION_NON_VOLAT

25、ILE, KEY_WRITE);reg.Close();lRet = reg.Open(HKEY_CURRENT_USER, _T(“SoftwareMicrosoftATLSamplesGUIDGen“), KEY_WRITE);if(lRet = ERROR_SUCCESS)DWORD dwVal = m_nGuidType;#if (_ATL_VER = 0x0700)reg.SetDWORDValue(_T(“GUID Type“), dwVal);#elsereg.SetValue(dwVal, _T(“GUID Type“);#endifCloseDialog(wID);retur

26、n 0;void CloseDialog(int nVal)DestroyWindow();:PostQuitMessage(nVal);LRESULT OnSysCommand(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOLif(uCmdType dlg.DoModal();elsebHandled = FALSE;return 0;/_AFX_INSERT_LOCATION/ Microsoft Developer Studio will insert additional declarations immediately bef

27、ore the previous line.#endif / !defined(AFX_MAINDLG_H_6920296A_4C3F_11D1_AA9A_000000000000_INCLUDED_)/D:/daima/guidgen/resource.h/_NO_DEPENDENCIES/ Microsoft Developer Studio generated include file./ Used by GuidGen.rc/#define IDM_ABOUTBOX 0x0010#define IDD_ABOUTBOX 100#define IDD_GUIDGEN_DIALOG 102

28、#define IDP_ERR_INIT_OLE 102#define IDS_FORMATS 104#define IDS_STRING105 105#define IDS_STRING106 106#define IDS_STRING107 107#define IDR_MAINFRAME 128#define IDC_RADIO1 1000#define IDC_RADIO2 1001#define IDC_RADIO3 1002#define IDC_RADIO4 1003#define IDC_RESULTS 1004#define IDC_NEWGUID 1005#define I

29、DP_ERR_CREATE_GUID 2000#define IDP_ERR_OPEN_CLIP 2001#define IDS_ABOUTBOX 2002/ Next default values for new objects/ #ifdef APSTUDIO_INVOKED#ifndef APSTUDIO_READONLY_SYMBOLS#define _APS_NEXT_RESOURCE_VALUE 201#define _APS_NEXT_COMMAND_VALUE 32772#define _APS_NEXT_CONTROL_VALUE 1000#define _APS_NEXT_

30、SYMED_VALUE 102#endif#endif/D:/daima/guidgen/resourcece.h/_NO_DEPENDENCIES/ Microsoft Developer Studio generated include file./ Used by GuidGen.rc/#define IDM_ABOUTBOX 0x0010#define IDD_ABOUTBOX 100#define IDD_GUIDGEN_DIALOG 102#define IDP_ERR_INIT_OLE 102#define IDS_FORMATS 104#define IDS_STRING105

31、 105#define IDS_STRING106 106#define IDS_STRING107 107#define IDR_MAINFRAME 128#define IDC_RADIO1 1000#define IDC_RADIO2 1001#define IDC_RADIO3 1002#define IDC_RADIO4 1003#define IDC_RESULTS 1004#define IDC_NEWGUID 1005#define IDP_ERR_CREATE_GUID 2000#define IDP_ERR_OPEN_CLIP 2001#define IDS_ABOUTBO

32、X 2002/ Next default values for new objects/ #ifdef APSTUDIO_INVOKED#ifndef APSTUDIO_READONLY_SYMBOLS#define _APS_NEXT_RESOURCE_VALUE 201#define _APS_NEXT_COMMAND_VALUE 32772#define _APS_NEXT_CONTROL_VALUE 1000#define _APS_NEXT_SYMED_VALUE 102#endif#endif/D:/daima/guidgen/stdatl.cpp/ stdatl.cpp : so

33、urce file that includes just the standard includes/ GuidGen.pch will be the pre-compiled header/ stdatl.obj will contain the pre-compiled type information#include “stdatl.h“#if (_ATL_VER #endif /(_ATL_VER #include extern CAppModule _Module;#include /_AFX_INSERT_LOCATION/ Microsoft Developer Studio will insert additional declarations immediately before the previous line./

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报