|
ewighell wrote: // how can I get a handle to the Edit window?
Use the GetSafeHwnd() method. However, why do you need it?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I want to send a message with the function SendMessage(), it seems that some of its parameters are of type HWND.
I want to send a BN_CLICKED message to the button m_bn1, which is of type CButton with the following code, but it seems does not work, where am I wrong?
SendMessage(BN_CLICKED,IDC_BUTTON1,(LPARAM)m_bn1.GetSafeHwnd());
Thank you very much!!!
-------------------
I am learning C++ and English
-- modified at 21:47 Tuesday 15th November, 2005
|
|
|
|
|
First, you don't need to get the HWND. You can just call pEdit->SendMessage(msg, wparam, lparam).
But, it won't work in your case. BN_CLICKED is a notification send by the button to its parent, not the other way aroiund . And it's not a BN_CLICKED message, it's a WM_COMMAND message with BN_CLICKED encoded in its WPARAM parameter (see MSDN for details).
What do you want to accomplish?
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
|
I am trying to debug a program using Visual Studio, but one of my local values in not matching what is printed using printf. Any ideas?
simaneal
|
|
|
|
|
Have you checked the format?
int %d
float %f
double %lf
....
Matteo
|
|
|
|
|
What do you mean ? You watch your variable with the debugger and it doesn't match what you printed with printf ?
Are you sure you are using the right format specification for your variable ?
Also, post the code (use the code tag just above the emoticons), this will be easier for us.
|
|
|
|
|
<br />
#include <stdlib.h><br />
#include <stdio.h><br />
#include <math.h><br />
#include <time.h><br />
#include <stddef.h><br />
#include <malloc.h><br />
<br />
#define nmax 118/* Maximum Number of pixels + 1 */<br />
#define npixels 117 /* Number of pixels in forest */<br />
#define tfactor 0.95 /* annealing temperature factor */<br />
#define xcoor 10/* maximum x coordinate */<br />
#define ycoor 117 /* maximum y coordinate */<br />
#define period 20 /* investment and management time period of interest */<br />
#define i 0.04 /* interest rate for discount factor */<br />
#define tmax 2 /*maximim number of feasible moves before stopping*/<br />
#define array_size 117<br />
<br />
<br />
<br />
int<br />
main (void)<br />
{<br />
<br />
int y;<br />
printf("starting\n");<br />
int *pix1;<br />
<br />
if ((pix1 = (int*)malloc(array_size * sizeof(pix1))) == NULL) {<br />
(void)printf("ERROR: Malloc failed");<br />
(void)exit(EXIT_FAILURE); <br />
}<br />
<br />
int *pixm1;<br />
<br />
if ((pixm1 = (int*)malloc(array_size * sizeof(pixm1))) == NULL) {<br />
(void)fprintf(stderr, "ERROR: Malloc failed");<br />
(void)exit(EXIT_FAILURE); <br />
} <br />
for(y=0; y<ycoor; ++y)<br />
{<br />
<br />
pix1[y]=1;<br />
pixm1[y]=1;<br />
printf("pix1= %d",pix1[y]);<br />
}<br />
int ymoves;<br />
for(ymoves=0; ymoves<ycoor; ymoves++)<br />
{<br />
if(pix1[ymoves==1)<br />
{pixm1[ymoves]=0;<br />
printf("pixm1= %d", pixm1[ymoves]);<br />
}<br />
else<br />
{<br />
pixm1[ymoves]=1;<br />
}}<br />
}<br />
return;<br />
<br />
The code is a mini version of the code I am having problems with. When I watch the locals pixm1[] is supposed to switch from a 1 to 0 and it does not. The printf statement output is pixm1 =0
I do not understand why they would be different and which one reflects what the program has as pixm1[]?
simaneal
|
|
|
|
|
Your code is not clear, but have you checked well this line?
if(pix1[ymoves==1)
Are you meaning
if(pixm1[ymoves]==1)
???
Try to write the code with a better format.
Matteo
|
|
|
|
|
I meant if(pix1[ymoves]==1)
I am trying to get pixm1[] to change based on what pix1[] is. The full code is on another computer and is to long to display here.
simaneal
|
|
|
|
|
I understand you.
But take in mind that at 99% is a your sintax error, so it is important to look at the real code.
I have to go home,
good luck.;)
|
|
|
|
|
simaneal wrote: if ((pix1 = (int*)malloc(array_size * sizeof(pix1))) == NULL) {
This code is incorrect if you are simply wanting room for 117 int s. Use one of the following instead:
int pix1[117];
...
int *pix1 = (int *) malloc(array_size * sizeof(int));
if (pix1 == NULL)
simaneal wrote: When I watch the locals pixm1[] is supposed to switch from a 1 to 0 and it does not.
How are you verifying this?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi,
I use Microsoft visual studio .net 2003.
When I'm in debug mode I can press F10 to execute single instructions (that are usually 5/10 disassembly instructions).
I have a problem with my software, and I need to execute disassembly instructions one by one.
Someone knows a way to change the editor setup and press F10(or something quite faster) to do this?
Thanks to all
|
|
|
|
|
If you debug from the assembly view it will execute the instructions one at a time.
|
|
|
|
|
Sorry but the real problem is different:
Someone used my pc last week and now everytime that I press F10 the debugger execute a single disassembly instruction!
That person remembers that he changed a flag into the opsions-setup, but he don't remember what!!!!
can you help me??
|
|
|
|
|
i have made an apllication that creates a 5MB shared memory.But analysing the memory usage displayed in the taskmanager,i found out that,this memory is not added to the process' memory.Can anyone tell where is the shared memory created and to whom's account it goes?
nav
|
|
|
|
|
Make sure you look at 'VM Size' and not 'Mem Usage' column.
The increased use of the Virtual Memory will be reflected in the 'VM Size' column.
Each process 'mapping' the shared memory will reflect the 5 MB in its 'VM Size' column in task manager. No particular proces 'owns' the memory, they all do. Each process has it mapped into its own virtual address space. The base address need not necessarily be the same in each process, but it can be forced that way.
|
|
|
|
|
Hi all,
I want to write a little tool which reads some characters from the serial port
and puts them directly into the keyboard buffer, so that they appear in the
currently active application at the current cursor position.
Handling of the seral port isn't a problem, but can anyone give me a hint how
to emulate a keystroke from within a program (C/C++, WinXp)
Thanks!
Reinhard
|
|
|
|
|
|
You can use the SendInput function for that purpose but I don't think this is a great idea. What kind of application are you using ? Console app or windows app ?
In both cases this won't work as expected. In the console app, you can only see text appear if the program reaqire some entry (cin for example) and for the window application, the control inside which you want to display the text needs to have the focus.
Why don't you choose an easier solution: read the data from the serial port yourself and print it yourself. It is much more simple !
|
|
|
|
|
What about:
SendMessage(hwnd, WM_CHAR, <char>, 0);
|
|
|
|
|
Hello,
This[^] will be helpfull.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Many thanks to all of you!!!
I've tried some of the hints and esp. the SendKeys object helped a lot.
You've saved my day...
Reinhard
|
|
|
|
|
reinhard_jd wrote: I've tried some of the hints and esp. the SendKeys object helped a lot.
you can try keybd_event Function tooo
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Anyone give me some hints or source code how capture video from usb device and get pixels values to memory.
9ine
|
|
|
|