Visual C++ :: GetPixel Won't Pull From Java Programs?
Jun 4, 2013
I'm building a simple little program for minecraft to reduce the repetitiveness, I'm using getpixel, it's slow, but i only need to grab about 6-12 pixels.
but the problem is, I can get the pixel data if I capture from the entire desktop display, but as soon as I tell it to grab from the active window (wich goes MUCH faster) it doesn't return any colour value's.
I'd rather not have to use getDIBits or program in java or anything since I want to keep it fairly kiss, and if it can't be done, then.. ah well, I'll just grab from the entire desktop, speed isn't to much of an issue, but it'll be a pain to keep the window at the same place.
Code:
#include <Windows.h>
#include <iostream>
using namespace std;
// vvv Ignore this, it's just used for retrieving the handle of a window without giving the full window name vvvv
struct results {
[Code] ....
View 3 Replies
ADVERTISEMENT
Jul 8, 2014
See the push/pull of modeling in SketchUp, it is very convenient, I would like to achieve in my own programs, Is it possible?
View 2 Replies
View Related
Sep 26, 2012
I tried installing Java Accesss Bridge for a few hours now. But with no success. The installer from ORACLE does not work (rolls back at the end without error message). Many tries of patching some libs together failed.
What do I need for an application that makes use of JAB. Do I really need some sort of installation or can I simply put some headers and libs together?
View 9 Replies
View Related
Jan 24, 2014
I'm trying to set up some basic communication between two programs via the registry.
For this I would like to use the functions
Code:
int value=10;
CString strSection="Data";
CWinApp* pApp = AfxGetApp();
pApp->WriteProfileInt(strSection,ValueName,value);
and
Code:
CString strSection="Data";
CWinApp* pApp = AfxGetApp();
int value=pApp->GetProfileInt(strSection,ValueName,0);
which read/write to the application's registry.
Is there some way of making two different programs use the same application registry?
View 14 Replies
View Related
Mar 16, 2014
my goal:
have 1 program handle the UI
have that program store variables to a DLL
have the 2nd program grab the stored variables to reform some number crunching, without interfering with the UI program, and once done, have it drop the answers back into that DLL, so that the UI can grab it when it's ready.
I have made the 2 programs, + dll
What I've Achieved:
the first program accesses the dll, and loads up a variable (and stays connected to the dll, so that the Dll instance doesn't reset)
I've gotten the DLL to output the variable to make sure it's received it, and stored it to it's own global variable.
the second program connects to the dll successfully, but when it tries to retrieve the data, it returns 0's (NULL's)
My research:from what I've read, so long the dll is connected to a program, all additional programs will attach to the same instance.
how do I make the global variable in the dll be accessible to both programs? (without resorting to saving it to the HDD Idealy)
View 7 Replies
View Related
Nov 6, 2013
I think that the getpixel function (existed in sdl documentation) gets the color of the coordinate indicated by x and y
Uint32 getpixel(SDL_Surface *surface, int x, int y) {
int bpp = surface->format->BytesPerPixel;
/* Here p is the address to the pixel we want to retrieve */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
switch(bpp) {
[Code]...
my problem is that, I want to compare it with the white/black color ,so how can I do that?
I tried this way but it does not work
int main(int argc,char *argv[]) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Surface *screen = SDL_SetVideoMode(600,400,32,SDL_HWSURFACE|SDL_DOUBLEBUF);
SDL_Event event;
bool pass = true;
SDL_Color color = {0,0,0};/// Black color
if(color==getpixel(screen,0,0)
[Code]...
the error C:Documents and SettingsTechno01Bureausdlmain.cpp|83|error: no match for 'operator==' in 'color == getpixel(screen, 0, 0)'|
View 2 Replies
View Related
Oct 7, 2014
Like if the user enters "38 F" how do I take out the 38 only and store it in a variable? So far my program goes like this:
string text;
double temperature;
cout << "Enter temperature: ";
getline(cin, text); // user enters 38 F
temperature = text // store 38 from string into double
View 1 Replies
View Related
Jan 16, 2015
I have been poking around with some Java source code that I'd like to port to C++
Here is something I am trying to do
Code:
namespace AStar_NS { //...
class Node {
public:
Node() {
f = 0;
g = 0;
h = 0;
[code]....
Here I just want to compile the code pile and want to know what will be going on inside the debugger later on.The IDE didn't work that much. If I put AStar_NS::Node inside the TimeAStar_NS::Node's methods, the compiler will get confused. If I put TimeAStar_NS::Node there, the code also never compiles.
There are many types of nodes and transitions inside the Java code, so I can't even identify which is which inside the IDE even with IDE. There are many types of namespaces (as I create them to try to pull the code apart in order to comprehend them) And I can't reduce the compile errors down until 20 errors.
(The code is way too complicated, I can't even analyze it, I have to reply on the debugger) I want to know if Node inside the methods should be an instance of TimeAStar_NS::Node or AStar::Node or others. Should I create a more generic type of Nodes and Transitions above AStar_NS::Node and TimeAStar::Node. I know C++ and Java are quite different and difficult to port sometimes.
View 2 Replies
View Related
Jul 3, 2012
In my project I have commented all the available funtions in a systematic way. Following is the commenting system in my project:
''' --------------------------------------------------- ''' <summary>
''' ************************************************** ******* ''' FUNCTION:
''' VAR NBR:
''' ************************************************** ******* ''' </summary>
''' <VariableName> loadApp </VariableName>
''' <VariableDiscription> loads the Application </VariableDiscription>
''' <Author> Author Name </Author>
''' <LastModifiedOn> 01/09/2012 </LastModifiedOn>
[Code] .....
Now I would like to extract the data inside these comment tags and insert into excel sheet. Need to extract the comments in the xml tags shown in the able format? For example I want the value inside the <Autor> tag.
View 1 Replies
View Related
Sep 19, 2013
I am working on a project in a group at a university. We are creating a GUI in Java where the user can enter parameters. Then we want to be able to pass these parameters to a function inside our C/C++ program, that does the rest. How do I do this? So far I have managed to call a simple helloworld-function by using JNI, dll and a javah tool that create a header file from a java file. I define the helloworld-function in C and call it from Java.
Java file:
package helloworld;
public class HelloWorld {
private native void print();
public static void main(String[] args) {
[Code] ....
My problem is that I do not know how to call the helloworld-function with parameters. I guess that this is a special case when using JNI and a . dll. How do I pass simple char- and int-arguments from the Java class to the helloworld-C-function?
View 5 Replies
View Related
May 29, 2013
i want to call some java classes which are available from a cpp file.
View 1 Replies
View Related
Mar 14, 2014
I want to open a .xml layout in my Android project from a .cpp archive.
How can I do it?
View 2 Replies
View Related
Mar 8, 2014
Is there similar syntax in c++ that acts like and Object in java?
E.g. :
public void foo(Object someObject){
if(someObject instanceof someClass) {
}
}
View 6 Replies
View Related
Dec 24, 2014
We had few functions which were written in Java, and we are now moving to C# .Net.
Instead of re-writing the code in .net, I want to know if there is any possibility to use those functions in .Net as is. (calling java functions).
View 1 Replies
View Related
Dec 15, 2014
I'm trying to write a C program that will take a file that is delimited by colons and separate it out in to 5 sections:
0002:0003:0002:0080:<HTML>
0002:0004:0002:0080:<BODY>
I have the struct code in place but not sure how to actually store each of the 5 parts in memory. Here is the code below:
Code:
#include <stdio.h>
#include <stdlib.h>
#pragma warning(disable:4996)
struct contents
{
int source,destination,type,port;
char data[50];
};
[Code]....
View 3 Replies
View Related
Feb 9, 2014
How to pull system information and compare it's results with a predefined list.
I know the second part, how to pull system information. Like what CPU/GPU/Motherboard the system that the program is run on has.
View 11 Replies
View Related
Apr 8, 2013
I am trying to write a loop that will iterate through a char array in C and pull the IP addresses and test them to see if they respond. My ultimate goal is to have the first one that responds returned in the function, but the loop is not running correctly. It will run through right the first time, but then will start over again.
Code:
const char * getServer(char *svrList) {
char *srList;
srList = strtok(svrList, " ," );
printf("Contents of srList b4 loop: %s
", srList);
printf("Server List: %s
", svrList);
[Code] ....
Code output:
Contents of srList b4 loop: 1.1.1.1
Server List: 1.1.1.1
result is "1.1.1.1"
Hitting else loop
Contents of srList in else: 2.2.2.2
result is "2.2.2.2"
result is "2.2.2.2"
Contents of srList b4 loop: 1.1.1.1
Server List: 1.1.1.1
result is "1.1.1.1"
Hitting else loop
Contents of srList in else: (null)
View 14 Replies
View Related
Mar 23, 2013
I've copied and pasted my code. The main program, the calculateTaxes.cpp function code and my makefile. I am using the makefile to link these two codes together but I get an error when I type 'make' in the command line.
I receive the error code:
assign2c.cpp.text+0x169): undefined reference to 'calculateTaxes(float, float, float*, float*, float*)'
collect: ld returned 1 exit status
make: *** [main.exe] error 1
[Code]......
View 2 Replies
View Related
Oct 10, 2013
so here is a basic program i wrote i am thinking of writing a currency conversion program that does multiple conversions and i was thinking it is possible to do something like this couldnt i call them after i write them as functions
usdtoeuro()
usdtokuna()
how would i go about doing that? or can you point me to anything?
Code:
#include <stdio.h>
int main()
{
[Code].....
View 2 Replies
View Related
Jan 19, 2015
I have a mobile application for android coded in javascript and a windows form coded in c#. I want my mobile app to send some data to the c# program. It is fine if the transmission is not secure. I searched the net. I found a site called pastebin.com. Unfortunately it provides api for posting and reading data. However I want something, where I can store,read as well as EDIT the data.
View 7 Replies
View Related
Oct 18, 2014
I am trying to experiment with programs and databases. Right now I am trying to set up a database so that my program, which currently just appends its results onto a text file, will instead store each result into a database, because this will make things much easier to access than trying to read specific results from an ever-larger, disorganized text file.
View 2 Replies
View Related
Aug 27, 2013
I just installed eclipse cdt for linux but i dont know how to compile programs on this IDE
View 3 Replies
View Related
Feb 3, 2014
I am just starting out learning C and I am using MinGW, Widnows 7, and cmd.exe.I am starting from scratch and learning very short and simple programs, like 20 lines long.After I use MinGW (gcc) to compile, the programs start up rather slowly, sometimes up to about 3-5 seconds. One with a big nested loop even took about 15 seconds to load. After they run once, the next time they run, it's instant.
Last time I learned from this book, I don't remember them starting so slowly. I use the command "gcc sample.c -o sample".It just concerns me that these tiny little programs are starting up so slowly. I'm scared it's a problem with my computer or MinGW installation. When I start making more advanced programs, I don't want them running slower than they ought to be.
View 12 Replies
View Related
Apr 12, 2013
I find type casting to be very hard to grasp, I am not sure why. I understand how it works I suppose, but I find it hard to grasp why it would be needed in programming. So my question is, how often is type casting used in general programs? Is there an easier way I could be trying to teach myself about it? I am just using the tutorials provided by this site.
View 2 Replies
View Related
Apr 30, 2014
This is a problem I have been having with every program I write since I started using SDL 2. Whenever I compile my code and run my program, everything works perfectly fine until at some point (usually after 3-8 minutes of running), the program will stop responding completely and I will have to exit out of the console to close it. The code I believe is relevant is:
void MainLoop()
{
InitLoop();
while ( !QuitMain )
[Code].....
If I change SDL_PollEvent(&Event) to SDL_WaitEventTimeout(&Event,100), then the problem goes away (I did that and had the program running for about an hour without it stop responding before I decided that it solved the problem), so I believe that the problem has something to do with event handling. Also, it might be noteworthy to mention that when I use SDL_WaitEventTimeout with the second parameter being a small number (because 100 milliseconds is a long time to wait and makes the program run at like 8 FPS), the problem returns.
View 2 Replies
View Related
May 26, 2013
I have learned the basics you need to know about c++ so I was wondering, how do you make a GUI from scratch without using any programs like qt, daniweb, ect. Is there like a ongui() or something?
View 6 Replies
View Related