|
try some of the articles on ftp that are under the Internet/networking section here at codeproject.
I'm an alien, I'm an alien
it's a beautiful life....
Bush
|
|
|
|
|
Hi!
I want a program that prevents a user to change the time on the computer. Lets say if the user tries to change the time the app will show a message that says the user has no permision to do that!
Is that possible?? Or.... help me!!
/*
BETA
*/
|
|
|
|
|
If you don't need to do it programmatically, I think under NT/2000 there's a privilege to change the time (that can be disabled). I don't know if the Policy Editor of Win9x lets you do that (? maybe "poledit.exe" on installation CD).
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Could you show where that function is to be disabled??
there were many alternatives!
(I cant log in if you wondering why I don't use "Rickard Andersson")
|
|
|
|
|
Is it with those .adm filoes you can choose this option??
Why not try to send the whole .adm file to me? that file that Win2000 uses!
hmm... what do you think about that?
|
|
|
|
|
<hack >- Set up a timer to fire at 100mSec. intervals and keep track of the current time in OnTimer().
- Override OnTimeChange() to set the time back to the last time read in OnTimer(). Use a flag to do this only if the time was not changed by your app.
</hack>
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I'm with you in the first section.. but when to use a flag.... how what flag?
can you show me?
|
|
|
|
|
When your app resets the time, you may (I'm not sure) get another WM_SYSTIMECHANGE message, causing your app to thrash. Use a flag to remember that your app manually reset the time. Clear the flag (if it was set) in OnSysTimeChange().
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
The function has to find the mode (number most found in the array, for ex. array[]{1, 2, 1, 1} the mode is 1 since it appears 3 times in the array while 2 only apears once.
movie is a class and it has a array of ints which movie.return_value(int) accesses. right now the mode equals the first number in the array, its like the second if isant getting evaluated right, anyway in my mind this should work and i cant find a way around it.
void getmode(movie_data movie){
int numfound0=0, numfound1=0, mode=0,
*num0ptr=&numfound0, *num1ptr=&numfound1, *modeptr=&mode;
for(int j=0;j<movie.return_count();j++){
*num0ptr="0;
" for(int="" k="0;k<movie.return_count();k++){
" if(movie.return_value(j)="=movie.return_value(k))
" if(*num0ptr="">*num1ptr){
num1ptr=num0ptr;
*modeptr=movie.return_value(j);
}
}
}
cout<<*num1ptr;
movie.put_mode(modeptr);
cout<
|
|
|
|
|
Hi,
Consider this code (yours is not readable):
GetMode(int array[], int count)
{
int freq, max = 0;
for (int i=0; i<count; i++)
{
freq = 0;
for (int j=0; j<count; j++)
{
if (array[j]==array[i])
freq++;
}
if (freq>max)
max = freq;
}
return max;
}
You have to replace array[x] with movie.return_value(x) and maybe some other few things, but the algorythm seems pretty simple.
You simply search for the most frequent value in the array.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
The function has to find the mode (number most found in the array, for ex. array[]{1, 2, 1, 1} the mode is 1 since it appears 3 times in the array while 2 only apears once.
movie is a class and it has a array of ints which movie.return_value(int) accesses. right now the mode equals the first number in the array, its like the second if isant getting evaluated right, anyway in my mind this should work and i cant find a way around it.
void getmode(movie_data movie){
int numfound0=0, numfound1=0, mode=0,
*num0ptr=&numfound0, *num1ptr=&numfound1, *modeptr=&mode;
for(int j=0;j<movie.return_count();j++){
*num0ptr="0;
" for(int="" k="0;k<movie.return_count();k++){
" if(movie.return_value(j)="=movie.return_value(k))
" if(*num0ptr="">*num1ptr){
num1ptr=num0ptr;
*modeptr=movie.return_value(j);
}
}
}
cout<<*num1ptr;
movie.put_mode(modeptr);
cout<
|
|
|
|
|
Hi,
Consider this code (yours is not readable):
GetMode(int array[], int count)
{
int freq, max = 0;
for (int i=0; i<count; i++)
{
freq = 0;
for (int j=0; j<count; j++)
{
if (array[j]==array[i])
freq++;
}
if (freq>max)
max = freq;
}
return max;
}
You have to replace array[x] with movie.return_value(x) and maybe some other few things, but the algorythm seems pretty simple.
You simply search for the most frequent value in the array.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi!
I already searched everywhere and took a look at many, many exmaples on how using
DWebBrowserEvents2.
But I never got my DLL to work correctly
If someone has a link for me, where it is explained very easy (please NOT MSDN )
then tell me.
I took a look at the "CookieSpy" sample here at CodeProject, and would like to modify the source, that it will work without a dialog and only listen to DWebBrowserEvents2.
How can I easily modify it?
thanks in advance
|
|
|
|
|
Hi!
How can I change the different Windows cursors programatically?
I want the user of my program to be able to select a cursor file for one of the Windows cursors.
Thanks in advance!
Erik
|
|
|
|
|
Read about the SetSystemCursor in MSDN
|
|
|
|
|
Hello,
Does anyone one know what should be set in the PreCreateWindow function to remove the frame border from the CChildFrame window and\or the CFormView derived class?
I want to have something that looks more like a VB Form / Dialog window in that I would prefer a rasied 3d edge rather than the frame.
I think you have to do something with the cs.style, but cannot seem to get it right.
I thought something like :
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style &= ~WS_THICKFRAME;
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
Any suggestions would be welcome.
Thanks.
Giles
|
|
|
|
|
And if you add WS_DLGFRAME ?
cs.style &= ~WS_THICKFRAME;
cs.style |= WS_DLGFRAME;
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
I have tried this. It does remove the thich frame, and replace it with a thin frame, about have the thickness.
I still cannot get the edge of the MDI window to be just rasied rather than a frame.
The CFormView has no border in the resource editor.
Any ideas?
Thanks,
Giles
|
|
|
|
|
Oh, I understand now what you want to get!
You can't do anything from the dialog editor, because the CFormView is child of your CChildFrame window. I had a demo project that turned a from into a dialog, but I can't find it anymore.
However, try removing WS_EX_CLIENTEDGE from the extended style of the frame window.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
I tried both
cs.style &= ~WS_THICKFRAME;
cs.style |= WS_DLGFRAME;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
and just
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
by itself, but no luck.
I'm sure it must be simple, but it feels like I've been though all the permutations.
Giles
|
|
|
|
|
Yes, it doesn't work because of:
BOOL CFrameWnd::PreCreateWindow(CREATESTRUCT& cs)
{
if (cs.lpszClass == NULL)
{
VERIFY(AfxDeferRegisterClass(AFX_WNDFRAMEORVIEW_REG));
cs.lpszClass = _afxWndFrameOrView;
}
if ((cs.style & FWS_ADDTOTITLE) && afxData.bWin4)
cs.style |= FWS_PREFIXTITLE;
if (afxData.bWin4)
cs.dwExStyle |= WS_EX_CLIENTEDGE;
return TRUE;
}
Try to do that in OnCreate(), using ModifyStyle().
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Still no luck. The frame border is still there. I wanted to use this for a database app, which I am converting from Access. I wanted something that had a forms like in Access with no frame.
If you do see an example of this in the future I would be grateful if you could tell me how?
Thanks once again,
Giles
|
|
|
|
|
It was the view...
void CDemoView::OnInitialUpdate()
{
ModifyStyleEx(WS_EX_CLIENTEDGE, 0);
}
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
The correct way:
CMyView::OnInitialUpdate()
{
ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);
CFormView::OnInitialUpdate();
}
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Great!!!!!!
Your a genius.
Thanks for all your help!
Giles
|
|
|
|