|
a GUID is essentially a 16 BYTE number. so, if you can generate 4 random int's, you're all set.
the "uniqueness" of your number depends on what you use for seed values. even with :
seed(0);
int i1= rand();
int i2= rand();
int i3= rand();
int i4= rand();
you didn't say you needed crypto-strength random values (which these really aren't) or just statistically random values. statistally speaking, there's a lot of room in 2^128, so you should be OK.
a GUID is partly based on machine-specific data (usually your network card's address). so if you can get at that data, you can use it, too.
-c
|
|
|
|
|
Sorry, I know this is not the right page but I´m looking for someone who`s really good in creating
grafix for user-interfaces.
If you think you`re the one who will create the grafix ( background, switches etc. ) for our apps
(almost music-based)than write a short mail maybe with an example of your work to:
mario@klangwerker.de
Greatings Mario ///
... Coding is one thing - be creative another one ...
----------------------
www.klangwerker.de
mario@klangwerker.de
rocknix@lycos.de
----------------------
|
|
|
|
|
Usually programmers are not good artists.
Try looking here: http://www.fli7e.de/
He does Winamp skins -- that's a UI. Quite good, too.
If he won't, you *might* find someone on this ring who would be
interested, and you can look at their work first.
Regards,
Daniel
|
|
|
|
|
I have an edit control in my dialog box and i want create a function that set or change the position of my Edit control.
Thank you in advance
|
|
|
|
|
Do you mean the position of the actual control or the position of the caret (the blinking text cursor)?
If you want to move the whole control, use the MoveWindow function (from CWnd).
If you want to move the caret, use SetSel(), using the position you want the caret to be in as the first two parameters.
Regards,
Peter Pearson
|
|
|
|
|
Hi Guys,
How to connect Pop3 server or Imap server.
If there is any API there to connect.(in C++/VC++).
How to retrive mails from my server with using c++ api.
|
|
|
|
|
Either write you own implementation of the protocol (Search for the RFCs on the web).
If you want to interface to Microsoft's mail API's, you need to examine the MAPI
interface. Good luck. I found the documentation to be, er, less than helpful
when dealing with MAPI. Not as good as the rest of the documentation.
I think the platform SDK and MSDN have some sample MAPI code.
Stephen Kellett
|
|
|
|
|
I have a lot of experience here - and you will save a fortune by investing a few hundred dollars into a library such as the Dundas TCP/IP stuff. However, POP3 is a pretty simple protocol, and once you have the RFC, it is quite easy to work it out. There is sample code on this site for sending messages (SMTP) abnd POP3 isn't much different. Simply connect to a server on TCP port 110 and send a few commands. Avoid MAPI like the plague - in many cases, it assumes an MS only environment and is a waste of time. I have been coding mail apps since 1992 and MAPI sucks. Stick to decent Internet standards (POP3/SMTP) and you can't go wrong.
Regards.
|
|
|
|
|
A starting programmer needs help
I turn here for help. Please help me,
I am using CString because I am coding for Windows CE. I run my code through Visual Studio to use the console to make sure its working. the aim is to try and cut up a string into many pieces. but I can't even output a simple string.(this saddens me)
Example Code:
CString hd ("test");
LPCTSTR h = hd;
CString *lk;
lk = hd;
printf("%s", hd);
printf("%s", (LPCTSTR)hd);
printf("%s", h);
cout << h;
cout << lk;
cout << *lk;
My Problem:
For the printf function the only thing I get is always the first character 't';
for the cout, I always get the memory location in all cases, so what I am asking is, CAN SOMEONE TELL ME HOW I CAN PRINT OUT THE FULL STRING....PLEASE!!!!
thank you
lonod
To Code or not to code, that is the question
|
|
|
|
|
A starting programmer needs help
I turn here for help. Please help me,
I am using CString because I am coding for Windows CE. I run my code through Visual Studio to use the console to make sure its working. the aim is to try and cut up a string into many pieces.
Example Code:
CString hd ("test");
LPCTSTR h = hd;
CString *lk;
lk = hd;
printf("%s", hd);
printf("%s", (LPCTSTR)hd);
printf("%s", h);
cout << h;
cout << lk;
cout << *lk;
My Problem:
For the printf function the only thing I get is always the first the first character 't';
for the cout, I always get the memory location in all cases, so what I am asking is, CAN SOMEONE TELL ME HOW I CAN PRINT OUT THE FULL STRING....PLEASE!!!!
thank you
lonod
To Code or not to code, that is the question
|
|
|
|
|
printf("%s", hd);
This doesn't work because sending a CString to printf() is meaningless. You must cast it to (LPCTSTR).
--Mike--
http://home.inreach.com/mdunn/
This must be Thursday. I never could get the hang of Thursdays...
|
|
|
|
|
Thanks for quick reply mike,
if you notice I did cast it to LPCTSTR in the next printf function, but all i still got was the first character of the string.
To Code or not to code, that is the question
|
|
|
|
|
Ah, it's probably because you're using printf() when you should be using wprintf(). CE is a Unicode OS, so when you pass a Unicode string to printf(), it views the string as an ANSI string. The first byte is 't' and the second byte is 0.
Also, use wcout instead of cout, and add (LPCTSTR) casts to your CStrings to make sure they're being passed as C strings instead of C++ objects.
--Mike--
http://home.inreach.com/mdunn/
This must be Thursday. I never could get the hang of Thursdays...
|
|
|
|
|
I'm developing a program required to use Synchronization function WaitForSingleObject(). It may take several seconds or longer to run this function, therefore, I want to add a Progress Bar control to let the user knows how long do they need to wait. However, I cannot find the source code of this WaitForSingleObject() function, so I cannot put the progress bar SetPos() in that function. I've tried to set the progress bar move by timer...but when the program run WaitForSingleObject(), the progress bar stopped and start move again after WaitForSingleObject().
Can I do it in this way???::
If originally the timeout value is 16000....(WaitForSingleObject(xxxx, 16000)), then I split it into ... let say....5 ......e.g.:
WaitForSingleObject(xxxx, 3200);
Call ProgressBarControl;
WaitForSingleObject(xxxx, 3200);
Call ProgressBarControl;
WaitForSingleObject(xxxx, 3200);
Call ProgressBarControl;
WaitForSingleObject(xxxx, 3200);
Call ProgressBarControl;
WaitForSingleObject(xxxx, 3200);
Call ProgressBarControl;
So that the progress bar can update every 3200 time interval?.....
Or do anyone have another suggestion on using WaitForSingleObject with Progress Bar?? I must use this WaitForSingleObject function......
Sorry...I just a beginner in MFC programming;P
|
|
|
|
|
Instead of WaitForSingleObject could you not use MsgWaitForMultipleObject just before the thread is about to do it's stuff create a Timer that fires every second. when MsgWaitForMultipleObjects returns determine what's happened has the thread finished or do you have a windows msg i.e. WM_TIMER.
if this is appropriate you could have a class variable that indicates what step the thread is up to - wrapped by a CriticalSection so you can update your UI accordingly.
|
|
|
|
|
How can I create a Microsoft Visual C++ style build log window?
Thanks
|
|
|
|
|
Check out the BCGControlBar library at BCGSoft (it used to be housed here at CP, but it's been taken down.)
--Mike--
http://home.inreach.com/mdunn/
This must be Thursday. I never could get the hang of Thursdays...
|
|
|
|
|
I visited the site, and the library seems very good, but what I need is not an EXACT copy of the visual c++ build window. I only need to know how to create a window with an edit control in it, that moves, docks and behaves similar to the one in visual c++.
|
|
|
|
|
I'm kind of new to MFC. I used to using Borland.
How can I convert a CString to a char array[40].
To be used as a filename I will open using old style ansi C fopen.
Additionally I noticed that in Microsoft VC++ you can not write a int long or double using fstream or iostream. This is pretty Lame. In Borlands compiler you write a double
somefile lessthan operator somedouble lessthan operator endl
Is there an easier way than using the old ansi style C fprintf to get your double written to a file.
Switching over to MFC is a pain when your used to using datatypes as other than characters.
JLS
Student/Part time programmer
Major Programming.
|
|
|
|
|
How about:
char *s = strdup(LPCTSTR(MyCString));
(don't forget to free s later...)
As far as I remember it should work...
- Anders
|
|
|
|
|
char array[40];
CString str = "whatever";
lstrcpy ( array, str );
But, if you're just passing the filename to a function - that is, the argument is a const char* - you can just pass the plain CString, since CString has a conversion operator to LPCTSTR.
--Mike--
http://home.inreach.com/mdunn/
This must be Thursday. I never could get the hang of Thursdays...
|
|
|
|
|
I don't understand your problem. fstreams with ints, doubles, and longs work fine.
It sounds like you're using the wrong operators. Please, don't make condescending comments when you don't even understand what you're doing.
#include <fstream>
int main(void)
{
std::ofstream s("myfile.txt");
int i = 1;
double d = 2.0;
long l = 3;
s << i << " " << d << " " << l << std::endl;
return 0;
}
|
|
|
|
|
I'm kind of new to MFC. I used to using Borland.
How can I convert a CString to a char array[40].
To be used as a filename I will open using old style ansi C fopen.
Additionally I noticed that in Microsoft VC++ you can not write a int long or double using fstream or iostream. This is pretty Lame. In Borlands compiler you write a double
somefile<
|
|
|
|
|
I'm kind of new to MFC. I used to using Borland.
How can I convert a CString to a char array[40].
To be used as a filename I will open using old style ansi C fopen.
Additionally I noticed that in Microsoft VC++ you can not write a int long or double using fstream or iostream. This is pretty Lame. In Borlands compiler you write a double
somefile<
|
|
|
|
|
I'm kind of new to MFC. I used to using Borland.
How can I convert a CString to a char array[40].
To be used as a filename I will open using old style ansi C fopen.
Additionally I noticed that in Microsoft VC++ you can not write a int long or double using fstream or iostream. This is pretty Lame. In Borlands compiler you write a double
somefile<
|
|
|
|