C/C++ :: Implement Two Tasks Synchronized On External Event Using Mailboxes

Jan 21, 2014

I have to make a C++ program that implements two tasks synchronized on a external event using mailboxes. The first task, T1, reads integer from keyboard, and record them to a vector. The second task, T2, transforms the integer numbers in binary and shows them. External events that are synchronized tasks is typing an integer.

This is what i made so far.

#include <iostream.h>
#include <conio.h>
int v[50], n, i;long sum;
void citire(){cout<<"dati numarul de elemente al vectorului:";cin>>n;
for(i=1;i<=n;i++){cout<<"introduceti elementele vectorului: ";

[Code] ....

I don't know how to use tasks, and the program doesn't convert from int to bin..

View 14 Replies


ADVERTISEMENT

C# :: DB Calls Via Tasks?

Jan 6, 2015

I have a multi-thred piece of code that should be fast. As I have to update a Database from time to time, I wonder if I do it in a prpoer manner with calls like this:

Task.Factory.StartNew(()=>update_execution_to_db(exec));

Those are my sporadic updates, my ongoing update have a queue and a dispatcher thread reading from the Q, I just don't want to use this overhead for the sporadic updates.

View 6 Replies View Related

C :: Routines Library For Numerical Tasks

Jan 13, 2014

I am looking for C-libraries that would do numerical tasks with special emphasis on numerical differentiation of arbitrary order, numerical integration (Monte Carlo etc.) and interpolation. I would be grateful if you can provide me with some resources. By the way I already have Numerical Recipes but would like to have another resource at hand.

View 11 Replies View Related

C++ :: Use Circular Linked List And Data Structures To Store Tasks

Mar 30, 2014

The program use a circular linked list and data structures to store the tasks.

- Every task should include a task name, a name for the person assigned to it, and the deadline for the task.
- Variables should be dynamic and their sizes should be determined at runtime based on the length of user input.
- You should implement the following functions (with appropriate arguments and return types) for your structure: add(), remove(), search(), and list().
- The add()function should add tasks alphabetically by task name. You do not need to implement any file operations.
- The search() function should be able search for a task by the task assignee name or the task name.
- The list() function should print records to the screen in the order they appear in the circular linked list.
- You should successfully deallocate all of the allocated memory before termination of your program.

View 4 Replies View Related

C# :: Event Into Array?

Feb 18, 2015

i need to change the text in multiple ComboBoxs. i could do it one by one, but i have about 11 i need to change. i feel like doing it one at a time is not efficient. i was wondering if i can put the comboboxs into an array so i can use a for loop to change them all with out writeing it out 11 times.

View 9 Replies View Related

C# :: How To Reuse Event

Apr 14, 2014

I am creating one c# project. In this project I have one mdi form and many child forms.

All the child forms contains one panel named as panel1.

Now when child form opens i use the following code in all child form all child forms' load event contains the following line.

this.WindowState = FormWindowState.Maximized;

and all child forms' resize event contains the following line.

panel1.Left = (this.ClientSize.Width - panel1.Width) / 2;
panel1.Top = (this.ClientSize.Height - panel1.Height) / 2;

so my question is if possible that the above code i write only once so i donot write this code in all the child forms load and resize event.

View 2 Replies View Related

C++ :: Connecting Event With A Key On Keyboard?

May 17, 2013

I am gonna make a simple game in c++. I need a way how to use a particular key on the keyboard ,when I hit the key certain function should be called.

For movement of cursor on screen I want to connect arrow keys.

View 4 Replies View Related

C# :: Filtering Strings That Get Sent On A Event

Feb 4, 2015

I am writing a application that receives Event messages from a network device the problem I have is that the device sends some message 5 times per tiggered event on two of the events I like to use the rest of the messages are fine I need to create code to filter out the other 4 last messages that get displayed in a textbox the 5 message are identical I have added a timestamp to the sting and noted they are always 1 second apart so the format would be somthing like this:

11:23:01 - x - y
11:23:02 - x - y
11:23:03 - x - y
11:23:04 - x - y
11:23:05 - x - y

What I would like to do something like this, always append the first message to the textbox but ignore or even change the 4 messages that follow 1 second apart from each other that contain - x - y if any other message appears it should still append the text box as well

so the result i would like for the 5 event message as above should end like this:

11:23:01 - x - y
11:23:02 - custome message / ingnore append to textbox
11:23:03 - custome message / ingnore append to textbox
11:23:04 - custome message / ingnore append to textbox
11:23:05 - custome message / ingnore append to textbox

View 8 Replies View Related

C# :: Calling Event From Another Form

Mar 11, 2015

I want to update a label from Form2. When I click on the button on Form 2, the textbox on Form2 should update the label on Form1 and take me to a certain website. What ever URL is typed into the textbox on Form2 is what website URL the label on Form1 will take me to. The label on Form1 can say something such as You can check out my website here!!! and when they click on the saying it takes me to their website.

View 2 Replies View Related

C# :: Passing Event As A Parameter

Nov 16, 2014

I want to create events and then, functions which are subscribed to the event can access information about the event. For example, in Class 2 below, I want it to be able to access things such as touch.position, etc. of class 1.

Class 1:

public delegate void TouchEventHandler (EventArgs e);
public event TouchEventHandler TouchBegan;
public Vector2 touchPosition;
void Update () {
if (Input.touchCount > 0) {

[Code] ...

Class 2:

void OnTouchBegan (EventArgs e) {
Debug.Log ("Ran");
}

View 5 Replies View Related

C# :: WPF Background Changed Event?

Dec 5, 2014

I'm still at the very beginning of learning WPF and there are still countless things i don't fully understand. For instance, as I can see in my WPF project, there isn't an event that would fire when the Background property of some control is changed. Or am I just missing it? If i'm not blind after all, and it really doesn't exist, is there any way i could get notified when the Background color of some control is changed?

View 5 Replies View Related

C# :: Find Event For Combobox When Its Selected Value Changes

Jan 28, 2015

I'm trying to find an event for the combobox when its selected value changes , but I can't seem to find the right one since I've tried several events in the dataGridView that are just triggering at the wrong moments. I need to remove the selected item from that combobox so that it doesn't get selected again at the second combobox which usually have the same items .

View 5 Replies View Related

C# :: Unable To Send Event Successfully

Jan 12, 2015

In my MainWindow I have a UserControl called CamAccessLevel1. This will be one of a few different UserControls which will have more and more functionality to a device as the Level goes up.

Each of those functionalities are themselves a UserControl, so that I don't have to keep remaking them for each different "Level" that I make.

So... I have a UserControl in a UserControl in my Mainwindow. My first goal is to have a button in one of those sections send an event back to the MainWindow to close the application. This sections is called "ProgramControl", as it has functions that relate to the program itself.

I can't seem to set a datacontext within another datacontext -> There is an error in UIViewModel below...

Note that I have replaced my company name with [snip]

In my Mainwindow.xaml
<views:CamAccessLevel1 x:Name="UserInterface"/>
Mainwindow.xaml.cs
public partial class MainWindow : Window {
#region MyModel

[code]....

View 10 Replies View Related

C++ :: Two Way Event-driven Communication Between Objects

Oct 26, 2013

I need to implement a two-way asynchronous communication between two objects, not using any IPC.

What I have now is a producer-consumer model where producer sends a number "88" to consumer at random intervals. Now, I need consumer to send a number "99" back to producer at a random intervals, this probably should be done in a separate thread.

I am using GNU on Linux, here is the compile line.

Code:

g++ -g -std=c++11 main.cpp -o main

Code:

#include<iostream>
#include<chrono>
#include<thread>
class IObject {
public:
virtual void fromApp(int i) = 0;
virtual int toApp(int& i) = 0;// ???

[code].....

View 8 Replies View Related

Visual C++ :: DLL And Write To Event Viewer

Dec 11, 2013

i want to write to event viewer

Code:
void EventLogCls::WriteError( char* msg) {
HANDLE hes = RegisterEventSource(0, appName);
if(hes) {
WORD dwEventType = EVENTLOG_ERROR_TYPE;
ReportEvent(hes, dwEventType, 0, 0, 0, 1, 0,(const char**)&msg , 0);
DeregisterEventSource(hes);
}
}

The error that i get is on the line of "ReportEvent"

error C2664: 'ReportEventW' : cannot convert parameter 8 from 'const char **' to 'LPCWSTR *'

what should be changed?

View 3 Replies View Related

C# :: Treeview Control In WPF Double Click Event

Jan 8, 2015

<TreeView Grid.Column="0" Margin="0,-15,0,15" Grid.ColumnSpan="1">
<TreeViewItem Header="Custom"/>
<TreeViewItem Header="All Conferences"/>
<TreeViewItem Header="Atlantic Coast Conference" MouseDoubleClick="TreeViewItem_MouseDoubleClick_1">
<TreeViewItem Header="Atlantic" MouseDoubleClick="TreeViewItem_MouseDoubleClick"/>
<TreeViewItem Header="Coastal"/>

[Code] ....

I am trying to do a LINQ Query by Double Clicking the child node. When I click on the parent node it brings up the correct data. But when I click on the child node it still brings up the data from the parent node. How do I get the child node to display the correct data?

View 2 Replies View Related

C# :: WPF Databound ListView Item Click Event?

Aug 27, 2014

I was using the same item click event on another listview, and it worked perfectly... I don't know why this is happening, but here's my problem:

When I double click on an item, and try to obtain its index in the listview, the items index always comes back as -1... Obviously -1 isn't an index, and I'm guessing that it is returning -1 because that item does not exist on the listview, but from what I'm seeing, it is impossible for the item not to be inside of the listview...

Here is the xaml for my listview:

<ListView x:Name="lstBookmarks" HorizontalAlignment="Left" Height="250" Margin="10,10,0,0" VerticalAlignment="Top" Width="327" ItemsSource="{Binding Bookmarks}">
<ListView.View>

[Code]....

When I uncomment the MessageBox, it shows -1... This is obviously not right lol. I have the same exact click event in another class, and I obtain the items index the same exact way.. The only difference between this listview and that one is that this listview is databound.. Is that the issue? If so, how does one overcome it?

View 6 Replies View Related

C# :: How To Call Event When User Clicks A Button

Mar 25, 2014

I have a application that has a tab control and I change the font and color on form load.

But now I need to switch the font and color when I user clicks a button event.

I have 8 of these events, each customized to set different tab font and color.

tabControl1_DrawItem
tabControl1_DrawItem2
tabControl1_DrawItem3

I just do not know how to make this happen.

View 7 Replies View Related

C# :: Handling Middle Mouse Click Event

Jan 17, 2015

I'm trying to create a program which can pan by keep clicking and move the mouse

1. First, I create a class that inherited from the UserControl Class

public partial class CanvasCtrl : UserControl
protected void OnMiddleMouseDown(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Middle) {

[Code] ....

2, Second, I create the void in that class too, and write the code to get it to catch the event

public void MainMouseAction() {
this.MouseClick += new MouseEventHandler(OnMiddleMouseDown);
}

It not work, how to solve this out ?

View 8 Replies View Related

Visual C++ :: Array Of Buttons - Click Event?

Oct 15, 2012

I have successfully compiled a code where I created an array of buttons. I have added a click event to it like this :

Code:
buttons[indexofhashis2]->Click += gcnew System::EventHandler(this, &Execute::GOBUT_Click);

I have a standard event like this

Code:
private: System::Void GOBUT_Click(System::Object^ sender, System::EventArgs^ e) {
int x;
x = sender->Location.X;
}

Returns error saying Location is not a member of Object^.

I'm trying to create an array of button (user/runtime created buttons) and get different interpretations of the click event depending of wich button is clicked.

For example, if we create buttons[0] I wish to get the 0 or something relevant into the GOBUT_Click event.

View 4 Replies View Related

C++ :: Program To Simulate Customers Lining Up To Buy Tickets For Some Event

Oct 17, 2013

Create a line class using a linked list that acts as a queue (first in, first out) both enqueue and dequeue. Complete the line class so that customers can be added or removed from the line. Implement the line as a linked list of customer objects that you have developed yourself or use the vector class.

View 2 Replies View Related

C# :: Sudoku Solver / Generator - Text Box Change Event

Feb 25, 2014

I am creating a sudoku solver/generator. I have 81 text boxes on the form. I want the form to automatically clean up the input, eliminating alpha characters, and values under 1 or over 10. Anyways I have this method written, but I really don't want to go through and type up a change method for each text box. Is there to write a method that fires when ANY text box is changed, and gets the string value from the changed text box?

View 5 Replies View Related

C# :: Programmatically Install / Remove INF Driver Through Button Event

May 14, 2014

How to install/remove an INF driver though a button click event. So far I have some code for installing the driver, however it doesn't work.

private void installDriversToolStripMenuItem_Click(object sender, EventArgs e) {
if (SetupCopyOEMInf("./PS3MCADriver/PS3_Memory_Card_Adaptor.inf", null, 0, 0, null, 0, 0, null)) {
foreach (string device in devices) {
UpdateDriverForPlugAndPlayDevices(IntPtr.Zero, device, "./PS3MCADriver/PS3_Memory_Card_Adaptor.inf", 0, false);

[Code] .....

View 14 Replies View Related

C# :: How To Link Data To A Report Viewer On Specific Event

Jan 31, 2015

I created a dataset that contains an empty dataTable that has several columns , and then I created a new report that is linked to this datatable using the report wizard. In my form there is a button when clicked should fill the datatable mentioned above ( I checked if it is being filled by displaying its content in a dataGridView and by firing a messagebox that is triggered when 'datatable.rows.count > 0' ).

The reason that the datatable is initially empty is that it depends on some conditions that may alter the query used to fill it.

But finally when I load the form that has the report viewer it only has the names of the columns of the datatable and no contents. What's wrong ?

View 5 Replies View Related

Visual C++ :: Long Time Button Pressed Event - MFC

Feb 2, 2015

I Like to Open a Dialog When the Button Was Pressed for 5 seconds Continuously.

I'm using Windows 8 HP Tablet, Is MouseUp & MouseDown events suitable for this requirement.

View 12 Replies View Related

C :: Detect CPU Power Button Press Event In Console Application

Feb 5, 2015

I am using Windows 7 32bit OS and want to detect the CPU power button press event in my console application developing in C language.

I configured the power button setting to "Do Nothing" which is in "Choose what the power button does" options in Control Panel->Hardware and Sound->Power Options. So now i want to detect this power button press event and do some processing in my application then i will initate shut down from application itself. Looking for windows API details which will detect the power button press event.

View 2 Replies View Related







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