|
Any reason why you are doing it this (hard) way rather than having AppWizard create an SDI/MDI application for you sans Doc/View support?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
You need a modal loop to prevent the app from exiting!
The code you are using creates a window and then exits the main routine.
If you really want to create the window like this you have to call m_pMainWnd->RunModalLoop() after creating the window.
Don't try it, just do it!
|
|
|
|
|
awah wrote:
is there something i did wrong?
Yeap, there is no Message Loop for that Window Running!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
I have a window that has a some drawing in it and I have this child window that I would use to display information where the mouse is on the drawing.
How do I capture mouse movement in the chart window even when the mouse moves over the child window ?
I added a handler for WM_MOUSEMOVE to the chart window but when I pass over the child window I don't receive any WM_MOUSEMOVE messages, just when I am over the chart window. I need to get messages also when I am over that child window.
I know I could use GetCapture(), but I don't want to click the chart to initiate a GetCapture(), so if I use GetCapture() on that chart window, what would be the best way to know when to call release capture, in other words how do i know, for certain, that the mouse has left the chart window ?
thanks,
Louis.
|
|
|
|
|
From MSDN:
CWnd::SetCapture
Causes all subsequent mouse input to be sent to the current CWnd object regardless of the position of the cursor.
When CWnd no longer requires all mouse input, the application should call theReleaseCapture function so that other windows can receive mouse input.
I think that is what you want to do.
MS
|
|
|
|
|
Ok, I tried the SetCapture() and it works fine but I have a problem with the child window that I use to display information. This child window is moveable, but when SetCapture() is called for the chart window I cannot move the child window anymore (not receiving any messages)...I guess I could check with a hit test if the cursor is on the title bar of the child window...but this seems to be becoming a lot of work...is there another way ?
thanks for your help I am half way there.
Louis
|
|
|
|
|
You should also be able to trap these messages with PreTranslateMessge.
You need to add the handler for PreTranslateMessage (class wizzard). There you can "look" at the mouse messages and see for which window they are. Don' forget to pass them on to their destination.
MS
|
|
|
|
|
Good idea.
I added the handler seems to be working but again when mouse is in child window I dont receive messages. I don't get it, this child (chart info window) is just a child like the chart control.
Here's exactly what I have and did:
- A dialog that I use for a graph window.
- This dialog contains controls and one of those controls is a CStatic derived class that act as a chart control. There is nothing special about the control in how it handles messages except for drawing.
- At runtime I create a new dialog that is child of this dialog. This child dialog is the chart info window. To me it should be the same as another control in the dialog. It does nothing special, just contains a static control in which I display text. It has a title bar so I can move it around.
- I added a PreTranslateMessage handler to the main dialog and check for the WM_MOUSEMOVE message. If the point lies in the client rectangle of the chart control I display text in the chart info window (static control on that child dialog).
So far it works, just that when the mouse is over the chart info window, the main dialog does not receive any WM_MOUSEMOVE in PreTranslateMessage. I really don't understand why I receive message when I am over the chart control in the main dialog but not in the chart info window that is also a child of the main dialog. ??
I hope you get the 'picture', maybe a screenshot of the layout would help ? If so, how do I add an image to a post ?
thanks for all your help,
Louis.
|
|
|
|
|
Seems I found the problem.
There is a difference in using a dialog as a child of another dialog then using a basic control. What I did is that I substituted the chart info window (child dialog) for a CStatic control and now it works. Just that I don't have a title bar to move the control around...I should be able to find a way move it by clicking anywhere on it.
I beleive there must be a way to make a child dialog work as a basic control...I guess there is a message handler in the dialog that consumes the messages and are not relayed to the parent.
Louis.
|
|
|
|
|
I don't know if this will help. But in this entire thread, no one mentioned that a control is another window and only the window over which the mouse is moving gets the WM_MOUSEMOVE messages (not its parents).
You don't want to capture the mouse in your main window, because then your child windows will not receive mouse message (they will all go to your main window).
If you need to keep track of the cursor position, even when the mouse cursor is over a child window. Then you should start a timer in you main window (in this case your dialog window) and call GetCursorPos to get the screen coordinates of the cursor. Then there is an API function some where (I forgot the name of it), that can be used to get the handle of a window given the screen coordinates, that you need to call to determine which window you are over. If you need to display the coordinates, then you'll probably need to convert the screen coordinates to the local client coordinates.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hello,
I would like to embed the functionality of the windows explorer (file manager) in a win32 application (no MFC). Specifically, assuming I already have a file tree control on the left side of the window, I would like to have a control which will display files and directories on the right, much like explorer does, with different view options (list, details, icons, thumbnails, etc.).
Is there a control like the Web Browser control I can embed in my app, or is it more complicated than that?
Thanks in advance.
Have no fear of perfection - You will never reach it
|
|
|
|
|
Salvador Dali wrote:
I would like to have a control which will display files and directories on the right, much like explorer does, with different view options (list, details, icons, thumbnails, etc.).
That would be a listview (i.e., SysListView32).
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Umm...can you be a little bit more specific on how one would go about using this? There doesn't seem to be a lot of related documentation around, except perhaps for modifying the standard windows file open/save dialogs.
Have no fear of perfection - You will never reach it
|
|
|
|
|
Salvador Dali wrote:
Umm...can you be a little bit more specific on how one would go about using this?
SysListView32 is the system list view control class. You create it just like you would any other...using CreateWindow() . See here for an example.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The objects to store contains a regular integer and a pointer. Each integer value is unique and received in a sequential order (the value is increased by one or more for each time).
- I want to find an object with a particular integer value as fast as possible.
- I don’t know the number of objects at load time, so I cant load all at once and use binary search.
I believe using a tree structure is not the most clever idea, since the data is in order from start.
Maybe a skip list is the best idea?.
|
|
|
|
|
How about some associative data structure, like a hash table or a map? You'd get constant lookup time (average) instead of the log n lookup time you'll get with a tree.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Store where?
It seems to me that if the integer ALWAYS increases by exactly one each time, you can use binary search. Just keep redcuing the index into the list by one-half until you home in on the value. I would htink this shoudl work because our data is of constant size and you know the index value is always increasing.
|
|
|
|
|
How can i communicate my pc with mobile i am using f-Bus
how can i know my terminal ID and phone device id i am using Nokia 3315 wht will be the device id of it how to determine it if any know pls help me
thanks
regards
sundar
|
|
|
|
|
mpsundar wrote:
how can i know my terminal ID and phone device id i am using Nokia 3315 wht will be the device id of it how to determine it if any know pls help me
Have you got any software to connect to nokia phone or you have to create your Own!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I want to know the public IP of a machine which is on LAN and connected to internet through LAN.
It's easy to get private ip.
I want to do this using C/C++/VC++.
What API or functions or line of codes i have to use?
Rakesh
|
|
|
|
|
You need a server that tells you the ip.
Don't try it, just do it!
|
|
|
|
|
There are a couple sites out there that will return your public ip when queried.
e.g.
http://checkip.dyndns.org/[^]
So you send them a get and parse the return.
As i said there are other sites that you may not have to parse, or that use a protocol other than http ... i don't remember any of them off-hand though, check google.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
thakns for response.
I want to do it using my application.
Is there any API or any function which will tell me about my public ip..
|
|
|
|
|
>> Is there any API or any function which will tell me about my public ip.
No.
Think about a typical home setup.
[Your PC] - [DHCP][Cable Modem] - [ISP] - ...
Your PC knows what IP the cable modem DHCP server has assigned it.
It can even find out what the cable modem IP is with respect to your PC.
But, the cable modem has 2 IP's, one on your internal network, and one assigned to it by the ISP.
You would have to query the cable modem (router) to find what IP it has on the ISP side.
This is possible, but generally too much work compared to a quick send/recv to a well-known server.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Hello people,
I'd like to know how to declare and use an array of pointer on functions?
Lets say:
<br />
void f1() { ... }<br />
void f2() { ... }<br />
void f3() { ... }<br />
<br />
typedef struct _toto<br />
{<br />
int x, y;<br />
} TOTO;<br />
<br />
TOTO g_toto;<br />
<br />
void InitTOTO()<br />
{<br />
g_toto.x=g_toto.y=0;<br />
<br />
g_toto.functions[0]=f1;<br />
g_toto.functions[1]=f2;<br />
g_toto.functions[3]=f3; <br />
}<br />
<br />
int main()<br />
{<br />
InitTOTO();<br />
for (int i=0; i<3; i++)<br />
}<br />
I hope you see what I wish to do...
Thanks for giving me the clue
Best regards.
Fred.
There is no spoon.
|
|
|
|