SEARCH YOUR SOLUTION HERE  

'Password protected screen saver' is not getting activated!!



I have an simple MFC dialog based application. On launch of that
application 'Password protected screen saver' is not getting activated
after the screen saver timeout.

If 'On resume, password protect' option unchecked, I am getting the
Screen saver.

Application not generating any of the keyboard or any user events to
disturb the system. If I exit the application every thing works
normal(Means password protected screen saver gets activates after
screen saver time out period.)

Please help me in understanding, why 'Password protected screen saver'
is not getting activated.


Posted On: Monday 5th of November 2012 12:56:21 AM Total Views:  337
View Complete with Replies




Related Messages:

need to display a graphic always on top (even when other programs run in fullscreen)   (170 Views)
I want to display the temperature of the CPU/GPU using a graphic. My main purpose to do this project is that laptop users often have overheating problems when playing high performance games. I already know how to get the temperature of the PC but I don't know how to display a graphic that is always on top even though there are games running in fullscreen. The program "fraps" is exactly doing what I am looking for except that it shows the frames per second instead of the temperature. So, how can I ensure that a graphic will be always on top
Shows Blank screen while printing 2d array   (98 Views)
Guys I am trying to write a code for solving the 8 queen problem But the Problem is I cannot Print out the Result. There is something really weird going on. the function showsol is not doing its job. It is messed up for some reason. Can anyone tell me why the 2d Array is not being printed by the "Showsol" Function. It leaves the whole screen blank. Code: #include #include int cb[8][8]={{0},{0},{0},{0},{0},{0},{0},{0}}; int test(r,c) { if(cb[r][c]!=0) { return 0; } else return 1; } void mark(int r,int c) { int a; int x=r,y=c; for(a=0;a0) { cb[--x][--y]=1; } x=r; y=c; while(x
Define screen resolution   (81 Views)
How should I code to define screen resolution I want to get something like this.
program to display an image in dos screen   (91 Views)
i tried the following program given below to load and display a bmp file in a dos screen but it isn't working (image is not shown on screen) whats the problem Code: #include #include #include #include #include char far *Screen; /* Sets the display to VGA 320x200x256 */ void VGAScreen(void) { union REGS r; r.h.ah = 0; r.h.al = 0x13; int86(0x10, &r, &r); return; } /* Goes back to textmode */ void TextScreen(void) { union REGS r; r.h.ah = 0; r.h.al = 0x3; int86(0x10, &r, &r); return; } /* This sets a DAC register to a specific Red Green Blue-value */ int SetDAC(unsigned char DAC, unsigned char R, unsigned char G, unsigned char B) { outportb(0x3C8, DAC); outportb(0x3C9, R); outportb(0x3C9, G); outportb(0x3C9, B); return(0); } int LoadBMP(void) { struct BMPHeader { unsigned short bfType; long bfSize, bfReserved, bfOffBits, biSize, biWidth, biHeight; unsigned short biPlanes, biBitCount; long biCompression, biSizeImage, biXPelsPerMeter, biYPelsPerMeter, biClrUsed, biClrImportant; } Header; FILE *BMPFile; unsigned char c, Palette[256][4]; char *filename = "rck.bmp"; unsigned int offset, lines, paddedWidth; /* This checks for the file */ BMPFile = fopen(filename, "rb"); if (BMPFile == NULL) { printf("Cant open file."); return(1); } /* Read the headerinformation */ fread(&Header, 54, 1, BMPFile); if (Header.bfType != 19778 || Header.bfReserved != 0 || Header.biPlanes != 1) { /* Not a valid bitmap file - don't display */ printf("Not a valid bitmap."); fclose(BMPFile); return(1); } if (Header.biCompression != 0) { /*Compressed file - don't display*/ printf("Compressed file."); fclose(BMPFile); return(1); } if (Header.biBitCount != 8) { /*If the file is other than 8-bit dont read.*/ printf("Not an 8-bit bitmap."); fclose(BMPFile); return(1); } if (Header.biWidth > 320 || Header.biHeight > 200) { /*If its larger than 320*200 dont load.*/ printf("Size too large."); fclose(BMPFile); return(1); } /*Load the palette info*/ fread(&Palette, 1024, 1, BMPFile); for (c = 0; c < 255; c++) SetDAC(c, Palette[c][2] >> 2, Palette[c][1] >> 2, Palette[c][0] >> 2); offset = (100 + (Header.biHeight >> 1)) * 320 + 160 - (Header.biWidth >> 1); lines = 0; paddedWidth = Header.biWidth & 0xFFFC; if (Header.biWidth != paddedWidth) paddedWidth += 4; /*Loop for reading lines*/ while (lines < Header.biHeight) { fread(Screen + offset, paddedWidth, 1, BMPFile); offset -= 320; lines++; } fclose(BMPFile); return(0); } int main(int argcount, char *argvalue[]) { /* Set up a pointer in vga memory */ Screen = (char far *) 0xA0000000L; VGAScreen(); LoadBMP(); getch(); TextScreen(); return(0); } image file was a 8 bit image file, The poster refuses to say which compiler they're using (on any forum), and also refuses to be more specific than "I got some errors". This is just too much effort to be bothered with. > my requirement is to load and display a 600*420 bmp file and program code has to be in c. ... > /* Sets the display to VGA 320x200x256 */ I see you've basically taken lightatdawn's post from 2005 and changed a couple of function names. First of all, BMP has a multitude of sub-formats (BMP file format - Wikipedia, the free encyclopedia), of which that code will only deal with one of those (and for small images). In the short term, you're going to be stuck with the 8-bit paletted BMP files. Second, if you really want to do this on DOS, then you're going to have to make some code to approximate your image. In this case, you're going to have to scale 600*420 down to 320x200 Dividing both by 2 gives you 300x210 (if you don't mind losing a few rows of pixels top and bottom), and makes a first cut of the code rather easy. For each 2x2 pixel block in the image file, say AB CD you just display A That is, on an even row, you just take every other pixel. And each odd row, you ignore completely. Or you just throw that DOS crap in the bin, get a win32 compiler and use various APIs to just load and display ANY BMP file right off the bat. It's more work to display an image to begin with, but you'll have a lot more functionality when you're done (larger images, more BMP formats supported, better results).
How to get my screen resolution using C ?   (94 Views)
, I am using linux (ubuntu) distro. In a project I stucked when I want the exact screen width and height using C language. Please help, how can I get it.
How to get my screen resolution using C ?   (91 Views)
, I am using linux (ubuntu) distro. In a project I stucked when I want the exact screen width and height using C language. Please help, how can I get it.
Files with strings and ints won't print to screen!   (125 Views)
I have one file kristina.txt which holds data in the format below for one person with OCD, im supposed to open files from names the user enters for patients with OCD and then perform calculations on the number of times they do certain repetitions. January 1 Monday brushed_teeth 9 January 1 Monday combed_hair 5 January 1 Monday stepped_up_bottom_step 20 From the first file comp.txt is used to display all possible compulsions for patients. The code below prints all the text from comp.txt, but kristina.txt prints bogus numbers. Also the section of code where the user enters the file name to open it i turned into a comment for now because it did not work, therefore i put the actual file name for now (kristina) Code: #include #include int main() { char compulsions[30]; int patients=1; char month[10], day[10],comp[30]; int date, reps; printf("Welcome to Track Me"); FILE *ptr; // open the file ".txt" for reading ptr = fopen("comp.txt", "r"); if (ptr==NULL ){ printf("File could not be opened"); } fscanf(ptr,"%s",compulsions); printf("List of ALL 15 Compulsions\n"); while(!feof(ptr)){ printf("%s\n",compulsions); fscanf(ptr,"%s",compulsions); } fclose(ptr); //system("cls"); fflush; //to search for patient file //printf("Enter Patients Name to access file"); //scanf("%s",name); FILE *search; search = fopen("kristina.txt","r"); if (search==NULL ){ printf("File could not be opened"); } fscanf(search,"%s,%d, %s, %s,%d",month,&date,day,comp,&reps); while(!feof(search)){ char buffer[60]; fgets(buffer, 60, search); printf("%s, %d, %s, %s, %d",buffer); fscanf(search,"%s, %d, %s, %s, %d", month, &date, &day, comp, &reps); } fclose(search); }
Drawing to the DOS screen with one function call   (88 Views)
If I want to draw pixels in Mode13h in DOS, all I have to do is declaring the following: Code: unsigned char far *screen = MK_FP(0xA000, 0x0000); Now, I can access every of the 64000 pixels in the video memory by using the pointer as an array. How can I do this in text mode As far as I know, in DOS text mode, each character occupies two bytes: One for the character value and one that saves the text color, the background color and the information if the text blinks. Now let's say I have an array of the size of 80 x 25 x 2 bytes. (columns x rows x (character + color + blinking)). How do I retreive access to the video memory so that I can use memcpy and fill the screen with the characters and colors declared in my array
Inheritance from a Template class, problems accessing protectedmember   (229 Views)
Here is my code: #include template class RawPtr { protected: T* pointee_; public: RawPtr() : pointee_(0) {} RawPtr(T* pT) : pointee_(pT) {} }; template class SmartPtr : public RawPtr { public: SmartPtr() : RawPtr() {} explicit SmartPtr(T* pT) : RawPtr(pT) { if (pointee_ != 0) { std::cout
Unknown use of protected member functions.   (254 Views)
Hi. I'm working with a C++ framework that has something like this: class A { protected: virtual void init(); virtual void run(); // rest of the class .... } class B : public A { public: A::init; A::run; // rest of the class .... } I have never seem the use of A::init; and A::run; in that way before. What are they supposed to be How do they afect to class B What do you think is the purpose of them Tom
protected fields   (108 Views)
Are protected fields not only relevant when using inheritance I am currently changing some code that use inheritance to code that does not use inheritance and don't see the point in keeping the fields protected.
Static Method in base class accessing protected constructor of derived clas   (163 Views)
Here is some test code I've been attempting to compile (Visual Studio 2003) test.h: class Base { protected: Base() {} public: template static T* GetInstance() {return new T;} /*ERROR HERE */ }; class Derived { protected: Derived() {} }; class SomeCode { static void SomeCodeForYa(); }; test.cpp: #include "test.h" void SomeCode::SomeCodeForYa() { Derived* T = Base::GetInstance(); } I consistently get a compiler error: "error C2248: 'Derived:erived' : cannot access protected member declared in class 'Derived'" This *seems* like it should be allowed so long as the template parameter is a derived from base. Am I missing something here Is this legal C++
Pointer to protected member function from derived class   (116 Views)
Hi all, Consider the following code: class A { public: A() {} void DoMethod() { (this->*m_pMethod)(); } protected: virtual void MethodA() { ... } virtual void MethodB() { ... } void (A::*m_pMethod)(); }; class B1 : public A { public: B1() { m_pMethod = &A::MethodA; } // invokes B1::MethodA() protected: virtual void MethodA() { ... } }; Class A has a member m_pMethod, which is pointer to a class member function. This function can be over ridden by derived class (in my example this is what B1 does). There more B2....Bn in the system. This code was fine under gcc 3.2.3 but not ok under 4.1.2: test.cc: In constructor 'B1::B1()': test.cc:9: error: 'virtual void A::MethodA()' is protected test.cc:17: error: within this context Ok, after some googling I found it's related to gcc 3.4 changes - http://www.gnu.org/software/gcc/gcc-...ges.html#3.4.6 (look for "forming a pointer to member or a pointer to member function"). Setting B1() { m_pMethod = &B::MethodA; } does not help too: test.cc: In constructor 'B1::B1()': test.cc:17: error: cannot convert 'void (B1::*)()' to 'void (A::*)()' in assignment Any ideas how to fix it BR Dima
copy data on screen   (102 Views)
i have small gaem which pick a word randomly from a list of 100 four letterd words and asks user to guess it, when user inputs it, program compares the inputted word with the randomly picked word and return results, user gets 10 chances to guess the correct word. famous "COWS n BULLS" now the problem is that program has 4 options ,start , resume, help screen and exit. now if a user wants to see help screen in between the game , the current game will be lost and a new game will start on selecting start. i want that if a user selects help screen in between a running game then the screen should be copied and should be printed on rselection of resume. any ideas
A TC++PL protected class question   (117 Views)
While preparing for a c++ interview, I went through TC++PL(3rd edition, 24th) and studied Appendix C, i.e., technicalities. Specifically, I found one of the examples is puzzling to me on page 851, i.e., when a class Y2 is derived from a protected base X class, and another class Z2 is derived from the public base class Y2, in the memeber function Z2::f(Y2* py2) if we tried to do something like class X{ public: int a; }; class Y2: protected X{}; class Z2ublic Y2{void f(Y2*);}; void Z2::f(Y2* py2) { X* px = this; //OK px = py2; //error } according to the book, the second statement is an error //error: X is a protected base of Y2, and Z2 is derived from Y2, //but we don't know if py2 is a Z2 or how Y2::X is used in a non-Z2 object My first question is that: isn't Y2 a member of Z2 (aka base class), so that access to X from Y2 is solely based on the relations between Y2 and X. I think it's equivalent to void Y2::g(Y2 *py2) //notice Y2:: not Z2:: { X* px = py2; //OK } My second question is that the above two sets of code BOTH compile under Microsoft VS 2003 and cygwin. It could be a compiler issue though.
friend function accessing protected members of base class   (141 Views)
Hi Everyone, I have the following code, class sample { protected : int i; private: int j; public: sample() { i = 5; j = 10; } }; class two : public sample { public: two() { i = 10; } friend void test() { i = 111; } }; And i get an error saying test() cannot access two::sample::i; Is there any was for the friend function test() to access the protected members
protected constructor, std::list and friends   (110 Views)
On 6 nov, 11:28, "Thomas Grund" wrote: > > > In the following code I would like that the class Node is only be used by > the class Database. So the idea was to make the interface protected and > use the friend definition. The code does not compile because the list > needs an public destructor. Making list a friend of Node doesn't > help. It does if done the right way. Try friend std::list< Node >. The following should compile: #include using namespace std; class Node { public: protected: void addChild() { Children.push_back(Node()); } private: list Children; friend class Database; friend class std::list< Node >; }; class Database { public: void addItem() { n.addChild(); } Node n; }; int main() { Database d; } , 09.11.2007, 02:16 Uhr, Elias Salomo Helou Neto wrote: > .... > friend class Database; > friend class __gnu_cxx::new_allocator< Node >; > }; > Notice that friend class __gnu_cxx::new_allocator< Node >; is not the > most portable piece of code I have ever seen, but does the job. I have > tried also friend std::allocator< Node >; but does not work. If you > are using another compiler, you should try to dig into the error > messages (or perhaps post them to me), so you can figure out which > class must actually be declared friend. > > Hope I have helped. > > Elias Salomo Helou Neto. > This helped! - at least to get an idea. I definitly need a platform-independend solution but it might be possible to write a special allocator class and use this instead of the platform-dependend one. I'm trying this next week and will write again when I have some results ...
problems with inheritance and protected attributes   (303 Views)
all, I'm working on a project with a layout similar to this: class A { protected: A *next; int i; public: void m(A *a); }; class B: public A { public: void m(B *b); } where both A and B are linked lists, but each one of its own type, and m is a method that manipulates A's 'next' attribute, for instance: A::m(A *a) { a->next = next; i++; } as the behavior would be exactly the same for B, I did: B::m(B *b) { A::m(b); } But that gives me errors on compiling whenever method B::m, tries to access a protected member of class A (for instance incrementing i). I've tried declaring a new variable i to class B, but that just causes both A::i and B::i to exist, and A increments A::i, while whenever someone reads from B, it reads B::i. Which is obviously wrong. Does anybody know how I can fix this Did anybody even understand what I just asked I know I kinda lost me. :P Any help would be greatly appreciated, Lucas , * Lucas Kanebley Tavares: > On Sep 30, 3:23 am, "Alf P. Steinbach" wrote: >> It would be nice if you posted the actual offending code, but happily >> this "problem" is not uncommon, so it is reasonable to assume you have >> something like >> >> B::m( B* b ) >> { >> A::m( b ); >> next->i = 666; >> } >> >> That will cause the compiler to complain, because while B can access >> protected A features on B objects, and on objects of classes publicly >> derived from B, if it could do it could access protected A features on A >> objects it could also access protected A features on Z-objects, where Z >> is a class I have derived from A. >> >> So in that case "protected" wouldn't be any protection: you could access >> protected A features of my Z instances simply by deriving a class from A. >> >> So C++ does not allow that. > > --- Compiler error > wwperiod.hpp: In member function 'virtual double > ZWPeriod::getMinimalCost()': > wwperiod.hpp:50: error: 'DATATABLE* WWPeriod::resTable' is protected > zwperiod.cpp:46: error: within this context > (and the same error for a lot of other attributes in the same > method). > > --- Classes layout > class WWPeriod { > public: > virtual double getMinimalCost(); > protected: > DATATABLE *resTable; > > }; > > class ZWPeriod: public WWPeriod { > public: > virtual double getMinimalCost(); > > }; > > --- Line giving the presented error: > zwperiod.cpp:46: resTable[0].tempCost = prev->resTable[0].tempCost + > prev->holdCost; > > --- > > I'm a reasonably good C programmer, but although I know C++ syntax, > I've never really had any serious projects in C++, so I'm > unexperienced. > > Thank you for your reply, but my problem remains. > Any more suggestions for a n00b Only to reconsider the above earlier suggestion, which is now confirmed. The (or at least one) problem is the attempted access via prev->, as I surmised it would be. Why that is not permitted is explained above. How to possibly fix it, explained above -- and perhaps also take a look at the suggested redesign. In addition to the earlier advice, with concrete code I can now make the suggestion to introduce public inline const accessors tempCost() and holdCost() in the base class, and change the naming convention for data members to e.g. myTempCost or tempCost_. By the way, please don't top-post (rearranged, see the FAQ please), and please don't quote signatures. Cheers, & hth., - Alf -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail
"protected" confusion   (84 Views)
Thank you very much, Viktor. That makes sense. Rob
Why moving a function from protected to public area in class causes error C2556   (131 Views)
Why moving a function from protected to public area in class causes error C2556 - overloaded function differs only by return type I have a protected function called GetState like this: enum EState GetState(void) const throw(); If I move this function from protected: to public: I get this compile error: xbasicsocket.cpp(247) : error C2556: 'enum CXBasicSocket::EState __thiscall CXBasicSocket::GetState(void) const' : overloaded function differs only by return type from 'enum EState __thiscall CXBasicSocket::GetState(void) const' \xbasicsocket.h(154) : see declaration of 'GetState' \xbasicsocket.cpp(247) : error C2371: 'GetState' : redefinition; different basic types \xbasicsocket.h(154) : see declaration of 'GetState' In the cpp file it is declared like this: enum CXBasicSocket::EState CXBasicSocket::GetState( ) const throw() { return m_eState; } Why am I geting this problem How do I resolved