|
#if (defined(__unix__) || defined(unix)) && !defined(USG)
#include <sys/param.h>
#endif
#include <stdio.h>
#include <assert.h>
#if defined(_WIN32) || defined(__CYGWIN__)
#include <objbase.h>
#elif defined MACOSX
#include <string.h>
#include <uuid/uuid.h>
#elif defined __FreeBSD__
# if __FreeBSD_version >= 500000
# include <uuid.h>
# else
# error FreeBSD versions prior to 500000 does not support uuid(3)
# endif
#else
#include <uuid/uuid.h>
#endif
///Above are my includes, below is the calls abstracted
#if defined(_WIN32) || defined(__CYGWIN__)
GUID randomGuid;
// create random GUID
randomGuid = GUID_NULL;
::CoCreateGuid(&randomGuid);
if (randomGuid == GUID_NULL)
{
fprintf(stderr,"Couldn't create a random GUID\n");
return;
}
memcpy(m_bufuid, &randomGuid, 16);
#elif defined __FreeBSD__
uuid_t uid; // uuid_t is a struct
uuid_create(&uid, NULL);
memcpy(m_bufuid, &uid, 16);
#else
uuid_t uid; // uuid_t is defined as unsigned char[16]
uuid_generate(uid);
memcpy(m_bufuid, uid, 16);
#endif
std::string tmp;
char cuid[100]; // Uid::GetUid temporary
sprintf(cuid,"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
m_bufuid[0],m_bufuid[1],m_bufuid[2],m_bufuid[3],
m_bufuid[4],m_bufuid[5],m_bufuid[6],m_bufuid[7],
m_bufuid[8],m_bufuid[9],m_bufuid[10],m_bufuid[11],
m_bufuid[12],m_bufuid[13],m_bufuid[14],m_bufuid[15]);
tmp = cuid;
Done.
-- modified at 8:48 Wednesday 31st October, 2007
|
|
|
|
|
Hey! I did not ask!
Anyway, your code is missing the m_bufuid declaration.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
I pressed reply! Sorry it got pasted under you! That buffer is simply a char[16] buffer.
|
|
|
|
|
Hi,
How can i load & play an AviStream using the OpenInterface macro ? My code compiles just fine but it does not show anything.
void CWrapperDlg::OnPlayAVI()
{
// Create the window like you would any Windows control.
m_mciWnd.Create(WS_CHILD | WS_VISIBLE | MCIWNDF_NOPLAYBAR | MCIWNDF_NOERRORDLG | MCIWNDF_NOTIFYERROR, CRect(0, 0, 300,300), this, 1234);
// Open the AVI file.
HRESULT hr;
PAVISTREAM pstream;
AVIFileInit();
hr = AVIStreamOpenFromFile(&pstream, "test.avi", streamtypeVIDEO, 0, OF_READ, NULL);
if (FAILED(hr))
AfxMessageBox("error");
m_mciWnd.OpenInterface((PAVISTREAM) &pstream);
//m_mciWnd.Open(strAVIPath);
// Play the opened AVI file.
m_mciWnd.Play();
// To keep the demo simple - can't play the AVI file more than one time.
((CButton *)GetDlgItem(IDB_PLAY))->EnableWindow(FALSE);
}
Regards,
sdancer75
|
|
|
|
|
Hi everybody,
does it exist a maximal number of dialog ressources into a MFC Project.
My dialogs are under form of CFormView, but still now i have already over 25 dialogs
Does the project become buggy if a certain number of dialog ressouces is reached?
Big thanks for answers
|
|
|
|
|
I don't think so. My project is having around 50 + dialogs.
Regards,
Paresh.
|
|
|
|
|
mmh, i'm at the beginning of the application and i have already more than 20.
I even don't know how much it will be in future, but seriously over 100
|
|
|
|
|
I think u can have as many numbers u want.
Coz my application have 46..
Reagards
Shiva
|
|
|
|
|
Since they only get loaded when asked for and are discarded when no longer used, the number is, for all intents and purposes, limitless.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
The number of dialogs in your project resource file does not affect anything except maybe compilation time. Your application may use slightly additional memory with the definitions of those dialogs in the PE image. But nothing to be worried about.
Maximum number of window objects you can have open within Windows XP is 32767. There is a hard limit per process of 10,000 window handles. Yes, there is a point where too many open windows will degrade application performance. The threshold at which this will occur depends on processor speed and physical RAM.
I am increasingly becoming a fossil so my comments apply to my knowledge of the XP kernel, I have not delved into the Vista abyss yet. I am still waiting for the flames to die down.
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
hi to all
how to change the color of message box generated by AfxMessageBox("some line") function
thank u in advance
malik
|
|
|
|
|
You can't. If you want that type of customization, you'll need to roll your own.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
How can i do that when my dialog active text-cursor already active in the editbox?
Can anyone get the answer my question? My question seems to be quite open, i think.
-- modified at 6:47 Wednesday 31st October, 2007
What is this¿ "This is a FIRTBOY"
|
|
|
|
|
As far as i get from ur description
you want to set the focus on the editbox whenever ur dialog is initialised.
in this case you have to code in the OnInitDialog() function
where u can use the control variable of the editbox lets suppose m_ctrlBox
u have to write
m_ctrlBox.SetFocus()
Regards,
Pankaj Sachdeva
There is no future lies in any job but future lies in the person who holds the job
|
|
|
|
|
|
Dont forget to return FALSE if you do this.
Wouldnt it be better to let the dialog manager do this for you by ensuring that the desired edit control is first in the tab order. To change the tab order when editting the dialog resource use menu option Layout->TabOrder(Ctrl+D) the taborder will be shown by numberred blue sqaures in the top-left of each control.
|
|
|
|
|
For edit controls, you may want to try this instead of SetFocus()...
GotoDlgCtrl(&m_EditCtl);
Why you may want to use this instead? Here's what the docs say...
"This message performs additional dialog box management operations
beyond those performed by the SetFocus function WM_NEXTDLGCTL
updates the default pushbutton border, sets the default control identifier,
and automatically selects the text of an edit control (if the target window
is an edit control)."
Whatever gives you the result you want
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thank you Mark...
Actually, I need sometime to work on Visual C++/MFC or other languages... and need a computer also. "to be busy with a good job to kill time!".. It is upsetting.
Yours sincerely.
What is this¿
|
|
|
|
|
Hi,
I've written a simple ISAPI filter which would require the user to authenticate before accessing a particular resource. The user will be sent a 401 Unauthorized error and will have to authenticate himself. The username and password have been hardcoded and will be checked against what the user enters in the authentication dialog box. The problem here is , I'm not able to retrieve the username and password that has been entered by the user. I don't know if they are encoded or encrypted. ie I get a " ‹ÿU‹ìì([ " for the values of both pszUser and pszPassword.
How do i retrieve the values ?
Code:
#include <stdio.h>
#include <httpext.h>
#include <httpfilt.h>
#include <string.h>
#define USERNAME "user"
#define PASSWORD "pass"
#define DOMAIN "domainname"
BOOL WINAPI
GetFilterVersion( HTTP_FILTER_VERSION *pVer )
{
pVer->dwFilterVersion = HTTP_FILTER_REVISION;
strncpy(pVer->lpszFilterDesc, "Basic Authentication Filter", SF_MAX_FILTER_DESC_LEN);
pVer->dwFlags = SF_NOTIFY_PREPROC_HEADERS;
return TRUE;
}
DWORD WINAPI
HttpFilterProc( PHTTP_FILTER_CONTEXT pfc,
DWORD notificationType,
VOID *pvNotification )
{
HTTP_FILTER_AUTHENT *auth = (HTTP_FILTER_AUTHENT *) pvNotification;
char domain[256];
char user[256];
if( auth->pszUser[0] == '\0') {
char domain[256];
OutputDebugString("No user/password given");
sprintf(domain, "WWW-Authenticate: Basic realm=\"%s\"\r\n", DOMAIN);
pfc->ServerSupportFunction( pfc, SF_REQ_SEND_RESPONSE_HEADER,
(PVOID) "401 Unauthorized",
(DWORD) domain,
(DWORD) NULL );
return SF_STATUS_REQ_FINISHED;
}
OutputDebugString(USERNAME);
OutputDebugString(auth->pszUser);
OutputDebugString(auth->pszPassword);
if( strcmp( auth->pszUser, USERNAME ) && strcmp( auth->pszPassword, PASSWORD ) ) {
char domain[256];
OutputDebugString("Username or password wrong");
sprintf(domain, "WWW-Authenticate: Basic realm=\"%s\"\r\n", DOMAIN);
pfc->ServerSupportFunction( pfc, SF_REQ_SEND_RESPONSE_HEADER,
(PVOID) "401 Unauthorized",
(DWORD) domain,
(DWORD) NULL );
return SF_STATUS_REQ_FINISHED;
}
if( !strcmp( auth->pszUser, USERNAME ) && !strcmp( auth->pszPassword, PASSWORD ) ) {
OutputDebugString("All conditions satisfied");
sprintf(domain, "WWW-Authenticate: Basic realm=\"%s\"\r\n", DOMAIN);
pfc->ServerSupportFunction( pfc, SF_REQ_SEND_RESPONSE_HEADER,
(PVOID) "200 OK",
(DWORD) domain,
(DWORD) NULL );
return SF_STATUS_REQ_HANDLED_NOTIFICATION;
}
return SF_STATUS_REQ_HANDLED_NOTIFICATION;
}
imazing
|
|
|
|
|
Hi All,
I am using a combo box in dialog
I want to use tool tip for data in combo.
When user drag the combo tool tiphas to show for item focused in combo
Can any one help me.
|
|
|
|
|
Please refer here[^].
Regards,
Paresh.
|
|
|
|
|
Hi Paresh,
Thx a lot for your reply,
I already refered to that article, there a new class is written for ComboBoxx,but I do not want to write any extra classes.
|
|
|
|
|
sheshidar wrote: ...I do not want to write any extra classes.
Then don't. Use the one already written (by someone else).
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I didn't mean that i do not write my own.
I do not want to include any new file in my project
|
|
|
|
|