|
Check the WM_CONTEXTMENU is called for your tree control.
then check the point where right clicked (lParam value has the point)has any item,.. the handle to the tree will be passed in wParam
if so then check it is leaf node (by checking its child you can find out).
Show your context menu and handle occrdingly..
Hope this'll help...
Do your Duty and Don't expect the Result
|
|
|
|
|
I need to convert a vector to an array. It's no problem really, only one thing bothers me. If i use an iterator to iterate through the vector, i have no counter for the array, unless i declare an extra variable for that. If i use a counter to go through the vector, i bypass the recommended STL-way for iterating - iterators. So, does anyone know any elegant way for that ? I know that it's not really a problem, i'm just trying to optimize my solution.
wbr Mr.Brainley
|
|
|
|
|
A vector 's storage is contiguous, so you can do &my_vector[0] to get an (array-like) pointer to the first element.
|
|
|
|
|
Michael Dunn wrote: A vector's storage is contiguous, so you can do &my_vector[0] to get an (array-like) pointer to the first element.
very encapsulated
|
|
|
|
|
The C++ Standard Library requires that the elements of a vector are in contiguous memory. There's no problem with code like Mike suggested and encapsulation has not been violated as the contiguous storage requirement is documented and required behaviour for a std::vector .
Steve
|
|
|
|
|
Hi
You know we can download all issues of MSDN magazine.
But where can we find recent issues of Microsoft Systems Journal? (http://www.microsoft.com/msj/default.aspx)
I need its recent issues and if you look to the adrees above they are not fully available anywhere.If anyone have recent issues of MSJ,
can please upload anywhere.Or where can i find them.
Thanks
(Sorry if this is wrong forum)
|
|
|
|
|
sawerr wrote: (Sorry if this is wrong forum)
It is, but never mind. MSJ is no more, and hasn't been for some time. Instead, the content was merged with MSDN Magazine.
Steve S
Developer for hire
|
|
|
|
|
sawerr wrote: But where can we find recent issues of Microsoft Systems Journal?
Which one are you interested in?
MSJ merged with MSDN back in 2000 so "recent" is subject to interpretation.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks for all answers.
I you looked http://www.microsoft.com/msj/ some articles are still there.Some links are active but 1986-94 articles are not active. In api hooking revealed article http://www.codeproject.com/system/hooksys.asp author gave link of [9] "Load Your 32-bit DLL into Another Process's Address Space Using INJLIB" MSJ May 1994 but i can not reach this article.
If you can provide
Back Issues — 1995-1996
and
Back Issues — 1986-1994
If you can do all of the articles this will be amazing but few of them are also very good for us.
This is perfect for young programmers.MSJ's articles are really profesional.
Thanks for answers again.
If necessary e-mail: sawerr@gmail.com
|
|
|
|
|
sawerr wrote: ...MSJ May 1994 but i can not reach this article.
The source code is available.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I am using WNetAddConnection2 to connect to a remote system in the lan.when i am connecting i want it to connect to the remote in the application level but its getting connected in the user level. Is there any way to connect to the remote in the application level.
thank you.
KIRAN PINJARLA
|
|
|
|
|
What do you mean by "application level?"
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
What do you mean by 'application level' and 'user level' ?
-----------
Mila
|
|
|
|
|
when i am connecting to the remote system by typing the system ip in the windows startButton->run, i have to submit the user name and password.And if iam connecting from my application also i have to submit the username and password.
Now the problem is if first time i am connecting through my app and if i try to connect from strat->run its not asking for username and password because the system is already connected to this user. This can bring me a security problem.
I hope u understood my problem. Thankyou.
KIRAN PINJARLA
|
|
|
|
|
Hi,
If you trying to connect with WNetAddConnection2 and connection's already established, you get 1219 error code (if I remember). Then you can simply disconnect existing session by WNetCancelConnection2.
-----------
Mila
|
|
|
|
|
Hi there!
I'm working on an alarm monitoring app, which may show modeless popup dialogs when needed. All this works fine except when the main application window is iconic (== minimized). When the main window is iconic and a popup dialog is displayed, the popup dialog sort of becomes the main window of the application.
This is quite confusing, since when the user clicks on the application icon in the Start menu only the recent popup is displayed, but the main window is not restored. Right-clicking the start menu icon and selecting "Restore" does the trick, but is not too user-firendly.
Does anyone have ideas about how to handle the creation/display if the popups correctly? I've tried sending the dialogs a WM_SHOWWINDOW message with "parent closing" info, right after creation, but this doesn't seem to help.
Of course I could prevent showing these popups when the app is minimized, but that's not really the way to handle it. What I'm after is to have the popups behave like they do when there are popups when minimizing the main window; the popups are hidden when minimized and redisplayed when the main window is opened again.
Any ideas on this are greatly appreciated!
-Pete
|
|
|
|
|
The behavior looks weird because the dialog's parent window is hidden.
You could
a) Restore the main window then show the dialog
b) Don't restore the main window and use NULL for its parent window
c) Don't restore the main window, create the dialog, but don't show it
If you go with c), make sure the visible style is turned off in the dialog resource.
|
|
|
|
|
Thanks for a VERY quick answer, Mike!
I'll have to see what my my options are here and select the best one. I have thought about a), but not all these windows are probably such that they should restore the main window. I really didn't come to think of the main window being hidden, but of course it is! The button on the start menu isn't really the main window, but just a thingy representing it.
-Pete
|
|
|
|
|
hey my dear code project members,
i am having a problem trying to know the length of a wave file
i tried
mciSendCommand(wDeviceID,MCI_STATUS,MCI_TRACK | MCI_STATUS_LENGTH ,(DWORD)(LPVOID) &mciStatusParms);
actually i don't know how to initialize the MCI_STATUS_PARMS "mciStatusParms"
to get the length (duration) of the wave file
so is this the right way and how can i get it work
if it is not, wat is the right way to get the length of a wave file
thnx alot 4 ur time and concern
|
|
|
|
|
May it be a LAN or internet, How do we detect it? using VC++? anyway through Winsock?.
?
|
|
|
|
|
Check out InternetGetConnectedState()
|
|
|
|
|
Thanks Mike, and do we have any similar function in .net?
?
|
|
|
|
|
I have a class which is compiled to a DLL. When giving out the DLL, i give along the .h, .lib and .dll files.
.h File content (implementation in .cpp compiled to .dll and .lib)
class DLLTESTV_API CDLLtestV {<br />
public:<br />
CDLLtestV(void);<br />
int GetX();<br />
void SetX(int _X);<br />
private:<br />
int x;<br />
};
But, i do not want the end user to know any private members of my Class. Is there anyway
i can hide those? The private members are in the private: block in the .h file and are visible in my class declaration.
I want to ship .lib, .dll and .h like this
class DLLTESTV_API CDLLtestV {<br />
public:<br />
CDLLtestV(void);<br />
int GetX();<br />
void SetX(int _X);<br />
};
I have tried doing so (by deleting manually the private : int x line in the .h file used in a test program), and the programs executes fine but causes an error at the end. Removing that line causes a stack corruption error during runtime (with the compiled DLL in a test program).
Any suggestion how i can hide the private members (users cant modify them anyway, they are private!).
|
|
|
|
|
The way it is done generally is to provide an interface only: make your CDlltestV class inherits from an interface class (IDlltestV for example) which exposes only the public functions as pure virtual:
class DLLTESTV_API IDLLtestV {<br />
public:<br />
CDLLtestV(void);<br />
virtual int GetX() = 0;<br />
virtual void SetX(int _X) = 0;<br />
};
Then in your dll, you simply make CDlltestV inherits from this interface and you provide there the members and implements the functions.
The 'problem' is that you'll need to provide a function to will create an instance of this class and return a pointer to your interface:
DLLTESTV_API IDlltestV* GetClass()<br />
{<br />
return new CDlltestV;<br />
}
But if your code is well written, this shouldn't pose too much problems.
|
|
|
|
|
To Quote Marshall Cline : "Encapsulation is for code, not for people". You shouldn't try to hide it. The statement private says all there is to say. The best way to enforce proper use is to put all public functions into an abstract base class ("Interface"), derive from it, declare the constructor private and create a class factory that only returns pointers to the ABC. But people will allways see what's in there if you give out the headers. See here : How can I prevent other programmers from violating encapsulation by seeing the private parts of my class?[^]
|
|
|
|