|
I think you need to ShowWindow when you click items on the listvox.
|
|
|
|
|
i have 1 list box which contains 5 messages, i want to show that messages as multiline tooltip.
for ex when i click on 1st item in listbox it should show tooltip with multiline with 1st message. when i click om 2nd item it should multiline tooltip for 2nd message and so on for 5 messages.
thanks in advance
|
|
|
|
|
|
If so, where do I start looking? I understand I can use shared memory and other IPCs, but I want to know about SendMessage() specifically.
|
|
|
|
|
|
I've searched and could not get an answer, and thats why I asked. It seems to me that there's no way to specify the user/session that I'm sending to with the current SendMessage function. I think I'm missing something though. Yes I am aware of "letmegooglethatforyou.com"
|
|
|
|
|
First of all no need to get cranky. I did not asked you to google for it, I mentioned MSDN. Everything you need to know about SendMessage is on the MSDN link I gave you.
It is a simple function LRESULT SendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); . You pass the handle of the window you want to send message to, the message you want to sent and the parameters for that particular message.
Darrel Q Pham wrote: It seems to me that there's no way to specify the user/session
I don't think you understand how windows work. There are no sessions in windows, there are well windows. SendMessage is used to communicate between windows. For example, if I want to send left mouse button down to the desktop windows I will do this:
SendMessage(GetDesktopWindow(), WM_LBUTTONDOWN, LPARAM MAKELPARAM(500, 500));
This will send a left mouse button message to desktop windows at the (500, 500).
-Saurabh
|
|
|
|
|
Thank you, but that is not what I meant. I'm literally talking about another sending a message to a window on another user's login account. I have program A in Bob's login account communicating with program B in Alice's login account. Assume they are remote logging into the same computer. I use SendMessage() often in the same login, so I understand how it works in the local login. I did read somewhere that the HWND is like a global handle in the system, which means I could pass the HWND to another login and it'll make it valid, but I doubt that. I will verify this.
|
|
|
|
|
Okay, you did not mention this in you original post. First you have to find the handle to a window in other user's desktop. Then you can use that handle to send a message.
To get the handle to a window in another users desktop you have to use EnumDesktops[^] to enumerate all the desktops in a workstation, find the one you need and then use EnumDesktopWindows[^] to enumerate the windows in that desktop.
Hope this helps.
-Saurabh
|
|
|
|
|
Thank you, this is exactly what I'm looking for.
|
|
|
|
|
Window Station and Desktop Functions[^] is a good place to start researching. Your probably going to run into the same security issues that you did in your CreateFileMapping project last week.
Good Luck,
-David Delaune
|
|
|
|
|
Thanks again.
Another thing I forgot to mention is this will be for Server 2003, which allows multiple interactive station vs. XP which only allows one. I didnt mention this because I just found this out. I'm using XP right now, and this explains why I wrote my hwnd to a file(casting it as a dword) from program A in login/station A, and then open it with program B in login/station B, and failed when I attempt to use SendMessage with the hwnd that I read from the file. I will set up Server2003 to confirm this.
From reading the links you guys gave me above, I think I can use OpenWindowStation() to open the login/station I want, use the hwinsta handle that the function returns, and use SetProcessWindowStation() to give my process access to that login/station. Then at this point I could use FindWindow() to find the window that I want to send the message to, and use SendMessage() to communicate with that window. When all is done, I can bring my process back to the previous login/station.
This is unrelated, but if I said above is correct, does this mean I can launch my process in login/station A, set my process to belong to login/station B, create a thread in login/station B, spun an mfc dialog box inside that thread, set my process to belong to login/station A again, and it'll work correctly even if I have global variables that the dialog box accesses in my main process in the user A?
|
|
|
|
|
Hello Darrel,
Beginning with Windows XP Service pack 2 and Windows Server 2003 Microsoft changed how you create processes with alternate credentials from the SYSTEM account. Prior to XP-SP2 it was a piece of cake. But with the new security technologies implemented its much more difficult. Microsoft has made a very weak attempt to document some of the changes for developers here:
Windows XP Service Pack 2 - Security Information for Developers[^]
But don't waste yout time looking at it, it pretty much doesn't contain anything useful. You may want to take a look at some source code instead. I found the folowing source code on the internet and thought you may want to take a look at some if its functions.
alternate credentials from the SYSTEM account[^]
Hope it helps,
-David Delaune
|
|
|
|
|
Thank you. I have setup Server 2003 and created 2 user sessions, then tried using SendMessage() to communicate between two user sessions, which does not work. I've done much more searching and read that the hWnd global but is limited to the scope of the windows station. This makes sense in terms of security reasons, but sucks when I want more flexibility. I also came across a few messages that says hWnd is "system wide", which makes me confused again. I tested Named pipes and it works because it was designed to work across networks, so it will be the last resort. It would be nice to clear up the confusion though.
|
|
|
|
|
Has anyone here ever had the need to use something faster than memcpy() to move a large amount of data in physcal memory?
I have a suspicion that memcpy is copying only a few bytes at a time, depending on what compiler is used.
Any information floating around here? (I'm also googling, and I'll update this thread if I find something..)
|
|
|
|
|
I certainly agree that the performance of memcpy is dependent on the compiler. I took a quick look at the memcpy that came with my version of Visual C++ and it looks well written. That is, it should run fast for large data blocks.
You wrote that memcpy only copies a few bytes at a time. The code I saw was using a block move instructions to do most of the work. However, we may not be looking at the same code. Which compiler are you using?
Bob
|
|
|
|
|
VS 2005 - memcpy.c
while (count--) {
*(char *)dst = *(char *)src;
dst = (char *)dst + 1;
src = (char *)src + 1;
}
definitely not a block copy. Which version do you have and can you post the relevant code?
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
I believe he is referring to the Intel optimized memcpy located at:
Program Files\Microsoft Visual Studio 8\VC\crt\src\intel\memcpy.asm
or
Program Files\Microsoft Visual Studio 9\VC\crt\src\intel\memcpy.asm
Best Wishes,
-David Delaune
|
|
|
|
|
I have VS 2008, version 3.5. I believe that this code is copy righted so, I cannot post it. Sorry.
Bob Sherry
|
|
|
|
|
The memcpy source files are the same in both VS2005/VS2008 all service packs.
Best Wishes,
-David Delaune
|
|
|
|
|
With VS your release build will likely use the intrinsic version.
http://msdn.microsoft.com/en-us/library/26td21ds(VS.80).aspx[^]
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Please consider the following C++ program:
#include <iostream><br />
<br />
using namespace std;<br />
<br />
class Base0 {<br />
public:<br />
Base0()<br />
{<br />
cout << "Base0::Base0() called" << endl;<br />
}<br />
~Base0()<br />
{<br />
cout << "Base0::~Base0() called" << endl;<br />
}<br />
<br />
};<br />
<br />
class Base1 {<br />
public:<br />
Base1()<br />
{<br />
cout << "Base1::Base1() called" << endl;<br />
}<br />
~Base1()<br />
{<br />
cout << "Base1::~Base1() called" << endl;<br />
}<br />
<br />
};<br />
<br />
class Base2 {<br />
public:<br />
Base2()<br />
{<br />
cout << "Base2::Base2() called" << endl;<br />
}<br />
~Base2()<br />
{<br />
cout << "Base2::~Base2() called" << endl;<br />
}<br />
<br />
};<br />
<br />
class Base3 {<br />
public:<br />
Base3()<br />
{<br />
cout << "Base3::Base3() called" << endl;<br />
}<br />
~Base3()<br />
{<br />
cout << "Base3::~Base3() called" << endl;<br />
}<br />
<br />
};<br />
<br />
class Test1 : public Base0, virtual Base1 {<br />
public:<br />
Test1()<br />
{ cout << "Test1::Test1() called" << endl; }<br />
~Test1()<br />
{ cout << "Test1::~Test1() called" << endl; }<br />
};<br />
<br />
class Test2 : public virtual Base1, Base2, Base3 {<br />
public:<br />
Test2()<br />
{ cout << "Test2::Test2() called" << endl; }<br />
~Test2()<br />
{ cout << "Test2::~Test2() called" << endl; }<br />
};<br />
<br />
<br />
class Test3 : public Test1, virtual Test2 {<br />
public:<br />
Test3()<br />
{ cout << "Test3::Test3() called" << endl; }<br />
~Test3()<br />
{ cout << "Test3::~Test3() called" << endl; }<br />
};<br />
<br />
<br />
int<br />
main()<br />
{<br />
Test3 t3;<br />
<br />
return 0;<br />
}
Before Test3 can be initialized, Test1 and Test2 must be initialized. To Initialize Test1, you have to construct its base classes. The first base class of Test1 is Base0. Therefore, I would expect that the constructor for Base0 to be the first constructor called. However, my output shows that the first construct called is Base1. I do not understand why. I am hoping that somebody can tell me why?
Thanks
Bob
|
|
|
|
|
BobInNJ wrote: I do not understand why. I am hoping that somebody can tell me why?
Try reading up about multiple inheritance.
led mike
|
|
|
|
|
Virtual keyword will be given priority when doing inheritance. In this Test3 is inherited from Test1, Test2 and test2 is executing first since its virtual inheritance.
Subbarao.
|
|
|
|
|
I have to read a file (for a string) and the file is available only at the compilation time, not in the run time.
Is there any possibility to read the file during compilation and initialize a variable with the value read from the file.
I have tried different methods, but doesn't work for me. Can anybody please tell me how can i do this?
Thanks in advance.
|
|
|
|