C :: Detect XBOX 360 Controller In A Port But Getting Error

Dec 29, 2013

I am trying to have a program that I am writing detect a controller and then say whether there is or is not one connected. But I am getting a lot of errors(25 actually) . Here is my code:

Code:
#include <stdio.h>
#include <Xinput.h>
#include <stdbool.h>
#include <Windows.h>
void main()

[Code] ....

puts("Error no controller was found on any port");
return 0;
}

View 3 Replies


ADVERTISEMENT

Visual C++ :: Program To Map Keyboard And Mouse To Xbox 360 Controller With Win32 And Xinput?

Aug 10, 2013

I am writing a program to map keyboard and mouse to an xbox 360 controller with win32 and xinput. I have everything going fine but when im trying to control the mouse with the thumbsticks I get problems with the movement if my program has the focus it moves fine but when I put another window in focus the movement is over sensitive here is the code I am using

Code:
if(_controllerState.Gamepad.sThumbRX >= XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE) {
GetCursorPos(&mousepos);
profile->Buttons[6]->input.type = INPUT_MOUSE;

[Code] .....

I have tried everything to fix it.

View 1 Replies View Related

C++ :: Detect If Xbox 360 Guide Button On PC Is Held Down

Feb 18, 2014

I made this (found the trick on the net)that allow to use the guide button of a 360 pad. I use wxdevc++.

#include <windows.h>
#include <stdio.h>
static const int guide_button_value = 0x0400;
/* the secret function outputs a different struct than the official GetState. */
typedef struct {
unsigned long eventCount;

[Code] .....

But I wanted to detect if it's held down for 3 second before do my printf

The usual solution is to detect if the button is pressed and if it's realeased but I can't use ximputgetstate or regular getstate (or I haven't successfully done it) .

View 2 Replies View Related

Visual C++ :: Character Controller - Getting Error When Adding Pointer

Sep 29, 2012

I was trying to write a character controller but when I went to add my pointer to my character I get error

C2143: syntax error : missing ';' before '*'

I've looked at all my classes involved but I don't see any errors and Visual Studio doesn't report any other specific errors. Is there any way of finding the source of this type of error?

View 4 Replies View Related

C/C++ :: GCC Compiler Does Not Detect Multiple Definition Error

Oct 31, 2012

I am trying to compile the files file1.c and file2.c using Mingw (gcc)

/////////////////////
header.h
////////////////////
#ifndef header
#define header  
int variable;  
#endif

[Code] ....

I would have expected a multiple defnition error when linking the two .c files. as in both the files, with the 'int variable' command, the variable 'variable' is defined (memory allocated) and during linking the linker doesnot know which variable to link to.

I get an error though when i use "int variable =123;" in the header file instead of the "int variable;" statement. i dont understand as in both the cases the variable is defined (memory is allocated) and the linker should give a multiple definition error.

View 8 Replies View Related

C :: For Loop Controller Using Pointers?

Jan 3, 2015

I'm familiar with the concept of int in the for loop. However, I've seen a case where the condition for the for loop is a pointer. How is the pointer used or interpreted in the for loop condition in C or C++.

As an example:

Code:
void printer(char *fmt, ...) {
va_list args;
char *p, *sval;
int ival;
double dval;
va_start(args, fmt);
for(p = fmt; *p; p++) {
if(*p != '%') {
putchar(*p);
continue;

[Code]....

View 3 Replies View Related

C# :: Changing IP Address On Controller LED

Jul 2, 2014

I have a C-Power5200 driver. I want using the C# language change to the controller's IP address.

Here a link to the website and API.C-POWER 5200

In Annex API controller.

View 7 Replies View Related

C# :: Download Data From Memory Controller

Jul 11, 2014

Using the C # programming language LED controller through which controls the array is connected to the controller via the RJ45 port. I already know the basics, I mean specifics, ie

Using the instructions and DLL included with the hardware, I want to read data from it, but I can not deal with it.

Model controller is "C-Power5200" and dll is "CP5200.dll".

I would like to:-pick the data-display-edit and - save in the controller.

To read the data I am using the function

CP5200_Net_Read (BYTE * pBuf, int nSize);

and to save

CP5200_Net_Write (const BYTE * pBuf, int nLength);

View 2 Replies View Related

C++ :: Arduino Robot - Virtual Controller And Path Map

Jul 14, 2014

I know how to create your basic programm that compiles as a CLI or exports and/or saves data to a .txt file... But how does one build a GUI?

I ask because I am currently working on a programm for my Arduino controlled robot, in which I want to have a virtual on screen controller next to a map of my bots path.

View 4 Replies View Related

C++ :: Embedded Micro Controller - Pointer To Class Member

Sep 19, 2014

This project is for an embedded micro controller. In the project i wrote a class that generically services uarts. then i declare 6 objects of that class and hand them configurations for each specific uart.

internally all the objects have a send buffer of data that is still to be sent that gets populated by the object member function.

how can i make an array of function pointers that can point to the same member but of six different objects.

for example (not a working one)

class uart {
private:
struct myData {
unsigned char data[20]
int head
int tail
int count;

[Code] ....

View 9 Replies View Related

C# :: How To Manually Control The Temperature Of High Power Leds Using PID Controller

Mar 20, 2015

how to manually control the temperature of High Power Leds using PID controller. I have two GUIs,one reads the temperature from the Led while the second is used to ON/OFF the Leds and at the same time controls the Led brightness using slider control.The GUI that reads the temperature has a PID controller application on it.The output from this controller is what i want to use to increase or decrease the Led brightness which invariable changes the Led temperature.How to go about using this PID controller to control the Led brightness is what i have not been able to grasp well.The slider on the GUI is scaled from 0% to 100%.My thinking is that the output from the controller should be in percentage which will make me to adjust the slider accordingly.My question is that will this type of arrangment produce an output that will efficiently control the Led brightness. how to accomplish that. Attached to this post is a modified code of a tutorial on PID controller which i found on the net. a tutorial on how to develop a graph. i wish to display the Setpoint,Process value and the output value on a graph.

View 2 Replies View Related

C++ :: SDL Won't Detect Debugger

Sep 2, 2013

Current compiler doesn't have correctly defined debugger!

ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.

Create new parser for project 'Test'

Project 'Test' parsing stage done!

View 4 Replies View Related

C :: How To Define The Lock Detect

Feb 24, 2013

It is my first time in use lock detect so i didn't now how to start.

how to define the lock detect?

View 4 Replies View Related

C :: Detect Mouse Movement

Aug 17, 2013

i was trying to write a program in c language which can detect mouse movement, but the program which i have written can only detect the mouse click or scroll the program which i have written given below..

Code:

#include<stdio.h>
#include<string.h>
#include <ncurses.h>
int main() {
}

[code]....

run the programme with linked-lncurses. improve my program which also detect when the mouse moves.

View 1 Replies View Related

C++ :: Using Gdb To Detect Segmentation Fault In Sh?

Jan 16, 2015

I am using scientific linux. In the directory user/project/Build, after I ran 'make' to compile and link all the cpp files,I had no problems. But then, when I went to directory user/run/run.sh, which runs the project binary in user/project/Build/bin/project, I get a segmentation fault error. In the directory user/run, I enter 'gdb' in the command prompt and get the message "*** No targets specified and no makefile found. Stop." What am I supposed to do to detect the segmentation fault?

View 2 Replies View Related

C++ :: Detect If A Letter Key Is Pressed?

May 11, 2014

How would I detect if any letter key is pressed. Would I have to use GetAsyncKeyState() for every letter key? Or could I have some kind of loop going through all the hexadecimal values for every letter? I don't know how I would go through hexadecimal values with a loop.

View 6 Replies View Related

C++ :: How To Detect Memory Leaks

Mar 16, 2015

i build an application, that makes the used memory growing. i don't get any error(unless, i believe, that i use some memory value(i don't know the value), but i see the memory growing very slowly. how can i detect the memory leak?

View 4 Replies View Related

C++ :: How To Detect And Change Word Endings

Jul 2, 2013

Is it possible to create a programme which would detect and change word endings? I would like to write a simple verb conjugator, i.e.:

If you enter a word ending with AAA then I would like the programme to show, say, six modified words:

Word with the replaced ending, for example QWERTYAAA changes into QWERTYBBBQWERTYAAA changes into QWERTYCCCQWERTYAAA changes into QWERTYDDD etc.

Is it possible to do it? If so, how?

View 9 Replies View Related

C :: Function To Detect Subsequence String

May 1, 2013

So I need to write a function that has 2 arguments that are strings. It returns 1 if the first string is a subsequence of the second string, and 0 otherwise.

For example, given 2 strings like "foobar" and "obr", the function should returns 1 whereas "foobar" and "obo" returns 0.I have tried writing the code myself,

Code:
int sub(char *s, char *t) {
int i;
char *p;
for (i=0; t[i] != ''; i++) {
p=strchr(s,t[i]);
if (p==NULL)
return 0;
else
strcpy(s,p);
}
return 1;
}

So my strategy is as follows:
1. Find the first letter of the second string in the first string (foobar).
2. If there's a match then continue to search for the second letter of the second string starting from the index of the first letter plus 1. (obar). Otherwise return 0,.........

However the function always return 1 no matter what the input strings are.

View 11 Replies View Related

C# :: Detect And Disable Network Cards

May 23, 2012

I have an application in c# that i don't want it to connect to the internet in a virtual environment, like virtualbox, vmware virtual pc and so on. Therefore i though that disabling the virtual network card inside the virtual machine would be a good idea.

View 3 Replies View Related

C :: Detect CPU Usage And Free RAM On Windows X86 In C?

Feb 20, 2015

I don't use Visual Studio and/or C++ so I would like to do it without them. I found this article c++ - How to determine CPU and memory consumption from inside a process? - Stack Overflow

I tried some lines of code but no one works for me.

Code:

#include "windows.h"
typedef struct _MEMORYSTATUSEX {
DWORD dwLength;

[Code]....

These was just my first tries to work with da MEMORYSTATUSEX.

I would like to find out if there is free memory at least ... (some value) and similar.

View 1 Replies View Related

C++ :: Detect Colors In The Black Rectangle?

Oct 5, 2013

I want to detect colors that in the black rectangle. [URL] How can I do? What library should I use?

View 7 Replies View Related

C Sharp :: How To Detect Whenever Down Arrow Key Is Pressed

Jun 3, 2012

So, I've been working on a project recently, and the only thing remaining to do is a detector to whenever down arrow key is pressed. The down arrow key can only trigger when a certain check box is checked and this will have to work with a timer either. The problem is that how to make the down arrow key press detector(I've got the check box and timer ready tho).

View 10 Replies View Related

C++ :: Detect Arrow Key Press For Linux Only

May 13, 2012

I'm trying to implement this on ubuntu, to compile and run only under ubuntu.

I found 100s of other attempts at answering the general question of arrow key press in c++. Nothing solid.

Some recommend using the Readline for the functionality I am trying to implement, but I need to stay clear of GNU licences if I can for this project. And some tips only work on projects for windows machines... for example the conio library.

For linux there may be the option of using the ncurses library which I will take a look at, but I am stubborn and want to implement this myself. It should be an easy straight forward thing to do, which is why I am a bit frustrated at the moment.

Here is my test code so far.

#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
using namespace std;
int main(void) {
char a;
stringstream ss;
string s;

[Code] ....

So! This works... 80% of the problem is solved. If you compile this, g++ under linux, ubuntu in my case, and run. Each keystroke reveals the correct key numbers.

q=113
w=119

when I click on the up key I get,

up = 279165

I thought, I can use this number is a if(int == '279165') to detect the up key.

I was not so lucky... this int is not behaving like an int!

So I modified the code to see it I could carry out an int operation on this number.

I added a 100000 to int i.

cout<< i + 100000;

Code:
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
using namespace std;
int main(void) {
char a;
stringstream ss;
string s;

[Code] .....

Compiling and running this, and pressing the UP key gives the following number.

100027100091100065

Some some sort of array, something like, [27][91][65].

I tried all ways to access these individual numbers, actually the third one for comparison purposes, but no luck.

For completeness sake I list the other arrows.

UP = [27][91][65]
DOWN = [27][91][66]
LEFT = [27][91][68]
RIGHT = [27][91][67]

A little further digging shows that these numbers are derived from the representation of a "multi-char" constant, the data type given when pressing special characters...

Now here is the main problem I have, I can find ANY decent documentation on how to handle and play with "multi-char" .

View 4 Replies View Related

C++ :: Detect Mouse Position - Square Shape

Jul 16, 2013

I am trying to detect when my mouse is over a item. I can get it working if its a square shape an stuff.

(LOWORD(lParam) > 133) && (LOWORD(lParam) < 154) && (HIWORD(lParam) > 0) && (HIWORD(lParam) < 21)

but how would i detect if its over the white spot in this image? [URL] ....

i just drew a simple shape i need to detect from more edges but how to do it?.

View 7 Replies View Related

Visual C++ :: How To Detect Multicast Group Address

Nov 13, 2013

I have a problem with UDP Multicast. I managed to send UDP Multicast telegrams and receive them. But when I receive the telegram I need to find out to which multicast group address it was sent. So far I have:

Code:
recvfrom( hSocket,
pcData,
nMaxDataLen,
0,
(SOCKADDR*) &from,
&len);

When I read from.sin_addr.S_un.S_addr; then I get the original IP Adresse from the sender PC but I also would like to know to which group address it was sent. Is there a way to get this infoamtion?

View 3 Replies View Related







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