Visual C++ :: Moment When All Interactive User Accounts Have Been Logged Out

Nov 17, 2013

I'm writing a Windows service using WinAPIs and C++. One of the options is that I need to send the system into sleep after all users are logged out. The log-out command is started from the UI (which can notify my service), the problem is knowing how long it takes for all user accounts to be completely logged out before putting the system to sleep.

I first thought to introduce an artificial delay from the moment when the log-out command is issued and before entering the sleep mode, but in a situation when some user account was configured with a roaming profile, the log-out process may well exceed my delay.

how to know if all user accounts are logged out "for sure"?

View 10 Replies


ADVERTISEMENT

C Sharp :: Obtaining Cookie Value From Logged In User On Website

Aug 28, 2012

I am trying to obtain the values of cookies from a particular website. The problem is, when I run the following code, it only loops through 4 of 10 cookie values present.

Furthermore, the values are turning up as deleted: Reference

HttpWebRequest Request = (HttpWebRequest)WebRequest.Create("http://www.mysite.com");
Request.CookieContainer = new CookieContainer();
HttpWebResponse Response = (HttpWebResponse)Request.GetResponse();  
foreach (Cookie cook in Response.Cookies) {                          
           Console.WriteLine("{0} = {1}", cook.Name, cook.Value);           
       }  

Then I came across this code, which states it will loop through every cookie value and obtain its values: Reference

int loop1, loop2;         
       HttpCookieCollection MyCookieColl;
       HttpCookie MyCookie;
       MyCookieColl = Request.Cookies;  
       String[] arr1 = MyCookieColl.AllKeys; 
       for (loop1 = 0; loop1 < arr1.Length; loop1++) {
           MyCookie = MyCookieColl[arr1[loop1]];          
           String[] arr2 = MyCookie.Values.AllKeys;
       }  

The problem with the above, I can't seem to find a reference to "Request". I am using the libraries "using System.Net and using System.Web", so I am unsure why Request is not being recognized.

My goal is to retrieve one cookie value so that when a user from my website logs in, my C# application will recognize that user.

View 7 Replies View Related

C++ :: Creating Accounts And Stores It On CSV File

Jun 20, 2013

What I am trying to do is a small program that creates accounts (User name, age,...), and stores it on a CSV file. And later I can search for a user and edit some information about him (example, his age).

Here is my code:

#include <fstream>
#include <iostream>
#include <string>
#include <stdio.h>
#include <io.h>
#include <stdlib.h>
#include <string>

Looking at the "old code" ("void searchaccountold()"), I am sure the problem is on the "while" part ("while (myfile >> name >> age >> money)").

It should work, but it doesnt. I am almost sure the problem lies on the ";"... Because the CSV uses cells, and to pass to the second cell I would normaly need an ";" and in my case I have ">>". I have tryed to change them, to use getline, etc... and didnt work.

View 5 Replies View Related

C++ :: Bank Accounts Program Using Structures

Mar 1, 2014

I have an assignment to write a program using structures, getting input from a .txt file and output in text file as well. I have written a program that only reads and prints the data. I am trying to test if it works fine or not. I always comment an unnecessary code but still it wont compile. Now whats wrong with this program?

/* Bank Accounts Program */
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>//needed to use system() function
using namespace std;
const int MAX_NUM = 50;
void menu();

[Code]...

View 1 Replies View Related

C++ :: Storing Accounts In A Text File

Feb 21, 2015

The problem that occurs is coming from the I/O I believe. I am creating a bank handling program and I am storing the accounts in a <map> and then I am storing the accounts in a text file. The problem I have is when ever I am closing the application and restarting it and want to read the text file I am getting nothing or I am getting really odd results. In the application it can be that it does not read anything or it could be that I get

Acc nbr: 0
Name: -47000300
Type: 12333993
balance: Å

But in my txt file its perfectly normal. Sometimes when Ive been trying to play around with the code the txt file changes the text to kanji signs. I've created an own implemented class that handles the account for example, deposition, overloading constructor of creating an account, withdraw, returning various information. The attributes are all public.the read file function:

void read_file(){
string name;
int pnbr;
int accNbr;
int balance;

[code]....

View 9 Replies View Related

C++ :: Creating Bank Accounts Using Classes

Feb 25, 2014

I am creating a bank account using classes. I have created the classes and now implementing them in my main program. I haven't written anything in the withdraw, find acct and all functions except "read account: read_acct()" because i wanna test if it reading the data from my .txt file or not. Dont know whats wrong with the program its not executing. Would let know that i'm new to classes and objects. Following is the code:

****************************************************
*************MAIN PROGRAM*************************
****************************************************
****Bank Accounts.cpp****

[Code]....

View 5 Replies View Related

C++ :: Interactive Loan Calculator For School Project

Jun 6, 2014

I'm trying to build an interactive loan calculator for a school project. These are the requirements:

Your program should do the following:
•Display a Welcome title for the Loan Calculator
•Prompt the user to enter the price of the car
•Prompt the user to enter the length of the term in months
•Prompt the user to enter the APR in percentage (e.g. 4.79%) - without the percent sign of course

Your program should then report with the monthly payment will be.

Use setw() and setfill() to display the content like a receipt. All the data should be neatly displayed.

Example

For a Friend Loan Calculator

Price of Vehicle: $25,000
Term of Loan (in months): 60
APR in percentage (e.g. 4.79% - without the percent sign): 3.8
--------------------------------------------------------------
Total Monthly Payments: $433.50 //NOT ACCURATE

Display all money totals (output values) to two decimal places. You should output an accurate result as well.

For extra credit you may factor in a state auto sales tax of 6.5% of the purchase price of the vehicle and how much of a down payment the user would like to put down. Of course, if you are factor down payment, you must prompt the user to enter that amount.

I attempted to build one but I'm getting a lot of errors using Microsoft visual studio. Here it is below:

Interactive Loan Calculator

#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
using namespace std;

int num1,
num2,
response,

[Code] .....

View 3 Replies View Related

C/C++ :: Interactive And Animated Real-time Offline Map Application

Apr 25, 2015

I want to develop a interactive and animated real-time offline map application. For example if user puts mouse on the map, it should the latitude, longitude and name of the location.

There should be animation for example blinking of a location. And it should work offline without internet. I want to use google maps data but I don't know how.

I know following languages:
C/C++ (Advanced level)
PHP (intermediate level)
Java ( beginner level)

View 1 Replies View Related

C++ :: Write Interactive Text Based Menu Interface (using A Loop)

Sep 27, 2013

Write an interactive text based menu interface (using a loop) that will allow the user to

Enter a task or assignment Display all of the tasks that are in the file Find a task by Course Quit For each task, you need to keep track of:

Course Name that it is for (e.g., CS162)
Description of the assignment (e.g., Finish Lab 2)
Due date (e.g., 9/26/2009)

Allow the program to keep looping until user wants to quit. When the program starts, it should load the tasks from external file ("tasks.txt") into memory. When user enters the three items of a task, the program needs to read them in, save them in memory and eventually write them to the external data file ("tasks.txt"). The file format could look like: (The ';' is used as a delimiter or field seperator.)

Some Implementation Requirements:

Write at least four functions WITH arguments for this assignment. Use struct named Task to model task Use array of structs to model the collection of tasks. Hint: In this assignment, the description and course name may have multiple words in it. Therefore, you now SHOULD read using the 3 argument version of get. Watch out. When using the 3 argument version of get you need to make sure to remove the delimiter or newline. Therefore, anytime you read (even a confirmation message), make sure to eat the newline! Make sure to have a delimiter written between each item in the file – like a newline. This will be important when you read the information back from the file.

This is my code so far:

#include <iostream>
int main()
{
char cname[25],desc[20];

[Code]....

View 1 Replies View Related

C Sharp :: Pulling Data From Database In Windows Form To Make It Interactive And Pushing It?

Jul 6, 2012

I am busy with a project, it is going to consist out of 3 different windows which is logic enough for this whole code to be interactive.

It must be able to pull data into a windows form, displaying it into a textbox, and when you click on the textbox it needs to open up another window where you will have a windows form that will display data as the code loops through the questions in the database.

I am not sure how to push the data that has been selected on the database to the next window..

Here is my code for the first window:

;
namespace WindowsFormsApplication1
{    
    public partial class Form1 : Form  {
        //SqlConnection myConnection = new SqlConnection("Data Source=(local);Initial Catalog=KnowledgeEssentials;Integrated Security=SSPI");
        //int intType = 0;
        public Form1()

[code].....

With the second window the data in the table needs to be displayed and each row from the table needs to have a checkbox next to them, so that if the check box is checked, the relevant information of the checked row will show up in the 3rd window... so MY question is, HOW do I pull that data from that specific database and let it show in the listcheckbox?

View 1 Replies View Related

Visual C++ :: Accessing User Directory In Win 7 Pro?

Jul 12, 2013

I have been using the code below to extract the current user directory in order to read and write to certain files, presumeably independent of whether or not the user has administrative privileges. This has been necessitated in Win 7 because applications installed in the customary C:/Program Files(x86)/ are not allowed full access to files in the installed app root directory. This was working just fine until just this week when suddenly, for the first time, I found that the user directory retrieved was different when the app was run without administrative privileges in 'Start without debugging' configuration, both in Debug and Release configuration. Note that I have tested the identical app on Win2K and Vista and in neither case is it a problem on those OS machines. More mysterious is the fact that this ONLY happens on Win7 (VS2010 Ultimate) when run in the IDE. Run from the windows explorer double click, the app runs just fine in release and debug mode and monitoring the debug version using DbgView indicates that the expected 'Roaming' User directory is retrieved.

For example:

- without debugging (both Debug and Release configuration) the code below produces:

m_csUserDirectory =: C:UsersMPLIAMAppDataLocalPliaTechUeberKrypt

- with debugging (both Debug and Release configuration) the code below produces:

m_csUserDirectory =: C:UsersMPLIAMAppDataRoamingPliaTechUeberKrypt

Either this has been the situation from the outset and I just never noticed it (hard to imagine as I've been on this project for 6 months with 50+ builds), a recent Windows update has changed things, a bug, or I'm just plain stupid (not hard to imagine at all).

From a practical standpoint, if this is the way things are to be, my installer will need to install necessary files in both user directories and the app will need to access both depending upon user privileges.

Code:
/// This routine retrieves the process's environment block
/// using GetEnvironmentStrings, parses that block pointed to
/// by the generic international text pointer LPTCH, and returns
/// the requested string lpszVarStr as a string.
/// Note that the block lpvEnv environment variable substrings
/// are separated by NULL byte, and the block is terminated by a NULL byte.
/// The header files <windows.h>, <tchar.h>, <stdio.h>, <string>, and
/// <iostream> need to be included.

[code].....

View 5 Replies View Related

Visual C++ :: How To Log Off A User When Workstation Is Locked

Nov 30, 2013

I wrote a Windows application that comes with two modules: service and user-mode exes. The service implements its own scheduler and may log-off a user at a predefined time. For that I was using the following call that is triggered from my user-mode module exe in a logged-on user session that has to be logged off:

Code : BOOL result = ExitWindowsEx(EWX_LOGOFF, reason);

This works fine, except of the situation when a user's account is locked. In that case that API doesn't seem to do anything at all even through I get 1 returned from it.

So I was curious, is there any other way to log off a user when their account is locked? (One condition I have in this case is that if that user had any unsaved documents then the log-off should not be forced.)

View 9 Replies View Related

C :: Multi User Chat Over TCP/IP In Visual Studio

Jun 1, 2014

I want to have a multi user chat over TCP/IP. I already have the code for both the server and the client and so far I am able to send messages from the client to the server. Now I want to make it a multi user chat. I am executing the codes using Visual studio's Command prompt(not Windows Command Prompt). I have read somewhere that we have to use select() function.

View 2 Replies View Related

Visual C++ :: Allow User To Enter A Value As C String In Certain Form

Oct 14, 2013

My program was to allow the user to enter a value as a C string in the form: xxx,xxx,xxx,xxx,xxx.xx, where x can be any digit. Well, so far here is my attempt. I think the question is, would I have to implement a switch statement for the digits, the comma, and the decimal, so that when a user inputs, let say 52,000.00 the switch statements would read the 1st digit, checks for decimals/commas and if not, proceed to read 2nd digit, and repeat?

Code:
#include <iostream>
#include <string>
int main() {
using namespace std;
char buffer[256];
char tempBuff[256] = {'

[Code] ....

View 3 Replies View Related

Visual C++ :: Allowing User To Input Decimal?

Oct 21, 2013

This code is near complete, the only task that is left is allowing the user to input a decimal and then two integers, or automatically using .00 decimal.

The automatic part: /*This is not correct.

printf(".%.2d
", number);
*/

But that does no good for me. Question: Do I have to create a some sort of while loop again, to allow the user to input a decimal followed by integer?

Code:
#include <iostream>
#include <cstdlib>
using namespace std;
int main() {
int j , i = 0, k = 0;
int number;

[code]....

View 1 Replies View Related

Visual C++ :: How To Tell If User Account Is Set Up With Roaming Profile

Nov 22, 2013

Is there a way to know from a Windows service application (running as a local-system) if a specific logged in interactive user account is configured with a roaming profile? I need this to be compatible with Windows XP SP3.

View 9 Replies View Related

Visual C++ :: User Callback And CResource Exception

Oct 8, 2014

In my Project, I'm using my Parent Dialog(TestDlg) as a background dialog.

Child Dialog 1 = Main.cpp & Child Dialog 2 = Dummy.cpp

1. I like to call both dialog continuously one by one.

Using Timer function i called continuously the dialogs.

After 5 minutes getting an error, "0xC000041D An unhanded Exception was encountered during a User Callback".

2. Then, I'm using CGdiPlusBitmap.cpp file to load PNG image into buttons.

After 5 minutes getting an error - "CResource Exception".

For reference test code attached.

View 14 Replies View Related

Visual C++ :: Taking Decimal Input From The User

Feb 21, 2015

I want the input for the price in decimal format(15.00). If the input is in integer format then I want to convert it to decimal format.

The maximum price for a sale is 999.99 and minimum is 0.00.

I have tried so far:

Code:
#include<iostream>
using std::cout;
using std::cin;
void main(){
float eventPrice;

[Code] .....

A valid input will be:

1.8,
0.8,
0.00,
0,
9,
99

View 2 Replies View Related

Visual C++ :: Creating Containers That Respond To User Actions?

Oct 16, 2013

I am looking for direction on what topic I should be reading up on. I am new to C++ and Windows MFC.

This is my real world problem, in the context of the application user. (these term do not refer to OPP concepts)

I want to create shapes (containers) in an application that will respond and collect other objects;

Imagine a Windows frame, containing several 2 dimensional squares. I want to be able to drag and drop marbles into the squares,and have the square retain and display the marbles in the square, in the order that they were dropped in.

How do I create the shapes, and how will the square sense when a marble is over it?

How would I create irregular shapes (a combination of lines and curves) that would be responsive to the marbles?

View 2 Replies View Related

Visual C++ :: Program That Take Input From A User And Calculate It In A Do While Loop

May 15, 2013

I'm trying to create a program that will take input from a user and calculate it in a do-while loop. The program does the calculation but the answer is wrong. The loop also doesn't work. The purpose of the program is to see how much an item will cost after a discount is taken off and tax is added.

#include <iostream>
#include <cmath>
using namespace std;
double original_cost;
double discount;
double tax;
double total;
char answer;

[Code]...

View 2 Replies View Related

Visual C++ :: How To View Line Length In Cm To User (using Map Mode)

Nov 3, 2012

My program allow user to draw lines and the user should know the length of the line that he draw in centimeter (.cm)

I did use

SetMapMode(MM_LOMETRIC) function to convert the device units into logical units

and it works correctly but I don't know how the line length will appear to the user to let him draw in correct length

I think to make the length appear on the mouse when the user draw but I don't know how I calculate and display it.

View 2 Replies View Related

Visual C++ :: Showing Time For A User While Entering Some Characters

Dec 26, 2014

Im working on my project for college and i want to know how to add sth similar to a chronometer for user to see how much time have passed while entering some characters using cin.getline function.

View 2 Replies View Related

Visual C++ :: Find The Location Of Certain Digits From User Input

Sep 24, 2013

I have been trying to finish this code (function) for a while now, but am stuck on the last part. In this code, I prompt the user to select a number of integers and any number of digits and then find the smallest and largest value within these digits. On the next part, I am supposed to determine which of the given digits the smallest and largest are located such that the output should be:

Digit _ can be found in integer number(s): _, _

Here is what I have tried:

Code:
int digitSizeLoca() {
int userNumInteger;
int* iPtr;
int* iPtr2;
int* iPtr3;
int value;

[Code] ....

Seems to do the job, but it always outputs 1, 2...

View 4 Replies View Related

Visual C++ :: Using Loop To Take User Input And Keep Running Sum Until 0 Entered

Feb 28, 2013

I am stuck on an exercise where i am supposed to use a loop to take user input and keep a running sum until the user enters a 0. the code i have so far is:

#include <iostream>
int main() {
using namespace std;
int num;
int total = 0;
int x;

[Code] ....

The full text of the error message is: error c2678:binary'>>':no operator found which takes a left-hand operand of type 'std::istream' . and one more thing i was wondering, is there a difference between c++ and visual c++?

View 4 Replies View Related

Visual C++ :: Create A File That Ask The User To Enter His Info

Nov 9, 2014

What I want to do is create a file that will ask the user to enter his info,n then store it in a text file The screen will ask the user if he wants to update his info. if he says yes then the screen will be cleared and the old info will be printed on the screen. The user will enter his new info that will be stored in a new file. My problem is that once the user finishes entering his input the program just closes D: and the rest of the program won't run.

Code:

int main()
{
string ans;
ofstream Xfile("original.txt");
cout <<"Enter your name and address please"<<endl;
cout<<"Press Ctrl+Z+Enter when you are done"<<endl;
string name_and_street;

[Code]...

View 3 Replies View Related

Visual C++ :: Converting Decimal Number Given By User To Binary?

Dec 19, 2014

Write a C++ program that adds three binary numbers of 8-bit each. Every number is stored into an array of 8 elements.

Example:

Array A
0 1 2 3 4 5 6 7
0 1 1 0 1 1 1 0
+
Array B
0 1 2 3 4 5 6 7
0 1 1 0 1 1 1 0
+
Array C
0 1 2 3 4 5 6 7
0 1 1 0 1 1 1 0

Store the result into an array D of 8 elements. Your program should show the decimal numbers for every binary number. Print screen of 6 answers. This means you should try your program six times with different numbers in every run and show the printed screen result.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved