C++ :: Keeping A Listbox Loaded During Startup?

Jan 17, 2013

how is it done?

ex. mp3player keeps songs loaded

View 1 Replies


ADVERTISEMENT

C# :: Moving Listbox Selection To New Listbox In New Form?

Sep 11, 2014

Okay so i have everything right accept transfering the selectedindex from listbox in form1 to listbox in form2. I am using the below string item to hold the selected line of the list box, with the intent of recalling and then adding it into the form2 listbox. I get a not implemented error and i can't figure out why. I know the information is moving with the variable item, it just doesn't get printed out to the new listbox.

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string item = listBox1.SelectedItem.ToString();
Form2 form2 = new Form2();
form2.Show(item.ToString());

[Code]....

View 13 Replies View Related

C++ :: Keeping Output Window Open

Jun 24, 2014

My program accepts strings, places them in a vector and then "bleeps!" out words of my choosing, in this case, "broccoli". But I'm having trouble keeping the output window open even with my Keep_window_open() implementation.

#include "iostream"
#include "string"
#include "vector"
#include "algorithm"
#include "cmath"
using namespace std;

[code]....

View 2 Replies View Related

C++ :: Structures - Keeping High Scores Of Users

Jun 1, 2013

Write a program that allows a user to enter high scores of a game, keeping tracking of the name of the user and the score. Add the ability to show the highest score for each user, all scores for a particular user, all scores from all users, and the list of users.

This is the program I am trying to write, however I am having difficulty storing the users name and high score, I know I need to store an array for the score but getting confused because of the structure. (By the way I have to use structures as it is a problem from the structures chapter of the ebook I am doing). Below is my code so far. .

Code:

#include <iostream>
#include <string>
using namespace std;
struct highScore
{
string user;
int score;
int highestScore;
int allScores;

[Code]...

View 9 Replies View Related

C/C++ :: Dice Rolling - Keeping Track Of How Many Times A Number Appears?

Sep 27, 2014

I wrote a code that mimics a dice, my code so far will ask for the user to input a number at which they want to hold or no longer throw the dice, it will also ask the user how many roll simulations they would like to do.

If a 1 is rolled the turn is over and the score is 0

After this input is recieved the code goes into a loop until the values have been met.

I would to add probability to my code so I need to know how many times a certain number was rolled and this is where I am stuck.

An example of how I would like my code to work, let's suppose hold at number is 17

We role the dice until we roll a 17 or larger, but if we roll a 1, then our score is 0.

Let's suppose the number of simulations is 5 and for simulation 1 we roll

2 + 5 + 6 + 4 = 17

and for simulation 2 we roll

5 + 4 + 1, but since we rolled a 1, the score is 0,

for simulation 3 we roll

3 + 4 + 5 + 6 = 18

for simulation 4 we roll

4 + 4 + 6 + 6 = 20

for simulation 5 we roll

3 + 4 + 5 + 5 = 17 so that means we got

0: 1 time 1/5 = .20
17: 2 times 2/5 = .40
18: 1 time 1/5 = .20
19: 0 times 0/5 = .00
20: 1 time 1/5 = .20
21: 0 times 0/5 = .00
22: 0 times 0/5 = .00

In other words the idea is to roll a 17 or larger (or whatever the hold number happens to be), but if you roll a 1, then your score is a 0.

#include <iostream>
#include <cstdlib>
#include <ctime>
using std::cout;
using std::cin;
using std::endl;
int dieRoll();

[Code] ....

View 4 Replies View Related

C/C++ :: Keeping List Of User Guesses And Output Message If Guess Is Duplicate

Apr 19, 2015

The label "You already picked that" doesn't always appear. Sometimes it does, but only if a duplicate has been entered at least 3 times. I haven't been able to correct this. I am new to programming and array-based lists.

//Objective: randomly generate an integer between 1 and 100, input user guess as to what number it is, and output "correct!" if user guess is the random number, or output "Too high" if the user guess is too high, or output "too low" if the user guess is too low, "you already entered __" if a duplicate is entered and allow the user to keep guessing until they guess the correct number

//libraries
#include <ctime>
#include <cstdlib>
#include <iomanip>
#include <iostream>
using namespace std;
struct Guess {

[Code] ....

View 9 Replies View Related

C/C++ :: Add Speech Program At Startup In Windows

May 16, 2014

I am trying to build a program which would start at the start of the computer, so for that when ever the user would run the program the program must get copied in the startup folder of the Windows I guess or anything else so that the program runs as soon as the computer is booted.

I this program would create a .vbs file n the startup, in that vbs file i would write the code for speech. so what the computer would greet you when you switch on the PC.

Here's what I tried:

#include<stdio.h>
#include<conio.h>
#include<string.h>

[Code]....

So my motive behind this code is that, this should create a .vbs file in the startup folder in that vbs file the above code would be written,

(Dim speaks,speech
speaks=Hello!
set speech=CreateObject(sapi.voice)
speech.Speak speaks) a

And then the vbs file would execute as soon as the computer starts, and then it would speak "Hello!".

But the problem is that i am not able to create a file in the folder when i run the program the file is not created, i do not get any error but nothing happens as well.

View 8 Replies View Related

C# :: How To Check A Winservice Startup Type

Nov 6, 2014

I have to do a program that checks the startup type of several winservices, but i cant seem to find an answer (that works).

I have tried using ServiceController, but it doesnt contain that info. I have tried using ServiceHelper but i cant find the package that contains it, i tried invoking some dlls but that didnt worked either, and some more that i didnt even understood..

View 1 Replies View Related

Visual C++ :: Edit Message Map At Startup

Apr 17, 2015

Is it possible to edit the message map at startup instead of just having it set at compile time?

I'm reading some values from an XML file at startup. The menu options will be determined from what I find in there. But I need to assign those menu options to the message map.

View 8 Replies View Related

C++ :: Detecting Application Startup And Exit Events?

Apr 20, 2012

I have written ( using VS2008 c++ ) a windows service which sends information about PC usage to a central database, as part of a PC availability setup. I have been asked to add the following functionality to it:

1) What applications are most used, when and how long for, and

2) What web sites are being accessed, again to find the most popular etc.

My main question is, what functionality is there to trap application start / close events from within my service ( just need the application name ), and secondly I am already using sockets to send information to a PHP script on a server, the best way to see what web pages are being accessed is to build in a packet sniffer, and extract the information from that.

View 6 Replies View Related

C :: How To Deploy EXE File On Domain As Startup Script To Display Information

Aug 30, 2013

I have some requirement regarding implementing a C program .exe to implement on Domain computers as a Startup/Logon script. I created a C program which is meant to be run on domain PCs when they start/Login. This .exe program runs some DOS commands using system function, then writing output to few files. I then pick up required information from files & prints it on to a console screen. While creating this program using C compiler, it gathers all the info & prints to screen properly. It uses following commands in program:

Code:

reg export "...." "c:windowswebwallpaper
eg_xport.txt" Here "..." means some registry path e.g. HKLM... etc.

Code:

systeminfo > "c:windowswebwallpapersys_info.txt" wmic qfe get installedon > "
c:windowswebwallpaperpatches_date.txt"

Two issues over here are that 'reg export' to a file and 'wmic' require admin privileges on domain PC & thus the program should carry admin rights while executing. I got this solved by putting this program to run as startup script. The program runs, creates files and removes them also(as a part of program), but shows no output on screen (from screen I mean console screen). I then created a plain "Hello" program and implemented it on few domain PCs, I guess script got executed but nothing came up on the screen.

I am not sure what is happening at backend. Whether the program is able to execute only DOS commands & skip all other IF/ELSE/WHILE conditional loops. Or these are executing but PRINTF is not able to launch a console screen. Printing output to screen is must in order to pass message to users using PCs.

View 6 Replies View Related

C++ :: Program That Needs Auto Start At Windows Startup - Adding Registry Entries?

Jan 18, 2012

I am developing a program that needs auto start at windows startup. For that I need to add Registry entries. Also the program needs to read some registry keys. What are the functions i need to do these.. Simply I need to

check if the startup key already exists
add a new key if it doesn't exist
read a key values

View 7 Replies View Related

C++ :: How To Check If Process Loaded Completely

Sep 17, 2014

For example, I have a game loading to start up .. How can I check if it completely loaded?

View 1 Replies View Related

Visual C++ :: Prevent DLL From Being Loaded / Injected

Dec 12, 2012

If you're writing a .dll you can prevent that dll from getting loaded into some processes by returning false from the dllmain.

I'm looking for a way to do it the other ay around. I have an exe, and I want to prevent a certain hook dll from getting loaded/injected into my exe.

A customer is running some software which loads a hook dll into our exe, and this is subsequently preventing our application from running as intended. Both our software as well as the third party app is required, and there is no way to get the third party dll changed. (no longer supported).

View 2 Replies View Related

C++ :: User Input Loaded Into Array Of Elements

Mar 19, 2014

I am compiling using Microsoft Visual C++ and I am trying to create a program that ask's the user for 10 numbers, and these numbers will have to be loaded into a one dimensional array of 10 elements. I read up online as well as my book and looked at sample programs, then created mine which was similar to the sample programs I looked at, but the sample ones compile , while I get C2059 and C2061 Syntax Errors. I am new to programming so I understand it could be one small thing but I after looking over it I am completely clueless.

Heres my program:

Code:
#include
<iostream>
int
main()

[Code] .....

My program is also attached

View 5 Replies View Related

C :: Displaying A String Loaded From A Text File

Jan 19, 2014

I'm working on a program that can load all words from a dictionary "English2.txt" (it's attached to the post), then put every word into a 2-dimensional matrix (every line is reserved for one word) and display them. After loading every word into a matrix, when I try to display first 8 words with printf, I can't do it without '' at the end of a line. Otherwise only the 8th word is displayed... What's more, when I try to read the length of the first word with strlen, it says, that it has 4 characters (in fact there are only 3 and it's the word "AAA"). What could be the reason for that?

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
int main()
{
FILE *fp;
char buffer[32];

[Code]...

View 4 Replies View Related

C++ :: Dynamically Loaded Library - DLL Call Sometimes Works

Apr 22, 2013

I have a question about a dynamically loaded library I am using. I have called it SqlWrite, it is for connecting and writing to a Microsoft SQL server DB. I have a function in it that is defined as:

extern "C" {
__declspec(dllexport) RETCODE __cdecl SqlExecS(SQLHANDLESTR* h, LPCSTR Statement) {
RETCODE RetCode;

std::string input = Statement;
std::wostringstream conv;
conv << input.c_str();
std::wstring wCmd(conv.str());

[Code] ....

I then load it in another MSVC project as:

#ifdef WIN32//C:UsersaDocumentsVisual Studio 2012ProjectsGetPageSourceDebugGetPageSource.dll
#pragma message("WIN32 is defined")
#ifdef _DEBUG
SetErrorMode(0);

[Code] ....

As you can see, inside the prototyped function "SqlExecSP", I cout (or, rather, wcout for wide characters) the sql statement i am running, and the return code of the sql statement. a sql return code of "0" is equivalent to "SQL_SUCCESS". Then, I cout " got player again " after executon of SqlExecSP alias SqlExecS.

This usually works, and gives me following sample output:

exec SELECT [PlayerID], [FirstName], [LastName], [TeamID] FROM [soccer].[dbo].[Players] WHERE LastName = 'Abdellaoue' AND FirstName = 'Mohammed' retcode 0

RETURNING FROM EXECSP NOW!!!
got player again

However, sometimes, the program crashes somewhere between outputting "RETURNING FROM EXECSP NOW!!!" and outputting " got player again ", i.e. the output is then:

exec SELECT [PlayerID], [FirstName], [LastName], [TeamID] FROM [soccer].[dbo].[Players] WHERE LastName = 'Abdellaoue' AND FirstName = 'Mohammed' retcode 0

RETURNING FROM EXECSP NOW!!!

As you can see, it doesn't output the next line " got player again ", because it somehow crashes in between.

However,t he only line that should be executed between this, as far as I can understand, is the actual return of the DLL function SqlExecS, prototyped as SqlExecSP in my calling code, i.e. the only line that should be executed in between is:

return RetCode;

However, somehow, this fails, even though RetCode is "0", as I can see at the end of the output

exec SELECT [PlayerID], [FirstName], [LastName], [TeamID] FROM [soccer].[dbo].[Players] WHERE LastName = 'Abdellaoue' AND FirstName = 'Mohammed' retcode 0

Now, why sometimes this crashes, and sometimes this works. I.e, I can sometimes call this function x times, and it doesnt fail, outputting " got player again " right after the calls, and sometimes, it fails somewhere in between, at call x, y, or z, i.e. sometimes i can execute it ten times successfully and sometimes i can't, even though the return code is still 0, and it just fails somewhere in between. I am not sure if it has to do with the call being a call to a dynamically loaded DLL function, but I can't see where else the error is.

Why this can be failing, and at different, seemingly random times?

View 3 Replies View Related

C/C++ :: Direct X Tool Kit Throws Errors When Loaded In

Oct 21, 2014

I have a project which I started. then tried to add the directx toolkit to the project referenced it but now my program wont load.

View 1 Replies View Related

Visual C++ :: Breakpoints Will Not Be Hit - No Symbols Loaded For Document

Apr 10, 2013

I am using Visual Studio 2010 with WindowsXP 32 bit. when i placed break points in my solution and trying to debug then i am getting THE BREAKPOINTS CAN NOT BE HIT NO SYMBOLS HAVE BEEN LOADED FOR THIS DOCUMENT issue.

View 2 Replies View Related

C++ :: Calling Dynamically Loaded Function From DLL Destruction Error?

Apr 18, 2013

I have two projects (Projects A and B). Project A is a dll project, defining a function called "regex".

Project B dynamically loads this DLL, and calls Project A's "regex" function via LoadLibrary/GetProcAddress.

Regex takes a pointer to an std::vector (std::vector<std::cmatch>).

When debugging ProjectB, I can see that, within the code from ProjectA (in the "regex" call), a loop that loops through the elements of the vector outputs all the elements in the vector to console as expected. But the loop in ProjectB ( which executes after ProjectA), which also loops through the vector, and, is supposed to output the elements of the vector, outputs empty strings, not, as I would expect, the same strings (which contain results), as in the loop in Project A.

How is this happening. Does this have anything to do with it being a DLL, and, maybe, somehow values/memory addresses (or something similar) of the vector/its elements being destructed across the Projects/Dlls?

Output and Code See Below:

Output Loop in A:

Un
Un

Output Loop in B: (empty) (i.e. none)

Project A DLL Header (interface.h):

#include "stdafx.h"
#include <vector>
#include <regex>
extern "C" {__declspec(dllexport) int __cdecl regex(std::string target,std::string rgx, std::vector<std::cmatch*>* matches);}

[Code].....

View 8 Replies View Related

Visual C++ :: Out Of Memory And Driver Could Not Be Loaded Due To System Error 8

Jan 21, 2013

I am getting "driver could not be loaded due to system error 8" error while connecting to SQL Server 2005 from VC++. Its also throwing out of memory error. Basically i am developing and ISAPI dll. I use the following code to connect to DB.

CDatabase DBConnection;
if(! DBConnection.IsOpen()) {
DBConnection.OpenEx("Driver={SQL Server};Server=10.120.110.30;Database=Test;Trusted_Connection=yes;", CDatabase:penReadOnly | CDatabase::noOdbcDialog);

[Code] .....

for CDatabaseConnection, i can see 2 different method to open the connection, OpenEx and Open. Whats the difference between OpenEx and Open?

View 7 Replies View Related

C :: Runtime Error R6002 - Floating Point Support Not Loaded

Feb 21, 2014

I wrote a program that use a struct to represent an athlete. The program allocates memory for an array of 5 Athletes, and, soon after I enter the fourth data (height) for the first athlete, I get the message "runtime Error R6002 - floating point support not loaded". The program doesn't reach the line where __LINE__ would be printed.

Code:
#include <stdio.h>
#include <stdlib.h>

typedef struct athlete {
char name[ 100 ];
char sport[ 100 ];
double height;

[Code] .......

View 14 Replies View Related

C# :: Using Array In Listbox?

Jun 2, 2014

My main form I have the following code

[ImportingConstructor]
public MainForm([ImportMany] IEnumerable<AudioPlugin> content)
{

[Code].....

However, when I add to the listbox as shown above in my main form code the results all show on the same line. My understanding was that they should all be treated as separate because of foreach loop but apparently that is incorrect. I have seen mixed things online some showing that its required to use AddRange instead of Add, however, after literally hours of trying to make this work I am still coming up with nothing. I can't seem to get any code to work using the AddRange or am I finding any way to output each results on a separate line.

View 7 Replies View Related

C++ :: Listbox SendMessage Not Working

Jun 25, 2013

I have a problem with SendMessage. Anything I send doesn't show up but instead empty lines appear. What is wrong with my code?

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
TCHAR greeting[] = _T("Hello, World!");
wchar_t listBoxStr[15];

[code].....

View 7 Replies View Related

C# :: Invert ListBox Selection?

Apr 18, 2014

I have my ListBox working and I'm able to select the items I want to keep. I'm trying to now get the Invert of the current selection for the items to delete.

I tried using:

if (lstLinePatterns == null) return;
for (int i = 0; i < lstLinePatterns.Items.Count; i++)
lstLinePatterns.Items[i].Selected = !lstLinePatterns.Items[i].Selected;

But
.Selected
is giving me an object error.

Is there an easy way to just inverse current selection?

Current Code:

private void btnSelectNonRvt_Click(object sender, EventArgs e)
{
// Unselects any Items to Prevent Infinite Loop
lstLinePatterns.SelectedIndex = -1;

[Code]....

View 3 Replies View Related

C# :: Clear A Listbox From A Class?

Jun 5, 2014

I need to clear a listbox from a class other than the form where it exists. Why this isn't working? I'm getting no error messages when I compile and I am seeing the Console.WriteLine text I also added in the same function. I can call this function from within my form and it behaves as expected. I tried setting the listbox to public despite the fact I wasn't getting protection level errors but that made no difference.

Just to clarify what I'm doing here... I have a form that includes a panel of user controls from another class. So there is a listbox on OtherClass and the listbox is in MyForm. Heres my code:

MyForm

public void ClearListBox() {
Console.WriteLine("echo");
listBox.Items.Clear();
} OtherClass
private void listBox_SelectedIndexChanged(object sender, EventArgs e) {
MyForm mf = new MyForm();
mf.ClearListBox();
}

View 9 Replies View Related







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