|
Accepted Ryan.
But my doubt is why doesnt it have the capabilities to handle the messages evethough it is derived from CCmdTarget directly.
|
|
|
|
|
I think CDocument only inherite from CCmdTarget, but not inherite from CWnd.
I think it's MFC designer's intention. I think CDocument is a kind of data, so it only should not handle some user interface message. Are you agree with it?
|
|
|
|
|
It does. You can add menu/toolbar item message handlers to your document class. MFC has some internal magic that will route it to the document's handler if the view doesn't process the message.
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"
|
|
|
|
|
Iuse Administrator to Logged on My widnow xp.
I enum the share printer connected in the network.
I use openprinters() to open the printer ,it success.
I get the printer handle.
then I use FindFirstPrinterChangeNotification() to Monitor the printer ,it fail ,the Error code is 5(ERROR_ACCESS_DENIED).
but if Use the domain user to logged on my window xp(just like: domain1\\user1),
all is good .
why?
what different between of administrator(local) and domain1\\user1(domain)?
how to fix it?
thanks!
my code like this:
hPrinterNotification = FindFirstPrinterChangeNotification(
ThreadParam.hPrinter,
PRINTER_CHANGE_DELETE_JOB,
0,
&NotificationOptions);
if (hPrinterNotification == INVALID_HANDLE_VALUE)
{
CString strE;
strE.Format ("FindFirstPrinterChangeNotification failed! Error code = %d",GetLastError());
return 0;
}
-- modified at 21:47 Monday 27th February, 2006
|
|
|
|
|
Your local administrator account does not necessarily have privileges on the network.
It is possible to enumerate network resources without having necessary permission to access or utilize those resources.
So, you can enumerate the printers, but when you try to open one, you fail from the local administrator account. Your domain account obviously has network printer privileges.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Blake Miller:
can you tell how to open one from the local administrator account?
thanks!
cococut
|
|
|
|
|
The same way you open the other ones, but you have to be granted access permission form the owner of the object, in this case the printer.
In other words, a network administrator needs to grant the MachineName\Administrator account privileges to modify the printer.
Also, you could try different access permission request, instead of ALL_ACCESS try something like 'read' access rights on the OpenPrinter command, that might work, since you are perhaps not trying to change anything.
Most people seem to go for ALL_ACCESS when they only want to query a device. Opening for read only access often works where 'all access' or 'write access' requests fail.
You could post the code for your OpenPrinter command and me or someone here could try to help you out.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Does anyone know why a c++ mfc exe would run without displaying it's form?
Unfortunately I don't have the source.
|
|
|
|
|
check in the property from Dialog that Visible is ture
|
|
|
|
|
i can't do that as i don't have the source code. I'm sure however that the visible property would be true as the app was built to display a form. It's some sort of environment issue i think.
|
|
|
|
|
So I think in the source code use ShowWindow(0)
|
|
|
|
|
i don't have the source code
|
|
|
|
|
It might be displaying the form off screen. You can use Spy++ to see the properties of the window the process creates and see whether it is visible, and what its position is.
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"
|
|
|
|
|
i didn't know about spy++, thanks for the info!
|
|
|
|
|
Please help.
Im populating the CCombox on OnInitDialog.
How to put color on each item text so when the user click the combobox, it will list the items in color (i.e. half of the list is red and half of the list is blue)
|
|
|
|
|
You have to set the Combobox style to CBS_OWNERDRAW. Then you must draw the Combobox items when the window passes the WM_DRAWITEM message.
|
|
|
|
|
Here[^] is a demo.
Nibu thomas
Software Developer
|
|
|
|
|
First derived from CComboBox
and use WM_DRAWITEM then you should set DC in the combobox
Like this:
void CMyComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItem)
{
CDC dc;
dc.Attach(lpDrawItem->hDC);
....
....
if ((lpDrawItem->itemAction | ODA_SELECT) &&
(lpDrawItem->itemState & ODS_SELECTED))
{
...
...
...
}
else
{
...
...
}
dc.DrawText('item text', -1, &rect, DT_LEFT|DT_SINGLELINE|DT_VCENTER);
dc.Detach();
}
And you can use OnCtlColor in this Class.
|
|
|
|
|
I have been programming windows using C++ since a year, but havent done any UI programming. Now I need to get into UI development, I would like to know of any introductory articles in this area. I have not used MFC before, and would like to stay away from it if possible. Can people suggest any URLs on UI development using C++ that can get me started?
thanks!
|
|
|
|
|
Why don't you try working on SDK.
This is a slow process for developing an application , on the other hand if you use MFC you can speed up application development. You can read the code from this site for developing SDK applications
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
AnShUmAn_VCPP wrote: You can read the code from this site for developing SDK applications
which site?
thanks!
|
|
|
|
|
See the documentation that is available for SDK on codeproject.com.
You will see the option for SDK in the left hand pane when you scroll down on the login page
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
If you right click the CD/DVD-ROM, it will show a menu, and one of its menuitem is "eject". As everyone know that all menuitem have an ID, but after tracing the code, I found that the ID of "eject" can be 31014(normal),
30757(folder view), 47(tree view while using folder mode), 31078(short cut),
102(quick launch view), 38(tree view in the application of winrar), 39(create toolbar on taskbar). And i don't if this menuitem ID have other value. Could somebody help me? How to compute the ID or how many ID are there leave for this menuitem of "eject"??
|
|
|
|
|
What would you like to do with that ID. To eject the CD/DVD drive you have to call functions. The ID is useless because every programm has its own menu-IDs for perhaps similar commands.
|
|
|
|
|
I want to control the flow of eject action! when user click eject, it will get into my code, then i can control it.So i must modify the menuitem, there are two flag can be used, MF_POSITION and MF_COMMAND, it seems that is impossible to get the position of eject, so i choose MF_COMMAND, but i have to get the ID.
|
|
|
|