|
From PJ Naughter's CFileTreeCtrl class:
BOOL CTreeFileCtrl::ShowProperties(HTREEITEM hItem)
{
BOOL bSuccess = FALSE;
if (m_bAllowProperties && hItem)
{
CString sFile = ItemToPath(hItem);
SHELLEXECUTEINFO sei;
ZeroMemory(&sei,sizeof(sei));
sei.cbSize = sizeof(sei);
sei.hwnd = AfxGetMainWnd()->GetSafeHwnd();
sei.nShow = SW_SHOW;
sei.lpFile = sFile.GetBuffer(sFile.GetLength());
sei.lpVerb = _T("properties");
sei.fMask = SEE_MASK_INVOKEIDLIST;
bSuccess = ShellExecuteEx(&sei);
sFile.ReleaseBuffer();
}
return bSuccess;
}
So you can blame him if that doesn't work
Just replace ItemToPath() with your filename.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi Paolo
Your method works perfectly! It helps me a lot. : )
Thanks again.
Best regards.
Maer
|
|
|
|
|
How can make my window as "Always on top"?
I mean My Window is always on top of other applications, If other application is activated.
This type of thing happens in the Help also.
I hope you can understand. What my Question (I HOPE)
I know my english is bad.
Thanks in Advance -
|
|
|
|
|
You can create a windows use CreateWindowEx() function and use WS_EX_TOPMOST style. For example:
HWND hWnd;
hWnd=CreateWindowEx(
WS_EX_TOPMOST,
...,// class name
...,// window name
WS_OVERLAPPEDWINDOW,
...);
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
See the VC forum FAQ.
--Mike--
http://home.inreach.com/mdunn/
"Listen you footwarriors, can you hold down a bit with the firing? I've just got three impromptu weddings breaking out behind me!" -- Arthur Dent
your with and
|
|
|
|
|
I need some help ... actually just to be pointed in the right direction, since I haven't dealt with this before.
I have a device that sends data out an RS-232 serial port, but it also sends data to an Ethernet port. The serial port data is handled by a separate device, but now I want the "controller" PC to read the data from the Ethernet port. Both the data-sending device and the PC have been set up with IP addresses in the same domain, and other 3rd party software reads and displays the data, so I know the PC is connected properly. Only these 2 devices are connected, so there is no other network connectivity.
So, a few questions:
- What kind of functions do I use to read data from the Ethernet Port?
- Does the data come as a serial byte stream, or is it in packets? Do I have to do my own message parsing and header-byte syncing, and then extract message data of interest?
- How do I need to "open," or "initialize" the port?
- How does all this work?
CodeProject articles, a web site, the name of a couple of functions that I can track down in the documentation, etc, is all I'm looking for right now. I haven't had much luck so far in tracking down just what I need.
Thanks,
Dave
|
|
|
|
|
I think you need to look at Sockets. Try searching MSDN for Socket API.
Hope this helps,
Michael
|
|
|
|
|
When I stretch the OpenGL MFC window past a certain point, my OpenGL rendered scene gets a black border. The border tends to grow as I increase the client area of the window. The bug happens most of the time, not always. Any ideas?
|
|
|
|
|
This is happaned only if you use combination of MS software render and Windows 2000. This can be fixed with some tricky changes of Windows's size.
|
|
|
|
|
Can anyone give me some pointers on how I would send the data I receive in a CWnd Overloaded function to another window using SendMessage.
For example
void CMyWnd::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CWnd::OnKeyUp(nChar, nRepCnt, nFlags);
::SendMessage(m_hWndTarget, WM_KEYUP, ...)
}
How is this done
James Spibey
|
|
|
|
|
It depends on the message. In this case WM_KEYUP looks like this:
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_KEYUP
WPARAM wParam, // virtual-key code
LPARAM lParam // key data
);
So you would send it as ::SendMessage(m_hWndTarget, WM_KEYUP, (WPARAM)nChar, (LPARAM) nRepCnt | nFlags);
I *think* that is right, basically you need to make sure you send on the data in the format expected by the message, the info you want will always have come into the message handler at the top.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
void CMyWnd::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CWnd::OnKeyUp(nChar, nRepCnt, nFlags);
::SendMessage(m_hWndTarget, WM_KEYUP, (WPARAM) nChar, (LPARAM) ((nFlags * 256) + 1))
}
the lparam for this messages consists on nFlags in bits 31-16, and repeat count in bits 15-0. But the repeat count it always 1 in this message.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Jon is right and I am wrong - I didn't look at the MSDN properly when I wrote my answer.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Actually, I have found an easier way. All I have to do is override the DefWindowProc for my window and filter out the messages which I wish to forward:-
LRESULT CMyWnd::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_KEYUP:
case WM_KEYDOWN:
case WM_SYSKEYUP:
case WM_SYSKEYDOWN:
::SendMessage(m_hWndTarget, message, wParam, lParam);
break;
}
return CWnd::DefWindowProc(message, wParam, lParam);
}
James Spibey
|
|
|
|
|
Maybe you can use CWnd::GetCurrentMessage() and use the returned MSG structure.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
In my program i use a CListCtrl..
Selecting multiple Items.. everything is ok..
but after processing the selection i would like to destroy the selection the user made..
visually it is simple, using SetSelectionMark(-1)...
but msdn says:
"This macro does not affect the selection state of the item"
and this is the problem.. the user clicks "process" once again.. and the same selection gets processed... but i want to delete the section..
the only solution i found would be setting the "ItemState" to NonSelected.. but i had to do this for the whole selection..
is there any other / easier way??
thanks in advance
bernhard
stolen sig#19:
"Just looking for loopholes." W. C. Fields [American actor, 1880-1946, explaining why he was reading the Bible on his deathbed.]
|
|
|
|
|
Well if you are doing the processing in a loop then you could just set the ItemState to Nonselected as soon as you are done processing that item and then when all processing is done set the selection mark to -1.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
ListView_SetItemState ( hwndYourList, -1, LVIS_SELECTED, 0 );
turns off the selected state for all items in the list.
--Mike--
http://home.inreach.com/mdunn/
"Listen you footwarriors, can you hold down a bit with the firing? I've just got three impromptu weddings breaking out behind me!" -- Arthur Dent
your with and
|
|
|
|
|
How can i create setup foe win ce application?
Kumar Saurabh
Software Engneer
Syndew Pvt Ltd
New Delhi
India
|
|
|
|
|
Is it possible to change screen resolution which is not supported by the device driver(for eg. 700x400) by calling IDirectDraw::setdisplaymode?
I want to call this api as setdisplaymode(700,400,16)or
setdisplaymode(200,400,8)
|
|
|
|
|
No, no, no. Look up EnumDisplayModes - they are ALL you can set it to, the ones the card supports.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I need to create a dll component that shows dialog form that performs some things.
This component have to match to work in client program of Delphi.
So Which type of dll I need create for it ? (ATL/ ACTIVE X or another )
-----------------------------------------------------------------------
I maked it as MFC Extention DLL but it works only in client program of VC (not in Delphi !)
------------------------------------------------------------------------
Please help ! It is very urgent !!!
|
|
|
|
|
I maked it as MFC Extention DLL but it works only in client program of VC (not in Delphi !)
extension dll's work just in mfc... so you can't use em in delphi, visual basic or whatever..
i am not expert.. but if you want to use the component everywhere you have to use
ActiveX or COM..
to decrease size of the component it is better if you implement it using ATL and not MFC... that makes the whole dll smaller and you don't have to link with the MFC (static or dynamic linking)...
if you need tutorials building a component see the sections in codeproject...
hope this helps a little bit
bernhard
stolen sig #18
"Pseudocode is code to demonstrate a concept, not designed to be run. Like certain Microsoft software. "
|
|
|
|
|
Thank you.
So you suggest me to use in ATL.
But I understood that there are problem in ATL if I want to use in class CDialog of MFC and I need use Dialog form as basis to my implementation.
What do you say about it ?
|
|
|
|
|
You can use a dialog resource to make an ATL dialog, but you won't use any MFC classes, like CDialog. There are ATL equivalents of these. In the ATL object wizrd thingy, under the miscellaneous tab, there is a "dialog" option. Chose that. You'll have an ATL dialog. The resulting dialog is NOT a COM object yet, though. Go back into the new object wizrd thingy, and select new Simple object, and make a COM object that contains an instance of the dialog class as a member, and expose functionality of the dialog through the COM objects interface. Then you can use the dialog in VB, or wherever COM objects may be used.
|
|
|
|