|
Member 11283272 wrote: why? Why what? And probably because no one can understand your question.
|
|
|
|
|
sorry,my english is not good enough.
|
|
|
|
|
Do you have a colleague who could translate for you?
|
|
|
|
|
Sorry, I am the only one,incidentally, I'm Chinese.English is not our official language,I tried again to translate。
|
|
|
|
|
|
A.exe is my own program,B.exe is not my own program.
B.exe has a button, click it, and will call to EXCEL!
Now, my question is: if click this button to manually, EXCEL will be normal calls.---(OK)
But if use my program(A.exe),the Sendmessage function sends a keystroke messages (WM_KEYDOWN WM_SYSKEYDOWN) on the button, EXCEL will call fails.---(NG)
I'm sure it: Sendmessage function keystroke messages is sent successfully!
|
|
|
|
|
You need to be sure that the messages are exactly what the program uses to cause the button press.
|
|
|
|
|
|
Well it does not appear to be working, so there must be something still wrong.
|
|
|
|
|
Thank you, I have solved this problem.
|
|
|
|
|
Hello, can you understand what I said now ??
|
|
|
|
|
how to program that uses 4 threads to compute the sum of an array of 1000 integers.
modified 3-Dec-14 6:48am.
|
|
|
|
|
Well thanks but I've already did my homeworks, you could do it as well.
From http://www.codeproject.com/Messages/2922875/HOW-TO-ASK-A-QUESTION.aspx[^]:
2. Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
...
11. If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
|
|
|
|
|
|
#include
<stdio.h>
#include
<stdlib.h>
int array[1000]
;
void testSum()
{
int sum=0;
int j;
for(j=0
; j< 1000 ; j++)
{
sum+=array[j];
}
printf("Testing without threads, Sum is : %d \n",sum);
}
an integer is stored in
void readfile(char* file_name)
{
char ch;
FILE *fp;
fp = fopen(file_name,"r");
if( fp == NULL )
{
perror("Error while opening the file.\n");
exit(EXIT_FAILURE);
}
char line [5];
int i=0;
printf("Reading file: ");
fputs(file_name,stdout);
printf("\n");
while ( fgets ( line, sizeof line, fp) != NULL )
{
if (i < 1000)
{
array[i]=atoi(line);
}
i++;
}
fclose(fp);
printf("Reading file Complete, integers stored in array.\n\n");
}
int main(int argc, char* argv[])
{
if (argc != 2) {
fprintf(stderr,"usage: a.out <file name>\n");
return -1;
}
readfile(argv[1]);
testSum();
return 0;
}
|
|
|
|
|
i don't want to bother you ! ,
|
|
|
|
|
0. Split your array into four parts (use the pointer to determine where you're doing the split, don't make another copy of the data)
1. Create worker threads to sum each with their portion (pointer to the beginning and size).
2. Wait for all threads to finish, sum their results.
If this was a program that needed to do this over and over again, I'd also create a "thread pool" that is precreated. Creating threads on the fly is actually a pretty slow process, you want to do it sparingly.
|
|
|
|
|
Circular buffer in embedded c
|
|
|
|
|
|
A 'string' in c is nothing more than a sequential sequence of bytes terminated with a null.
But a circular buffer is not guaranteed to be sequential. So without at least some further restrictions it cannot be done.
|
|
|
|
|
You may either want to use the circular buffer for holding the pointers of the actual strings or, more likely, for holding the strings themselves.
In the first case coding is pretty straightforward (you may use Wikipedia's circular buffe[^]r page for inception).
On the other hand, the second case is bit more complex, since you have to explicitely manage blocks of bytes (the strings) in the circular buffer.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
|
|
This is a good question because I'm not sure any of those really describes Windows messaging well. Sort of interesting given that it's the primary means of communication in the Windows desktop environment. I guess the rational behind this is that you can't really pass along data across messages, you can pass commands/messages and references.
I used to use messages a lot within an application to communicate but it's a bit different when dealing internal to an application because you can pass data by reference easily. Externally, you can only do that if the data is in a place that is accessible to both applications or meets certain restrictions (as described here[^]).
|
|
|
|
|
i am trying to use the example shown in http://msdn.microsoft.com/en-us/library/ms701483(v=vs.85).aspx[^] to make a message queue in windows so i created an empty project however it keep showing 2 error.
_snwprintf_s and wprintf are not identifier.
so i search around and found out that stdio.h is required so i proceeded to add #include "stdio.h" and tried # include <stdio.h> but a linker error keep popping out.
anyone know how i get get the example to work?
|
|
|
|