|
The member variables would need to be static as well. Going that route has all sorts of implications. If the secondary thread needs to communicate with the view, which is owned by the primary thread, I would suggest using PostMessage() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
If my member variable is a class, I can't declare it static because linking an error appears. Some suggestion?
Best Regards
Doc
|
|
|
|
|
A static member can certainly be a class. Without a minimum of the linker message, I can't offer any suggestions.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
How do you set a window (using the document/view structure) to be a certain size when displayed?
For example 300 pixels wide and 500 pixels high.
Thanks
|
|
|
|
|
Check out the OnGetMinMaxInfo() method.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I am working on a MDI program. I need to know if a view is covered by any other views or windows. I found that WindowFromPoint function is useful but not quite suitable for the purpose that I want. Is there any way to know if a window is covered completely or partially by any other windows?
|
|
|
|
|
This is just a guess, but it might be of some help. If one window is overlapping another, they will have a non-empty intersection. Could you use CRect::IntersectRect() to determine this?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
use EnumWindows() function.
this function is OK for z-order
includeh10
|
|
|
|
|
A window's Z-order has nothing to do with whether it is obscured by another window or not.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
(first message !)
My problem seems me to be simple, but I have to admit that I need some help...
I have a CTreeCtrl in a dialog, and I want use a popup menu on it.
But my dialog doesn't receive my message (I use a simple ON_COMMAND )
I have tried the same thing with a CButton instead of a CTreeCtrl and it works well !
I would not use a derived class for my CTreeCtrl ...
------------------------
Le sage cherche la Vérité,
L'imbécile l'a déjà trouvé.
|
|
|
|
|
Why not simply use TrackPopupMenu to display and get the command-id from this popup menu. Do this from within the tree, and perform the action from there.
If you wish to perform the action somewhere else, you can simulate a WM_COMMAND with the command-id the menu returned.
|
|
|
|
|
Thanks for your response !
I use TrackPopupMenu in the OnContextMenu of my dialog and I display the menu only if the CWnd parameter is my CTreeCtrl. And it works well.
I also simulate a WM_COMMAND on my dialog with the command-id the menu returned, but it doesnt work... If I do the same thing with, for example, a button instead of my tree, it works !
-------------------------------
Le sage cherche la Vérité,
L'imbécile l'a déjà trouvé.
|
|
|
|
|
I see, so you're code looks like :
<br />
result = TrackPopupMenu(...);<br />
<br />
if (result)<br />
{<br />
Send/PostMessage(WM_COMMAND, result);<br />
}<br />
And you say that if you use a button instead of a tree you get the messages ?
Have you tried looking at your Dialog with Spy++ to see if it gets the WM_COMMAND ? and what differene there is there (in Spy++) when the control is a button or a tree.
Actually, what does it matter if it's a tere or a button ? you said all your code is placed in the dialog above it anyways (the Dialog performs the TrackPopupMenu and posts a message to itself...)...
|
|
|
|
|
Actually, I don't send manually the message. I use standard way (BEGIN_MESSAGE_MAP with the ON_COMMAND macro in my dialog...). I think I don't use the good terms to explain my problem.
I have tried with other messages (like TVN_SEL_CHANGED), and same problem : It doesn't work if I try to get it from my dialog.
Maybe I make something anormal and I don't see it...
Maybe the normal way to use a tree is to systematically use a derived class ? So I can manage all my message (I try and it works). But it doesn't seems to me very clean...
Thank you for spending your time !
-------------------------------
Le sage cherche la Vérité,
L'imbécile l'a déjà trouvé.
|
|
|
|
|
No Problem,
I think i'm not really understanding the situation... how is the tree involved if you said that you pop the menu from the dialog itself and handle the command in the dialog itself ?
what I suggset you do anyhows is use Spy++ to spy on your window and see if your messages are sent at the first place.
|
|
|
|
|
I will try to explain more clearly the situation :
My dialog contain a CTreeCtrl and CButton.
My message map contain :
BEGIN_MESSAGE_MAP(CMyDlg, CParentOfMyDlg)<br />
...<br />
ON_WM_CONTEXT_MENU()<br />
ON_COMMAND(IDM_MY_COMMAND, OnMyCommand)<br />
...<br />
END_MESSAGE_MAP
The OnContextMenu of my dialog is like :
void CMyDlg::OnContextMenu(CWnd * pWnd, CPoint point)<br />
{<br />
TrackPopupMenu(...);<br />
}
I have my function OnMyCommand
void CMyDlg::OnMyCommand<br />
{<br />
...<br />
}
And the matter is that It works for myButton but not for myTree. I mean that the OnMyCommand is not called when I click on my menu from myTree.
I have a little matter with Spy++ when I use it here... It crashs !
If I trace messages from my dialog, I have no problem with my CButton (I get the WM_COMMAND sent from my menu). But with my CTreeCtrl, Spy++ loop infinitely when I do a right click on the tree ! and I am constrained to reboot my computer ! (as I'm a little bit obstinate, I've tried 5 times... )
But I have tried to overloaded the OnCommand in order to see if I get the message and I don't...
I have also tried to get my message in a CTreeCtrl derived class and it works.
-------------------------------
Le sage cherche la Vérité,
L'imbécile l'a déjà trouvé.
|
|
|
|
|
I have a basic 3-D modeling program that I made a few months ago and was going to submit to this site. I did a 'Clean' on the project, then tried to rebuild it to make sure everything worked right before I submitted it. I keep getting the following error:
modeler.hpj
HC5011: Error: modeler.hpj :
Cannot open the file "D:\Program Files\Microsoft Visual Studio\VC98\MFC\include\afxhelp.hm."
There's a help file that's being built also, and D:\program files is where the files used to be on my old computer, but I snatched the hard drive out of that one and now program files is on E:\. I do a search on that string, but can't seem to find it anywhere so that I can alter it. Can anyone help? Thanks in advance!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
IIRC the definition of "D:\Program Files\..." is in the .hpj file itself. If you open it as a text file you should be able to alter this to E:\
Ant.
|
|
|
|
|
Perfect!! thank you
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hey I just realize I am really stupid !!!
Right now about 3 hours I am trying to find on internet how to make "Self-Executable" file. I need to acces data connected to exe file itself. That means I need 2 applications, One which will create the self-executable file and add the data to it and second will be the applications which will expect data in itself. But how to do that???? I have no clue.
I'm working on simple blowfish decrypting applications and I want the final ,after encryption file to decrypt itself.
What is the structure of that file. I heard that I have to simple add the data I want to connect to the file at the end of the file and than I can work with them, but that doesn't work because than I cannot run the application.
Please help!!!!!!!!!!!11111
|
|
|
|
|
how about using an EXE packer ?
that way your application will be the decriptor and it'll just access the encrypted-file...
|
|
|
|
|
What do you mean with EXE Packer? Is there any link for that.... Thanks
|
|
|
|
|
an Exe (or sometimes PE) packer can take an executable and sometimes (you're looking for these sometimes) data-files and pack them all up into a single compressed/encrypted self-containing executable.
for example: http://protools.anticrack.de/packers.htm
|
|
|
|
|
If you allow the question... what do u need this for?
It is quite an easy thing.
Make the first problem put some files as resources in the second file, and the second file then just has to load these resources and write them to the drive... quite easy!
Don't try it, just do it!
|
|
|
|
|
Hi there, I'm in the process of writing a multi-threaded webcrawler using VC++ 6 and MFC. I've got the basics down, but I can't help feeling like I'm going about it the wrong way.
I've got a Doc/View set up and when the user chooses some options (base URL / how many threads to launch), the document launches the first thread. To do that, it sends a message (using postthreadmessage) to the worker. The worker then goes and downloads the first page, parses it for links and sends a message back to the document via the view as I wasn't able to send them directly to the document...
As a side note, that process feels a little clunky. It seems logical that you'd probably not want to send messages direct to the document, but I couldn't see where else to do it; afterall, the document's storing all the links the workers download.
...anyway, once the document knows there's an idle worker, it gets all the links from the worker (calls a member function on it to retrieve the data - should be safe as the worker is idling now?) and adds them onto the (end of) master list. Since the document knows there's now a free worker, it pulls off the next link on the master link and launches the worker off again.
Does this sound like a reasonable way of doing things? I'm not sure quite why, but it feels a little in-elegant, and I can't help feeling there's probably a better way of doing it?
Any suggestions / comments would be most welcome!
Cheers, Jon
Success is 99% failure
|
|
|
|