guid

ComImport in C#, how do you find GUID for classes like IFileDialog in shell32.dll?

耗尽温柔 提交于 2020-01-01 15:09:15
问题 I've been trying to setup some interop with some win32 classes in various dlls using ComImport for a C# application I'm writing. What I don't understand is how you find the GUID for a class? I found some examples of imports that work but I'm not sure how the authors found the GUID for the classes. An example of importing IFileDialog and one of its methods is listed below. [ComImport(), Guid("42F85136-DB7E-439C-85F1-E4075D135FC8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] internal

GUIDs in a C++ Linux GCC app

吃可爱长大的小学妹 提交于 2020-01-01 09:45:38
问题 I've got a bunch of servers running this Linux app. I'd like for them to be able to generate a GUID with a low probability of collision. I'm sure I could just pull 128 bytes out of /dev/urandom and that would probably be fine, but is there a simple & easy way to generate a GUID that is more equivalent to the Win32 one? Specifically, one that takes into account space (well, MAC address), time, and randomness? I don't want to call off the box for it, I just want something like CreateGuid() 回答1:

一个比CBitmap更优秀的类 -- CImage类

烈酒焚心 提交于 2020-01-01 01:26:21
Visual C++的CBitmap类的功能是比较弱的,它只能显示出在资源中的图标、位图、光标以及图元文件的内容,而不像VB中的Image控件可以显示出绝大多数的外部图像文件(BMP、GIF、JPEG等)。如果想要在对话框或其他窗口中显示外部图像文件则只能借助于第三方提供的控件或代码,未免过于繁琐. 现在,.net引入了一个功能非常强大的新类 ----- CImage.有了CImage类,Visual C++在图像方面的缺憾将一去不复返。CImage是MFC和ATL共享的新类,它能从外部磁盘中调入一个JPEG、GIF、BMP和PNG格式的图像文件加以显示,而且这些文件格式可以相互转换。例如通过简单的几句,就可以实现CImage类和CBitmap类实例的: HBITMAP hBitmap=image.Detach(); CBitmap bmp; bmp.Attach(hBitmap); 这样一来,就又回归到以前操纵CBitmap的方式了.CImage本身封装了DIB(设备无关位图)的功能,因而能够处理每个位图像素。 它具有下列最酷特性:   1、AlphaBlend支持像素级的颜色混合,从而实现透明和半透明的效果。   2、PlgBlt能使一个矩形区域的位图映射到一个平行四边形区域中,而且还可能使用位屏蔽操作。   3、TransparentBlt在目标区域中产生透明图像

How to convert a GUID to a string in C#?

梦想与她 提交于 2020-01-01 00:57:47
问题 I'm new to C#. I know in vb.net, i can do this: Dim guid as string = System.Guid.NewGuid.ToString In C#, I'm trying to do String guid = System.Guid.NewGuid().ToString; but i get an " Cannot convert method group 'ToString' to non-delegate type 'string'. Did you intend to invoke the method ?" error. 回答1: You're missing the () after ToString that marks it as a function call vs. a function reference (the kind you pass to delegates), which incidentally is why c# has no AddressOf operator, it's

Getting the GUID of an installed COM object

风格不统一 提交于 2019-12-31 03:15:11
问题 I have a 32bit COM object that I want to use with 64bit PHP. I am trying to follow the tutorial here: http://www.gfi.com/blog/32bit-object-64bit-environment/ But I am stuck on "Locate your COM object GUID", as I have no idea where I can find out this information. Does anyone know how I can find the GUID of the COM object? 回答1: You will at least have to know the ProgID of the COM component. Something similar to "Word.Application", the string you pass to the COM() constructor. Run Regedit.exe

Formulas to generate a unique id?

做~自己de王妃 提交于 2019-12-31 02:22:26
问题 I would like to get a few ideas on generating unique id's without using the GUID. Preferably i would like the unique value to be of type int32. I'm looking for something that can be used for database primary key as well as being url friendly. Can these considered Unique? (int)DateTime.Now.Ticks (int)DateTime.Now * RandomNumber Any other ideas? Thanks EDIT: Well i am trying to practise Domain Driven Design and all my entities need to have a ID upon creation to be valid. I could in theory call

Obtaining a unique database identifier for SQL Server 2005 and later

回眸只為那壹抹淺笑 提交于 2019-12-31 01:59:09
问题 Is there a way to obtain a unique database identifier (such as a GUID) from a SQL 2005 database? I found this article: http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.database.databaseguid%28v=sql.90%29.aspx However, I need to be able to obtain the DatabaseGuid from T-SQL instead of VB. EDIT: I am trying to uniquely determine the database for which I am connected. Through code I manually sync records between SQL Compact and SQL Server. Right now my users are in a

Why is the 17th digit of version 4 GUIDs limited to only 4 possibilities?

巧了我就是萌 提交于 2019-12-30 18:56:07
问题 I understand that this doesn't take a significant chunk off of the entropy involved, and that even if a whole nother character of the GUID was reserved (for any purpose), we still would have more than enough for every insect to have one, so I'm not worried, just curious. As this great answer shows, the Version 4 algorithm for generating GUIDs has the following format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx x is random 4 is constant, this represents the version number. y is one of: 8, 9, A, or B

Should a Sequential Guid primary key column be a clustered index?

我是研究僧i 提交于 2019-12-30 10:52:49
问题 The goal of using a sequential guid is so you can use clustered indexes without the high levels of fragmentation that would normally exist in a clustered index if it was a regular guid, correct? 回答1: Yes, you are correct. 回答2: First to clarify, a primary key and clustered index are 2 separate and distinct things, i.e. one is not coupled to the other (PKs can be nonclustered, clustered indexes can be non-PKs). That given, I think you're asking more "Should a Sequential GUID be used as a

Should a Sequential Guid primary key column be a clustered index?

孤者浪人 提交于 2019-12-30 10:52:07
问题 The goal of using a sequential guid is so you can use clustered indexes without the high levels of fragmentation that would normally exist in a clustered index if it was a regular guid, correct? 回答1: Yes, you are correct. 回答2: First to clarify, a primary key and clustered index are 2 separate and distinct things, i.e. one is not coupled to the other (PKs can be nonclustered, clustered indexes can be non-PKs). That given, I think you're asking more "Should a Sequential GUID be used as a