|
That's because you are storing CPumpInfo objects not CPumpInfo* objects. Store pointers instead and it'll work.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Geeez... thanks. Why didnt I think of that! It works now.
-C
|
|
|
|
|
CList is a template class and we can't see what parameters you are using when you instantiate it. Please repost the code making sure you check "Do not treat <'s as HTML tags" option.
You are most likely storing/retrieving copies of the elements (by value) instead of pointers or references. If that is the case, GetNext() is giving you a copy of what it's in the list, so any change you do on it has no effect on what it's in the list.
--
jlr
<a href = "http://jlamas.blogspot.com/" rel="nofollow">http://jlamas.blogspot.com/</a>[<a href = "http://jlamas.blogspot.com/" target = "_blank" rel="nofollow">^</a>]
|
|
|
|
|
I'm not sure if std::string supports the [] operator, but if it does:
if (savedpass[0] == x && savedpass[1] == y && savedpass[2] == z)
... What about:
char enteredpass[4] = {0};
enteredpass[0] = getch();
enteredpass[1] = getch();
enteredpass[2] = getch();
if (savedpass == enteredpass)
...
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Is this possible?
I want to create a separate "Find Text" program that will access, read, and control a Rich Edit Control in another application.
Basically what i've figured out so far is that if i somehow get the handle to the control in another application (MS Enterprise Manager), I can send messages such as EM_FINDTEXT, EM_GETSELTEXT, and EM_SETTEXTEX to it. And then i'm assuming that it will react to these messages.
I do know that I can get the handle to the window application, but can i get the handle to the controls within it?
|
|
|
|
|
c121hains wrote:
I do know that I can get the handle to the window application, but can i get the handle to the controls within it?
Sure. See FindWindowEx() for this.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
"The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window."
..it searches child windows. But i'm looking for controls within a child window. Is it possible to access the controls within a child window of another application?
If so, how?
|
|
|
|
|
|
With the exception of the desktop, all windows are a child window. So if you already have a handle to the window of interest, you can use FindWindowEx() like:
FindWindowEx(hWnd, NULL, class_name, NULL); You can find out what goes in place of class_name by using Spy++. Just open up the window having the control you want to meddle with and use Spy++ to get the control's class name.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
c121hains wrote:
But i'm looking for controls within a child window
those controls are child windows (of the child window). I haven't used it for a while, but IIRC, you use FindWindowEx(), sending in a null as it's parent window. Find the child this time using it's parent window as one of the arguments, then find a child of that window (the controls you're talking about) by sending in it's parent as one of the arguments. get it?
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
ahh i see! ok Thanks.
I used a program called WinDowse and when i place the cursor over the (what looks like a Rich Edit box) turns out to have the class name "DimensionEdit"!
Another control used in MS Enterprise Manager is "DimensionDataCtrl".
If i want to send any messages to these controls (child windows), I have to know what messages they are listening to. So far i can't find any information on DimensionEdit class. Could they have created their own class by inheriting a rich edit box?
|
|
|
|
|
The class that i want (DimensionEdit) is within a class called "#32770" and that itself is within a "#32770" which lies within the base "MMCMainFrame" window.
Everytime I run
HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "#32770", NULL);
It fails to bring up the correct handle! Entering in the description of the window doesn't work either.
Please help!
|
|
|
|
|
c121hains wrote:
The class that i want (DimensionEdit) is within a class called "#32770"...
This is the standard dialog box class.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
So.. are you saying that this would work:
HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL);
..but in Spy++, the name of the class is #32770. If it's a dialog class, how come the order of window controls is:
- DimensionEdit
- #32770
- #32770
- MMCEnterprise Manager Main Window
When i'm looking at it, it is
- Some edit box within a tab order control within a dialog box window all within the main Enterprise Manager window. (
|
|
|
|
|
c121hains wrote:
HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL);
Don't confuse C++ classes with window classes (those registered with RegisterClass() ).
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I managed to finally get it working. I had to first grab the handle to the desktop and use GetNextWindow through about 200+ handles to get the one matching the partial window text that i was looking for. The dialog's window text that i wanted contained static and dynamic text. That was why i couldn't just find the window with just he window's text.
Thanks for the help!
|
|
|
|
|
Once you had the handle to the dialog itself, couldn't you then have used GetDlgItem() to get the handle to the control without having to enumerate through each control on the dialog?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I didn't need to. I know the class name in the dialog that i need. The problem was getting the handle to the dialog itself. I had to enumerate through the all handles at the sub desktop level.
|
|
|
|
|
I am trying to ead data from a text file using fscanf, but everytime the program reaches the fscanf line it comes up with First-chance exception at 0x77f62992...: Access violation reading location...
If anyone can help please let me know. If you need the exact program lines let me know and I will post them.
simaneal
|
|
|
|
|
simaneal wrote:
If anyone can help please let me know.
I'm having difficulties seeing your monitor from here. Can you show us what your code looks like?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
It's usuallly a mismatch between the formatting string and the paramters since there are no checks on these.
As David mentioned, including the line of code in your message would help.
Elaine
The tigress is here
|
|
|
|
|
Here is the section of my code with the fscanf that is giving me the problem. It is part of a fuction called from the main program. The program will print starting scan and then it comes up with the exception.
int yinitial;
printf("starting npv in npvpixel");
FILE* agefile;
printf("agefile set");
int inita=0;
int inage;
int list[118];
int time1;
int zc=0;
printf("initialized in npvpixel");
/*if ((inage = (short int*)malloc(array_size * sizeof(short int))) == NULL) {
(void)printf("ERROR: Malloc failed");
(void)exit(EXIT_FAILURE); */ /* or return EXIT_FAILURE; */
/*}*/
printf("malloc ok");
/*inage= (int*)malloc(ycoor*sizeof(int));*/
time1=0;
float npv1a=0.0;
for(zc=1; zc<21;zc++)
{
printf("opening file");
if (zc==1){
if ((agefile=fopen("c:\\stinit.txt","r"))==NULL){
printf("can not open initial file");
}
else{
printf("initial age file open");
/* Set pointer to beginning of file: */
fseek( agefile, 0L, SEEK_SET );
printf("start of file found");
for (yinitial=0; yinitial
|
|
|
|
|
simaneal wrote:
inita = fscanf( agefile," %d", &inita );
This looks odd. If you even need it, you should store the return value from fscanf() in a separate variable.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
sorry,
I have tried all kinds of things to work.
That line should be
fscanf( agefile," %d", &inita );
The file for the data is opened as agefile and the data should be stored in &inita.
simaneal
|
|
|
|
|
simaneal wrote:
fscanf( agefile," %d", &inita );
Is the space preceding the %d intentional?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|