|
Dear all.
I am using kinect SDK2.0. Kinect sensor 2.0; visual studio 2012 & openCV 2.4.10 installed in my system.\
I am new to this kinect platform.I am looking for c++ code test some simple code. I have tested code with SDK2.0 . those are working fine. But i didnt find the code where they add images features resources . code to track object
I would like to detect object like in youtube video
<a href="https://www.youtube.com/watch?v=bSeFrPrqZ2A">object tracking using opencv</a>[<a href="https://www.youtube.com/watch?v=bSeFrPrqZ2A" target="_blank" title="New Window">^</a>]
|
|
|
|
|
Hi all,
i need to simulate mouse events using hooks.
I read the the msdn articles about hook and how they are used but I felt that they are complex!!
could any one help me or guide me on how to do the following:
- just send one mouse event to a window that is not mine. The window is a running application such as notepad, so I just need to send the right click for example to it!
thanks for any help 
|
|
|
|
|
Hooking is about capturing messages that are sent ot other applications. If you want to send a message then you just need to use the SendMessage function[^]. Although you will first need to get the handle to the Window via FindWindow[^].
|
|
|
|
|
Hi Richard,,
I used the SendMessage() function many and many times, what it did is only close the handled application!!
I used also, PostMessage() and it did the same!
I used sendInput() and there is no response at all..
that's why I went to hook..
otherwise If there is a reliable way I will not go to hooking at all..
could you help in this please,,
if you need some code i will post, but if you provide me with a reliable code that can really send the mouse event to the application without moving the cursor, I will be thankful for you really 
|
|
|
|
|
Omarkkk wrote: I used the SendMessage() function many and many times, what it did is only close the handled application Then you need to do some debugging to find out why, and what you are doing wrong. Sorry, I have no sample code for you, I have not actually used this feature for some time.
|
|
|
|
|
I did some debugging now,,
it says "unable to read memory" for the handled window!!
do you know why is that ??
thanks,
|
|
|
|
|
What says it, where, in your code, in the debugger, what are you trying to do at that point ... ?
|
|
|
|
|
hi Richard
switch (LOWORD(wParam)){
case 1:
HWND handle = FindWindow(NULL,TEXT("untitled - notepad"));
if (!handle){
::MessageBox (hwnd,TEXT("Window Not Found"),TEXT("Window Not Found"),MB_OK);
}
else
{
::SetActiveWindow(handle);
send message:
SendMessage(handle, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,NULL,NULL);
SendMessage(handle, MOUSEEVENTF_LEFTDOWN,NULL,NULL);
SendMessage(handle, MOUSEEVENTF_LEFTUP,NULL,NULL);
the "handle" is handling notepad application..
I checked the handling number using spy++ and it's the same which appears in the debugger which is 0x005e0656
the debugger says
- handle 0x005e0656 {unused=??? } HWND__ *
unused <Unable to read memory>
could you take a look on that please ..
thanks 
|
|
|
|
|
MOUSEEVENTF_MOVE is not a valid Windows message; you are just sending nonsense values.
The debugger message is just telling you that the Handle's value does not point to a valid portion of memory. This is expected since handles are arbitrary values used by the Windows OS.
|
|
|
|
|
do you have any idea of how we can solve this problem ??
|
|
|
|
|
You need to understand the use of all the windows messages which all have names beginning WM_ , and are documented in MSDN. The links I gave you earlier will lead you to some of them. You can also look at the SendInput function[^] which may make it easier to achieve what you want.
|
|
|
|
|
1) extract question.zip
2) runtime\debug
3) run sample.exe
4) click "button1"
program is crash
why crash? why crash?
DLL program is vc6.0 MFC extension dll
EXE program is VS2013 dialog base program
i wonder why terminate program.
please modify source dll or exe
I prefer to modify the source rather than the exe dll.
If there is no way
[question]
1) vs2013 Do Not use the extension dll created in vc6.0?
2) modify dll program?
3) modify exe program?
4) both modify? What do you need to fix?
download link
|
|
|
|
|
Sorry, this site does not provide a service like this. You need to use your debugger to identify where the crash occurs and why. You can then come back here with the details, and people will try to help you.
|
|
|
|
|
|
I'm not sure that this is anything to do with managed C++/CLI, however ...
If you have a problem with some code that you downloaded from the internet, then you need to go back and talk to the person or people who provided it. But something called workingbutcrap is not very inspiring. And if you have issues with an article here on CodeProject then you should use the forum at the end of the article.
|
|
|
|
|
Hi All,
I'm facing the following strange problem using MFC Grid Control (by Chris Maunder) in my VS2010 MFC application:
I've included the CGridCtrl control in a dialog in order to let the user to edit data. It works fine but sometime when I open the dialog the cells content is not displayed but it's covered by the cell background color.
Unfortunately I can't solve the problem because it only happens randomly. I tried to call Invalidate() to both the CGridCtrl control and the dialog but it doesn't solve.
Any help would be greatly appreciated.
Thanks in advance.
Gianni
|
|
|
|
|
Please do not post the same question in multiple forums.
|
|
|
|
|
I apologize but I realized that I posted the question in the wrong forum (Managed C++/CLI) and I could not find a way to remove it. Sorry.
|
|
|
|
|
hi all
Has someone got sample codes (including description) on how to create an Inputbox in C++?
Thanks in advance
|
|
|
|
|
I want to save the ASCII characters, in this case i started with the "☺" when someone press alt+1.
I dont know how to save that type of characters in the txt. What can i do?
Ive searched like a month about this, in all kind of forums, asking my teachers or people who knows and nobody can answer me this.
A possible solution was to make all again and use HOOK functions and some others like: WH_KEYBOARD_LL. Well... i dont know how to use any of that functions, so its a big problem.
PD: Im from Argentina, sorry for my bad english.
#include <windows.h>
#include <stdio.h>
#include <ctype.h>
#define VK_4 0x34
#define VK_1 0x31
void GhostKeylogger(FILE *txt);
byte teclas[256];
char teclasespeciales[32];
void GhostKeylogger(FILE *txt)
{
for(int i=0; i<255; i++){
if(GetAsyncKeyState(VK_CONTROL)&& GetAsyncKeyState(VK_MENU)&& GetAsyncKeyState(VK_4))
{
if(GetAsyncKeyState(VK_CONTROL)&& GetAsyncKeyState(VK_MENU)&& GetAsyncKeyState(VK_4))
{
fprintf(txt,"~"); break;
}}
if(GetAsyncKeyState(VK_MENU) && GetAsyncKeyState(VK_1))
{
fprintf(txt,"%c\t",0x01);
}
}
}
int main(){
FILE *txt;
while(TRUE){
if(txt != NULL){
FILE *txt = fopen("Experimento.txt", "a+");
Sleep(30);
GhostKeylogger(txt);
fclose(txt);
}
}
}
|
|
|
|
|
First of all if you want handle characters that are out of standard printable set, and could be filtered by text handling, open the file as binary:
FILE *txt = fopen("Experimento.txt", "ab+");
In this case you have to manually handle end of line adding "\r\n" at end of each line isteade of the simple "\n", but you are free to store the whole set untouched.
Anyway even using standard text file opening there could be a couple of issues that you have to deal with. Just to be sure that the correct code has been saved in the output file open it in a binary editor and verify that the code 0x01 has been stored in the file, if it is not there you can try to open the file in binary mode, as reported above, or you can use putc instead of fprintf:
putc(txt,0x01);
But if the file is correct and 0x01 is in but you cannot visualize it the problem is a different one, if you can't show it in a console window or in a text editor the problem is that the ascii code you expect is not in the codepage used on your system. In this case the things get somewhat harder...
|
|
|
|
|
Hi,
I am trying the display the transparent ".png" image on the button it is working fine if i have the proper resource file but the situation is like that i have to get the image from a file and Load it on the button how do i do it please any kindly help me.
|
|
|
|
|
Take a look at the GDI+ Bitmap class[^]. You can use it to load bitmaps from input streams created from various file types.
|
|
|
|
|
How do I add a window to this program?
#include "stdafx.h"
#define DEBUG
class CAnswers {
public:
vector<string> answer;
CAnswers(void);
CAnswers(string ans);
~CAnswers(void);
int size(void);
} Answers;
CAnswers::CAnswers(void) {
}
CAnswers::CAnswers(string ans) {
stringstream ss(ans);
string temp_answer;
while (getline(ss, temp_answer, ','))
answer.push_back(temp_answer);
}
CAnswers::~CAnswers(void){
}
int CAnswers::size(void) {
return answer.size();
}
class CQuestion {
string _question;
public:
CAnswers* answers;
CQuestion(void);
CQuestion(string q_a);
~CQuestion(void);
string question(void);
} Question;
CQuestion::CQuestion(void) {
}
CQuestion::CQuestion(string q_a) {
string ans;
stringstream ss(q_a);
getline(ss, _question, ':');
ss >> ans;
answers = new CAnswers(ans);
}
string CQuestion::question(void) {
return _question;
}
CQuestion::~CQuestion(void){
delete answers;
}
class CEditor {
vector<CQuestion> questions;
ofstream myFile;
int age, address;
char selection, character[1];
string name, response;
HANDLE np;
unsigned notepadID;
public:
CQuestion* q;
CEditor(void);
~CEditor(void);
int menu(void);
void question(void);
void reload(void);
int time(void);
static unsigned int __stdcall notepadThread(void* arg);
void notepad(void);
} Editor;
CEditor::~CEditor(void){
delete q;
}
CEditor::CEditor(void) {
np = 0;
}
unsigned int __stdcall CEditor::notepadThread(void* arg) {
system("notepad.exe AI.txt");
_endthreadex(0);
return 0;
}
void CEditor::notepad(void) {
_beginthreadex(NULL, 0, &CEditor::notepadThread, np, 0, ¬epadID);
}
int CEditor::menu(void) {
system("CLS");
cout << "Menu:\n9 = Basic Information.\n8 = DATALOG\n7 = Reload \n6 = Time\n0 = Leave\n";
cin >> selection;
switch (selection)
{
case '8': {
notepad();
break;
}
case '0': {
cout << "- Please close Notepad to exit - ";
return 0;
}
case '9': {
question();
break;
}
case '7': {
reload();
break;
}
case '6': {
do {
time();
cout << "Press Enter to exit";
Sleep(750);
} while (_getch() != '\n');
break;
}
default: {
cout << "Nope" << endl;
break;
}
}
return 1;
}
void CEditor::question(void) {
myFile.open("AI.txt", ios_base::app);
myFile << "\n----- new entry -----\n";
system("CLS");
cout << "AI: What is your name?" << endl;
cin >> name;
system("CLS");
myFile << "Datalog" << "\nName: " << name << endl;
cout << "AI: How are you feeling?" << endl << name << ": ";
cin >> response;
system("CLS");
if (response == character) {
cout << "Invalid answer";
}
myFile << name << " is feeling " << response << endl;
cout << "AI: What is your age " << name << "?" << endl << name << ": ";
cin >> age;
system("CLS");
myFile << name << "'s age is " << age;
myFile.close();
if (!myFile)
{
cout << "Error";
}
}
void CEditor::reload(void) {
system("CLS");
cout << "Reloading";
Sleep(1000);
cout << ".";
Sleep(1000);
cout << ".";
Sleep(1000);
cout << ".";
}
int CEditor::time(void) {
struct tm newtime;
char am_pm[] = "AM";
__time64_t long_time;
char timebuf[26];
errno_t err;
system("CLS");
_time64(&long_time);
err = _localtime64_s(&newtime, &long_time);
if (err)
{
printf("Invalid argument to _localtime64_s.");
exit(1);
}
if (newtime.tm_hour > 12) strcpy_s(am_pm, sizeof(am_pm), "PM");
if (newtime.tm_hour > 12) newtime.tm_hour -= 12; if (newtime.tm_hour == 0) newtime.tm_hour = 12;
err = asctime_s(timebuf, 26, &newtime);
if (err)
{
printf("Invalid argument to asctime_s.");
exit(1);
}
printf("%.19s %s\n", timebuf, am_pm);
return 1;
}
int _tmain(int argc, _TCHAR* argv[])
{
CEditor editor;
editor.q = new CQuestion("How are you?:Good,Bad");
cout << editor.q->question() << endl;
for (int i = 0; i<editor.q->answers->size(); ++i) {
cout << editor.q->answers->answer[i] << endl;
}
system("pause");
return 0;
}
|
|
|
|
|
Use one of the templates that comes with Visual Studio, or samples that come with the Windows SDK. And please use the correct forum, this one is for C++/CLI.
|
|
|
|