|
Using SendMessage or PostMessage message may or may not work, it depends on the program. As I mentioned the SendInput API is specifically designed for faking input. Here are some reasons the SendMessage /PostMessage technique may not work:
- The program calls the GetMessagePos to get the coordinated of the mouse when a message was posted.
- The program calls the GetAsyncKeyState to check for mouse buttons.
In short, the SendMessage /PostMessage may work, but then again it may not: it depends on how the program performs its input.
Steve
|
|
|
|
|
In my Project, i'm having 2 applications. i need to send and receive messages between the two applications. The first application should wait until it gets an acknowledgement from the second after sending the message. If i use WaitForSingleObject function, how can i carry this out? Please help....
|
|
|
|
|
|
|
|
Hello Owner drawn. As I said in my original message (the link), I don't receive such message! I don't know why :- ). I think I should, but I don't. As I said, it's a window created like this:
hwndControl = CreateWindowEx //Creating the window.
(
NULL, //ExStyles.
"Static", //Class name.
Text, //Text of the label.
WS_CHILD | SS_CENTER, //Styles.
0, //X.
0, //Y.
100, //Width.
30, //Height.
hwndThis, //Parent, a WS_POPUP window.
NULL, //Menu.
(HINSTANCE)hwndThis, //The handle of that WS_POPUP window which contains this one.
NULL //CreateStruct.
);
So it's a static label control... and it centers the text... but I can't change the background. So then I guess my question becomes, WHY DOESN'T IT RECEIVE WM_CTLCOLORSTATIC...
Weird!
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
The parent of the static control recieves the WM_CTLCOLORSTATIC message (the window identified by hwndThis in your code).
Steve
|
|
|
|
|
Yes. You are indeed correct, I don't know how I missed this *confused*. The fact is that I wrote all window procedures and I think I got a bit mixed up between them. Thank you both ::- ) Stephen and Owner drawn.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Axonn Echysttas wrote: WHY DOESN'T IT RECEIVE WM_CTLCOLORSTATIC
As steve said where are you writing this code. It should be written inside the wndproc of the parent that holds the static control.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Yeap, both color changing and text colors changing work now. Thank ya! ::- ).
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Ok the problem is a lil strange, i am all confused how the hell is this possible, lemme explain with an example...
void Test()<br />
{<br />
CComBSTR bstrOne("abc");<br />
{<br />
CComBSTR bstrTwo("xyz");<br />
}<br />
AfxMessageBox(CString(bstrOne));<br />
}
Now this is what happens sometimes.. when the destructor of bstrTwo is called it calls ::SysFreeString( m_str ) and this free's the string of bstrOne. I have checked the address passed to ::SysFreeString it is the address of bstrTwo.m_str , i just dont understand how the string at bstrOne.m_str is freed. If anyone can explain me this. One more thing it doesn't always happens this way.. It just happens when i copy data on clipboard. The only special thing i am doing is that i have written a custom COM component to handle my Clipboard requests. This actually happens in that code. I understand there is some problem with my code.. but what i dont understand is how does ::SysFreeString(something) frees something else.
:-> WHATEVER :->
|
|
|
|
|
Did you simplify the problem or does it really happen with code that simple?
Steve
|
|
|
|
|
Well actually i simplified it alot.. there are many lines of code there of course. What i am really curious about was that i pass some address X to the SysFreeString and it just frees the string at address Y. I have check the addresses in Memory View and they are different. I am just all confused. The behaviour is consistent in one way, if i have 2 string it will always free the string1 when asked to destroy string2.
|
|
|
|
|
I suspect the problem is in some of the code you edited out. I have used SysFreeString many times and never had any problems like yours. Perhaps if you can produce some code that will actually reproduce the problem you will get a solution.
Steve
|
|
|
|
|
I need to read the line by line data from pdf file...
Plz guide me if u have any ideas.......
|
|
|
|
|
If it's a compressed PDF, as most are, you need to buy or find an external library, or write a whole lot of code yourself.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
if it is not a compressed one..then..
|
|
|
|
|
Then the text in it is just plain text, but it's hardly 'line by line', there's tons of other config info in there as well. You can tell by opening one in notepad and searching for text you know is in there. Not too much tho, even uncompressed ones break the text in the weirdest places.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Petrhaps if you told us a little bit more what you want to do?
|
|
|
|
|
See this[^] document for full doc of the PDF file format.
onwards and upwards...
|
|
|
|
|
Can any body tell me how can i inerface with any COM object? I know GUID/CLSID of he object.
I am new with COM Object.
|
|
|
|
|
The easiest way is to #import the COM object and use __uuidof to generate instances. If you google __uuidof, you're bound to find heaps of examples. Remember, the objects need to be registered on your machine, if you just have been given them as files, you can't just dump them in a folder. regsvr32 is the command line command to register a COM object. If it's installed with something ( like Office ), then this has been done for you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
There are various libraries that provide classes (and such) to make dealing with COM easier like ATL and the compiler provided COM support classes. Given that you haven't provided much info on this I'll point to at some APIs/interfaces:
CoInitialize - To initialize COM on the current thread.
CoCreateInstance - Create a registered COM object given a CLSID.
IUnknown::QueryInterface - Get an interface on a COM object given its IID.
IDispatch - For dispatch interfaces.
If you're not driving IDispatch interface you will need to have a header file so you can call the methods on the interfaces. There are many ways to do this:
- Use one that comes with the component or SDK
- Use #import
- If you've got an IDL file, use MIDL to make one.
- Use a tool like OleView to make one.
Steve
|
|
|
|
|
But i have no idea of working with IUnknown. I read so much about this interface in MSDN.
|
|
|
|