|
i'm not sure i understand. if the condtrol can catch it, so, there is no pb ?!
you add a function in your dialog class, you get sure that the WM_RBTDOWM is correcty inserted into AFX code lines, and that's ok for you... no ?
TOXCCT >>> GEII power
|
|
|
|
|
When you right click in a control on a Dialog, the dialog is not receiving the OnRButtonDown, is the control that is receiving it, and I need that the dialog receive the Rbuttondown.
Doc
|
|
|
|
|
Lose the OnCommand() handler. You did not mention what the control is, so I tried it with both a list control and an edit control. For the list control, I handled the NM_CLICK and the NM_RCLICK messages. Both of these produced a ON_NOTIFY() handler in the dialog's message map. For the edit control, I added ON_WM_LBUTTONDOWN() and ON_WM_RBUTTONDOWN() to the message map of the edit control's class.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry David it's a Picture Control with a class derived from CStatic.
Best Regards
Doc
|
|
|
|
|
No matter. Derive a class from CStatic . Provide handlers for both the WM_LBUTTONDOWN and WM_RBUTTONDOWN messages. Make sure the control has the SS_NOTIFY style.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry David
Maybe it's my fault and I haven't explained correctly.
I've got a dialog with a picture control.
I've already got a Class derived from CStatic with WM_RBUTTONDOWN and WM_LBUTTONDOWN messages.Here all is clear.
But what I need is when I Right click on the Picture control, to generate an OnCommand message in my dialog.
When I left click on the picture control an Oncommand is generated in my dialog, but when I right click no.
Any suggestion?
Best Regards
Doc
|
|
|
|
|
doctorpi wrote:
Maybe it's my fault and I haven't explained correctly.
Nah, I just didn't see the need of using OnCommand() when there are other (more direct) ways of being notified. Anyway, I think you are being plagued by the control having the WS_EX_NOPARENTNOTIFY style. Removing this style at run-time results in both left and right clicks being sent to the control's parent. The parent will need to handle the WM_PARENTNOTIFY message.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry for my ignorace.
But how can I remove WS_EX_NOPARENTNOTIFY at runtime?
I know GetExStyle and how to change the value (dwExStyle &= ~WS_EX_NOPARENTNOTIFY ) but to set the changed value to the control?
Best Regards
Doc
|
|
|
|
|
doctorpi wrote:
But how can I remove WS_EX_NOPARENTNOTIFY at runtime?
pic_ctrl.ModifyStyleEx(WS_EX_NOPARENTNOTIFY, 0);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thanks a lot guy
That was just what I need.
Doc
|
|
|
|
|
i think another way :by set mouse right key hook
HWND hWnd=::FindWindow(.....)
if(hWnd)
Hook MouseRKeyHook=SetWindowsHookEX(
WH_MOUSE,
(HookPRoc) mouseRKeyProc,
.....
)
LRESULT CALLBACK MouseRKeyProc(....)
{
when(lparam==“MK_RBUTTON")
//add you want functionality
...}
|
|
|
|
|
Hello,
I have never attempted to map drives using code, can someone point me in the right direction (what functions or pieces do I need to research). I want to be able to map drives to NT shares that require NT authentication. When I say map drives I want to be able to assign a drive letter to a share and or just connect directly and access the files.
Any help would be greatly appreciated!
Thank you,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
IIRC you use NetUseAdd()
Ant.
|
|
|
|
|
If you want to do the share beforehand use NetShareAdd()
Ant.
|
|
|
|
|
Has anyone used USB? Is this similar to RS232 serial transfer? How do you enumerate the ports?
|
|
|
|
|
Short answer: No, it is not similar.
Longer answer: the Universal Serial Bus has basically very little to do with 'serial transfer', despite it's name. There is no concept of ports: the USB is a hub-based network of devices, much like the Ethernet of today.
Programming the USB is just as difficult: in order to send data from a computer to a device, the device must implement an USB endpoint. Usually this is achieved through a USB-compatible electronics chip. Using this chip requires a driver that the operating system loads in order to communicate with the device. You can then ask the OS to enumerate through available endpoints, open a serial connection to an endpoint and send/receive data. The OS will then worry about correctly delivering the data to the recipent connected to the bus.
Naturally, you could re-write the USB base device driver so that it would work as a serial-only device. In such a case, you could manually enumerate the ports, but you'd also lose all the benefits of the USB specification. In english, you'd be using the USB in a way it was not designed to be used. All other USB devices on the system would fail to function with the serial-only USB device. I believe such drivers are available for testing purposes, however.
For more information on how the USB works, I recommend visiting this page
I also recommend the 'USB Complete' book by Jan Axelson, ISBN# 0-9650819-5-8.
For some nice, detailed USB-programming information, visit this page.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks for the information. There seems to be a scarcity information out there on USB on the web on this subject, but maybe I was expecting it to be much simpler than it is.
-----------------------------
All truth passes through 3 stages.
First, it is ridiculed.
Second, it is violently opposed.
Third, it is accepted as being self-evident.
|
|
|
|
|
I am trying to get into view the last bit of text posted to the multiline Edit Box with a vertical scroll enabled via these lines of code:-
m_strOutput+= m_strGeneral + crlf; // Total display string; adding m_strNewText at the end
m_Output.SetWindowText(m_strOutput); // Display the new text appended onto the old text
m_Output.GetScrollInfo(SB_VERT, &scrollInfo, SIF_ALL);
scrollInfo.nPos = scrollInfo.nMax;
m_Output.SetScrollPos (SB_VERT, scrollInfo.nPos, TRUE);
m_Output is the Edit Box and I was trying to set the scroll position to the current maximum, but no luck. i.e. the botton of the text.
I still have to use the mouse to click on the Edit Box scroll bar to display the end of the posted text.
Is it that difficult to have the behavour of the Edit Box scoll reversed?
I have tried many options/varients but still no luck!
|
|
|
|
|
When doing my homework, I had this code:
<br />
....<br />
int main(){<br />
const int a=10;<br />
int* p=(int*)&a;<br />
*p=100;<br />
int i=a;<br />
cout << "p=" << p << endl;<br />
cout << "&a=" << &a << endl;<br />
cout << "*p=" << *p << endl;<br />
cout << "a=" << a << endl;<br />
cout << "i=" << i << endl;<br />
return 0;<br />
}<br />
Here is the output:
p=0012FF7C
&a=0012FF7C
*p=100
a=10
i=10
I guessed that a had to be 100, but it's 10.
It seem that compiler has replaced all instance of variable a to 10 at compile time, event if a has been allocated a storage. So the trick to change a constant by casting its pointer is not effect. Is that right?
Any comment is welcome.
Thanks.
|
|
|
|
|
I do not understand your explaination very well, but the program seems logical to me.
const int a = 10; const: means 'a' is a constant wich you cannot change.
then put a in p (thus p = 10)
then put 100 in p and then i = a;
Where is your problem?
|
|
|
|
|
nguyenvhn wrote:
const int a=10;
where did you see it was 100 ??
TOXCCT >>> GEII power
|
|
|
|
|
toxcct wrote:
where did you see it was 100 ??
Here:
int* p=(int*)&a;<br />
*p=100;
Because p (who is a pointer) receives the adress of the variable a and then you put 100 in the content pointed by p (so, at the same adress than a)... So you replace the value of a.
But I don't understand why it prints 10 and not 100. The const keyword has something to do with it but I don't know what....
|
|
|
|
|
what do you think "const" mean ? constipated ?
for me (and for C/C++ also), it means "constant", that is, you cannot modify it ! that's all....
TOXCCT >>> GEII power
|
|
|
|
|
Yes of course I know this (I'm not completely stupid ) but if you try to change the contents of it, you will have a compile error.
Or here, you change it by another way (using the adress of the variable). And there is no errors BUT the adress p and the adress &a are the same but their contents are different so there is something strange (two pointers that are pointing at exactly the same adress but the values they hold are different )!!
It would be normal if *p still contain 10 at the end (that menas the content of a was unchanged)
|
|
|
|
|
in fact, the compiler don't say anything because const is an identifier for the compiler, and as we don't explicitely write into variable a, there is no compile error. but a is still const (certainly not even in the stack...) so *p cannot access the value correctly to alter it.
TOXCCT >>> GEII power
|
|
|
|