Chris De Herrera's Windows CE Website

About
Discuss.Pocket PC FAQ Forum
Add Pocket PC FAQ to your Favorites
RSS    RSS Feeds
Wiki    Lost?
Subscribe    Print

Developer

Miscellaneous
Table of Contents
Mobile Format

[an error occurred while processing this directive]


 
Pocket PC Magazine Best Site

Website Awards
Website Updates

By Chris De Herrera 
Copyright 1998-2007
 All Rights Reserved
A member of the Talksites Family of Websites

Windows and Windows CE are trademarks of Microsoft
Corporation
and are used
under license from owner.
CEWindows.NET is not
associated with Microsoft 
Corporation.

All Trademarks are owned
by their respective companies.

COM
By Terence "Dr. CE" Goggin
Copyright 2000, 2001 Terence Goggin
 Version 1.00  Revised 4/20/01

[an error occurred while processing this directive]

Topics

1. How do I generate a GUID on a PocketPC?



1. How do I generate a GUID on a PocketPC?
I don't think there is a function to create a GUID either, so I wrote a
simple function that creates a GUID string.   This function conforms to
standard methods for generating a GUID (based on documentation I was able to
find).
The function puts the GUID in a VARIANT bstring....



BOOL CreateGuid(_variant_t *lValue)
{
TCHAR wGuid[37];
SYSTEMTIME systime;
FILETIME filetime;

// construct GUID
GetSystemTime(&systime);
SystemTimeToFileTime(&systime,&filetime);
DWORD tick=GetTickCount();
DWORD highWord=filetime.dwHighDateTime+0x146BF4;


// convert GUID to a string
wsprintf(wGuid,TEXT("%08.8x-%04.4x-%04.4x-%04.4x-%04.4x%04.4x%04.4x"),
      filetime.dwLowDateTime,
      LOWORD(highWord),
      HIWORD(highWord |0x10000000),
      LOWORD(rand()),
      HIWORD(tick),
      LOWORD(tick),
      LOWORD(rand()));

*lValue=wGuid;
return TRUE;
}

For more information: http://www.IdeaCon.com
Credits: Andrew Wingers ( www.IdeaCon.com )

[an error occurred while processing this directive]

Terence Goggin's DoctorCE.com site - Custom Windows CE development/consulting services.

Return to Chris De Herrera's Windows CE Website


Questions? Comments? Suggestions? Email Terence "Dr. CE" Goggin.