|
Hi
I have a listview control, created with single selection, the list contains the names of printers, port names etc. When I right click an item how can I display the context menu that is displayed when you right click a printer object in Printers and Faxes ? i.e the user sees the same menu to be able to delete/rename printer, click the properties item etc.
I'm using Visual C++ 6.0 on Windows XP, and know how to obtain a handle and open the printer in question and use the PrinterProperties call, but I want to display the menu as you can in Printers and Faxes.
Thanks in advance
|
|
|
|
|
Hi pgibson007700 ,
Can you see to view context_menu in the right click?
|
|
|
|
|
I have not written any code yet to process the right click, all I want to do is what Printers and faxes does i.e displays menu with Open, Printing Preferences..., Properties etc, remember my list control with only contain a text item, which is the name of the printer. Therefore I can obtain server name etc and use OpenPrinter to obtain a handle etc.
|
|
|
|
|
if you want to view Context_menu in the right click
CMenu menu;
menu.LoadMenu(IDR_MAINFRAME);
CMenu *pContextMenu=menu.GetSubMenu(0);
BOOL o=pContextMenu->InsertMenu(0, MF_BYPOSITION | MF_STRING | MF_DISABLED, 0, "StL OBJECT");
pContextMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,point.x,point.y,AfxGetMainWnd());
/*{
CPoint point;
GetCursorPos(&point);
}*/
this section BOOL o=pContextMenu->InsertMenu(0, MF_BYPOSITION | MF_STRING | MF_DISABLED, 0, _T("or anything"));
I reply to question and this is here it can to delete
-- modified at 13:22 Sunday 12th March, 2006
|
|
|
|
|
Hello,
I am to do something as simple as browse the network neighborhood and return the path selected... After a bunch of research the only thing I found that really fits my needs is an article by Paul DiLascia.
http://msdn.microsoft.com/msdnmag/issues/05/06/CAtWork/
Anyway, I am trying to modify his code to only display the network neighborhood and nothing else... He provides 2 functions for filtering out items. I have been playing around with this for hours and I can't seem to figure it out. Can anyone help me out? I only want to display the network neighborhood.
HRESULT CFolderDialog::OnGetEnumFlags(
IShellFolder* psf,
LPCITEMIDLIST pidlFolder,
DWORD *pgrfFlags)
{
BFTRACE(_T("CFolderDialog::OnGetEnumFlags(%p): %s\n"),
psf, GetPathName(pidlFolder));
return S_OK;
}
HRESULT CFolderDialog::OnShouldShow(
IShellFolder* psf,
LPCITEMIDLIST pidlFolder,
LPCITEMIDLIST pidlItem)
{
BFTRACE(_T("CFolderDialog::OnShouldShow(%p): %s: %s\n"), psf,
GetDisplayNameOf(psf, pidlFolder, SHGDN_NORMAL),
GetDisplayNameOf(psf, pidlItem, SHGDN_NORMAL));
return S_OK;
}
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
|
Thanks, I have looked at that before but I would prefer to use this other method.
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Actually I have to override these functions.. Here is the following but I am still unsure on how to filter...
HRESULT CMyFolderDialog::OnGetEnumFlags(IShellFolder* psf, LPCITEMIDLIST pidlFolder,
DWORD *pgrfFlags)
{
BFTRACE(_T("CMyFolderDialog::OnGetEnumFlags\n"));
*pgrfFlags = SHCONTF_FOLDERS;
return S_OK;
}
HRESULT CMyFolderDialog::OnShouldShow(IShellFolder* psf,
LPCITEMIDLIST pidlFolder,
LPCITEMIDLIST pidlItem)
{
BFTRACE(_T("CMyFolderDialog::OnShouldShow(%p): %s: %s"),
psf, GetPathName(pidlFolder), GetDisplayNameOf(psf, pidlItem, SHGDN_NORMAL));
SFGAOF attrs;
psf->GetAttributesOf(1, &pidlItem, &attrs);
BOOL bShow = attrs & (SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER);
BFTRACE(_T(" [attrs: %08x]: %s\n"), attrs, bShow ? _T("Yes") : _T("No"));
return bShow ? S_OK : S_FALSE;
}
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Use SHGetSpecialFolderLocation() with the CSIDL_NETWORK flag to get the PIDL of the Network root folder, then pass this PIDL to SHBrowseForFolder() as the pidlRoot member of the BROWSEINFO structure. This will force the "Browse For Folder" tree to be rooted at the root network folder.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
AWESOME! Thank you that is exactly what I needed!
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
You're welcome
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hi
i got a problem in installing crystal reports 11 it request a file called keycode.dll.
can u help me ?
|
|
|
|
|
Hi
I am drawing on a dialog that is a child for other dialog
in the child dialog am handling the right click event ,in this handling and at certain condition i need to notify the parent dialog that a click happend at the child dialog?
any help is appreciated
thanks alot
|
|
|
|
|
Tarek Jabri wrote: i need to notify the parent dialog that a click happend at the child dialog?
You can use SendMessage to send a user defined message from the child dialog to the parent dialog.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Help !
I'm looking for the reverse API of LoadBitmap.
where can i find a function, or an implementation
who takes a CBitmap object and pushing/adding
it back to the resource....
resource of some other(not running)program.
i want to create RT_BITMAP resources dynamically.
10x in advanced.
me.
|
|
|
|
|
Have a look at the UpdateResource API.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
The followings are there declaration:
const value_type *data( ) const;
const value_type *c_str( ) const;
but I thank they have the same use.
|
|
|
|
|
The later is guaranteed to end with '\0' . The former is not.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I have tested them.
string str( "Hello world" );
char szTemp1[12], szTemp2[12];
strcpy(szTemp1, str.data());
strcpy(szTemp2, str.c_str());
when I view the memory, szTemp1 and szTemp2 have the same content,
and both of them end with '\0'.
// szTemp1: 48 65 6c 6c 6f 20 77 6f 72 6c 64 00
// szTemp2: 48 65 6c 6c 6f 20 77 6f 72 6c 64 00
|
|
|
|
|
ustclover wrote: when I view the memory, szTemp1 and szTemp2 have the same content,
and both of them end with '\0'.
Note the word "guaranteed". The C++ Standard requires c_str to return a pointer to an array that ends with `\0`, and it does not require (nor forbid, for that matter) for data .
The implementation you tested obviously returns a pointer to the same piece of memory in both cases, but it is not necessarily the case for all implementations.
Also, have you tested the case when you have an empty string? c_str() would be guaranteed to return the pointer to `\0`. For data() , again it is implementation dependent, but I would be surprised if it returned the same thing.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I have tested the case for an empty string too. Though the result is same with the nonempty case, I have believed what you said is right. Thank you again
|
|
|
|
|
Hello
I want to use SetBitmapbits function but I can,t I need a sample code or a Guidance
thanks
Agh
|
|
|
|
|
|
how can i launch a programm before session openning?
am
|
|
|
|
|
I assume you mean before a user logs in. Write the program as a service, and install it to run automatically.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|