|
Hi.
How I can get listview subitem text of a listview on another process?
I want to get listview subitem text of a listview on another process using Windows API. I already have the listview handle and hooked to it.
Can someone help me?
Thx in advance.
Best Regards,
Marco Alves.
|
|
|
|
|
You have to alloc memory in the other process with VirtualAlloc (OpenProcess etc) and use the allocated memory with LVM_GETITEM, then retrieve back the memory into your process. There are probably a couple of samples on internet, but prepare yourself, is not so easy.
|
|
|
|
|
#pragma once
#include <vector>
#include <string>
#define MAX_LINES 100
#define MAX_FILENAME_LENGTH 100
#define MAX_SENTENCE_LENGTH 1000
#define MAX_WORD_LENGTH 25
using std::string;
class CSentenceList
{
public:
//Methods
CSentenceList(char strFileToRead[MAX_SENTENCE_LENGTH + 1], const bool bSorted = false);
virtual ~CSentenceList(void);
void sort();
unsigned int search(const string* strSearch);
string display(unsigned int iLineNumber = 1);
//Properties
unsigned int Size;
vector <string> Sentences; //ERROR
private:
//Methods
bool readFile(const char strFileToRead[MAX_SENTENCE_LENGTH + 1]);
};
Error:
c:\Documents and Settings\Jon\My Documents\Visual Studio Projects\IAD Practice and Assignment\C++ - Assignment\02 & 03 - Sentence\SentenceClass\SentenceList.h(25): error C2143: syntax error : missing ';' before '<'
I'm not sure what is causing this error because the syntax seems good...?
Jon
|
|
|
|
|
might try adding a "using std::vector;" line.
|
|
|
|
|
Add
using std;
or use
std::vector <string> Sentances;
Best,
Jun
|
|
|
|
|
Just an FYI: Do not put using directives in header files. While it may seem harmless it can cause name conflicts when you start writing production code. Use fully qualified namespace names in your header files:
#pragma once
#include <vector>
#include <string>
class CSentenceList
{
public:
CSentenceList(const std::string& strFileToRead, const bool bSorted = false);
CSentenceList(const std::vector<char>& strFileToRead, const bool bSorted = false);
~CSentenceList();
void sort();
unsigned int search(const string& strSearch);
std::string display(unsigned int iLineNumber = 1);
private:
unsigned int _Size;
std::vector<std::string> _Sentences;
bool readFile(const std::string& strFileToRead);
};
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Good advice but it sould be qualified: do not put using directives in header files at global scope. For example the following is fine in a header file:
class CMyClass
{
void Function()
{
using namespace std;
}
};
Steve
|
|
|
|
|
Good point. I tend not to do that out of habit, but it is acceptable.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
hi,
i have a process id and a handle to a process. how can i get the
PROCESS_INFORMATION that i would get from CreateProcess(); (after it has been created)?
or, how can i get a handle to the main thread of the process?
thanks in advance
-- modified at 14:21 Monday 28th August, 2006
|
|
|
|
|
Interesting.
check out msdn
CreateToolhelp32Snapshot
Thread32First
Kuphryn
|
|
|
|
|
Sam Kline wrote: how can i get the
PROCESS_INFORMATION that i would get from CreateProcess();
Using Process32First() will give you a PROCESSENTRY32 structure. Does it have the information you require?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I looked up the function that kuphryn gave on MSDN and those 2 functions do what I neeed.
Thanks for the replies.
|
|
|
|
|
Thread32First() provided you with process-related information?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I would like to know whether the same Edit Control can handle two types of notification messages, like my requirement is
i have an edit control in my dialog box which takes the ID of an voucher, now i have to fill this edit control by two ways
1st> is to manually enter the Voucher ID and press ENTER key (in the keyboard) for the Validation to take place, for this i can handle PreTranslateMessage, VK_RETURN .
2nd> is to scan the Voucher with the Barcode Reader, after scanning, my edit control is populated with the Voucher ID and the validation should happen without entering any Key or doing any action, for this case i can handle ON_EN_CHANGE .
my problem is in the 1st case when i enter the 12 digit voucher ID (remember i did not press the ENTER key), the validation is done, since i am also handling the ON_EN_CHANGE message for supporting the 2nd case.
how to handle both these cases for the same EDIT control??
thanx in advance
kumar_windows
|
|
|
|
|
You are putting operations in an edit control that don't belong there. Validation of the VoucherID should be isolated from any edit control. This way you can validate the data when scanned then put it in the edit control.
led mike
|
|
|
|
|
hi mike thnkx, pls tell me whether i can handle 2 different messages for the same edit control
thanx in advance
kumar_windows
|
|
|
|
|
kumar_windows wrote: pls tell me whether i can handle 2 different messages for the same edit control
fine... yes you can
led mike
|
|
|
|
|
Handling the ON_EN_CHANGE notification is the way I'd handle this. In the handler function, don't enable the OK button if an invalid voucher has been entered/scanned into the edit control.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Greetings,
Is it possible to draw on a CRichEditCtrl on my FormView? For example, on a regular view I just get a handle to the device context (i.e. pDC), then do whatever I want with it (i.e. pDC->Rectangle...etc...). How do I draw and place text on a RichEditCtrl at the same time?
Thanks in advance for your help.
BP
|
|
|
|
|
What is it exactly that you are wanting to draw on a rich edit control?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I would like to be able to place bitmaps on it and also use GDI capabilities (i.e. drawing shapes, choosing fill colors, placing custom graphics in it, etc...)
|
|
|
|
|
This is just a guess but I'd think you'd have to embed those items in the rich text data.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
|
Is there any API to block IP’s from connecting to the server?
Problem details
I have developed client/server application. For security it is Username/password protected. To prevent or “minimize” brute force attacks and Denial Of Service it check for failed logins and logs IP from failed attempts for x min, if 3 failed attempts are reached in the x minutes it blocks the IP for y minutes.
It uses a global linked list to log the IPs and this is where the problem is. The global List is like a bottleneck since it is shared among other threads.
First: To minimize code execution is there any way to block the IP in the operating system level to minimize code execution since if the attacking IP is allowed to re-connect to the server again it can easily cause a DOS.
Second: I could only come up with a globally linked list to hold the IP is there any better way to do this.
Thanks for any help
G_S
|
|
|
|