|
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?
|
|
|
|
|
neodeaths wrote: but a linker error keep popping out. Well I am afraid we cannot guess what error it might be.
|
|
|
|
|
Just a suggestion but getting Windows Message Queues or any message queues to work correctly is not a beginning level project.
So if you have not programmed before then I suggest finding some other project to work on (hopefully a teacher didn't assign this.)
Other than that a linker error would suggest that you are missing a library (however the posted error wouldn't normally suggest a linker error to me.)
|
|
|
|
|
Quote: _snwprintf_s and wprintf are not identifier.
If you look at the tchar.h include[^], it has the definitions for those.
If you include that file and still get errors in regards to wprintf and the other call, do note that they're enclosed in an #ifdef statement that requires the project to be compiled using _UNICODE.
|
|
|
|
|
Has anyone solved the mystery of using both ImageHlp.h and DbgHelp.h in the same module? When you include both of those headers, it gives about 195 errors of "Multiply defined symbols."
I googled, but all I could find was people asking this question and not receiving any answers.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
It looks[^] the official library is DbgHelp , and they do actually provide overlapping functionality.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|