|
Hi, I am trying to catch keystrokes from a modal dialog box in ATL.
I have tried all the usual methods, including the catching the WM_KEYDOWN message with the Message Map, overidding the PreTranslateMessage function and overriding the DialogProc function. These methods all work for the modeless dialog boxes but not my modal one.
Any ideas?
|
|
|
|
|
Hi all,
1. I want to get MAC address of all the client machines in private network of my org. I don't want to use SNMP as the agent should be enabled in all my clients. How to do this??
2. I used WNet calls to enumarate the Client details, I could see only the Name of the machine, Microsoft or Novell, and Node or Container. How can I use the WNet API to get the MAC of all the clients in the private network of my organization ??
Thanks in advance,
Satya
|
|
|
|
|
Not knowing diddly about WNet or having ever gotten a MAC address locally or even over the network here is my stupid suggestion
Doesn't ARP ask "who is ip address such and such?" and then the client with that IP responds with its MAC address. If so, if you have all of the IP addresses of each client on your private network, I would think an ARP "Who is" request work.
Just guessing but it sounds logical.
|
|
|
|
|
I'm not sure what is wrong with my activex control, "Microsoft Web Browser". I add the activex control to my dialog project with no problem. Then I add a member variable to my main dialog class for this activex control. In Visual Studio .net whenever you add a variable for the control, a wrapper class is automatically generated. I believe my problem lies in this automatically generated class. I'm not sure if it's my copy of visual studio .net (2002) but I believe the code being generated for this class is wrong. I have also tried this in VS 6.0 and everything worked fine, and the wrapper class looked completely different. What could be wrong. I haven't been programming in C++ for that long so little things sometimes throw me off, but this time I believe it's a problem with VS .net or my installation of it.
Please Help
This is the wrapper code generated:
<br />
#pragma once<br />
<br />
<br />
<br />
<br />
class CExplorer1 : public CWnd<br />
{<br />
protected:<br />
DECLARE_DYNCREATE(CExplorer1)<br />
public:<br />
CLSID const& GetClsid()<br />
{<br />
static CLSID const clsid<br />
= { 0x8856F961, 0x340A, 0x11D0, { 0xA9, 0x6B, 0x0, 0xC0, 0x4F, 0xD7, 0x5, 0xA2 } };<br />
return clsid;<br />
}<br />
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,<br />
const RECT& rect, CWnd* pParentWnd, UINT nID, <br />
CCreateContext* pContext = NULL)<br />
{ <br />
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); <br />
}<br />
<br />
BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, <br />
UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,<br />
BSTR bstrLicKey = NULL)<br />
{ <br />
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,<br />
pPersist, bStorage, bstrLicKey); <br />
}<br />
<br />
public:<br />
enum<br />
{<br />
CSC_UPDATECOMMANDS = -1,<br />
CSC_NAVIGATEFORWARD = 1,<br />
CSC_NAVIGATEBACK = 2<br />
}CommandStateChangeConstants;<br />
enum<br />
{<br />
OLECMDID_OPEN = 1,<br />
OLECMDID_NEW = 2,<br />
OLECMDID_SAVE = 3,<br />
OLECMDID_SAVEAS = 4,<br />
OLECMDID_SAVECOPYAS = 5,<br />
OLECMDID_PRINT = 6,<br />
OLECMDID_PRINTPREVIEW = 7,<br />
OLECMDID_PAGESETUP = 8,<br />
OLECMDID_SPELL = 9,<br />
OLECMDID_PROPERTIES = 10,<br />
OLECMDID_CUT = 11,<br />
OLECMDID_COPY = 12,<br />
OLECMDID_PASTE = 13,<br />
OLECMDID_PASTESPECIAL = 14,<br />
OLECMDID_UNDO = 15,<br />
OLECMDID_REDO = 16,<br />
OLECMDID_SELECTALL = 17,<br />
OLECMDID_CLEARSELECTION = 18,<br />
OLECMDID_ZOOM = 19,<br />
OLECMDID_GETZOOMRANGE = 20,<br />
OLECMDID_UPDATECOMMANDS = 21,<br />
OLECMDID_REFRESH = 22,<br />
OLECMDID_STOP = 23,<br />
OLECMDID_HIDETOOLBARS = 24,<br />
OLECMDID_SETPROGRESSMAX = 25,<br />
OLECMDID_SETPROGRESSPOS = 26,<br />
OLECMDID_SETPROGRESSTEXT = 27,<br />
OLECMDID_SETTITLE = 28,<br />
OLECMDID_SETDOWNLOADSTATE = 29,<br />
OLECMDID_STOPDOWNLOAD = 30,<br />
OLECMDID_ONTOOLBARACTIVATED = 31,<br />
OLECMDID_FIND = 32,<br />
OLECMDID_DELETE = 33,<br />
OLECMDID_HTTPEQUIV = 34,<br />
OLECMDID_HTTPEQUIV_DONE = 35,<br />
OLECMDID_ENABLE_INTERACTION = 36,<br />
OLECMDID_ONUNLOAD = 37,<br />
OLECMDID_PROPERTYBAG2 = 38,<br />
OLECMDID_PREREFRESH = 39,<br />
OLECMDID_SHOWSCRIPTERROR = 40,<br />
OLECMDID_SHOWMESSAGE = 41,<br />
OLECMDID_SHOWFIND = 42,<br />
OLECMDID_SHOWPAGESETUP = 43,<br />
OLECMDID_SHOWPRINT = 44,<br />
OLECMDID_CLOSE = 45,<br />
OLECMDID_ALLOWUILESSSAVEAS = 46,<br />
OLECMDID_DONTDOWNLOADCSS = 47,<br />
OLECMDID_UPDATEPAGESTATUS = 48,<br />
OLECMDID_PRINT2 = 49,<br />
OLECMDID_PRINTPREVIEW2 = 50,<br />
OLECMDID_SETPRINTTEMPLATE = 51,<br />
OLECMDID_GETPRINTTEMPLATE = 52<br />
}OLECMDID;<br />
enum<br />
{<br />
OLECMDF_SUPPORTED = 1,<br />
OLECMDF_ENABLED = 2,<br />
OLECMDF_LATCHED = 4,<br />
OLECMDF_NINCHED = 8,<br />
OLECMDF_INVISIBLE = 16,<br />
OLECMDF_DEFHIDEONCTXTMENU = 32<br />
}OLECMDF;<br />
enum<br />
{<br />
OLECMDEXECOPT_DODEFAULT = 0,<br />
OLECMDEXECOPT_PROMPTUSER = 1,<br />
OLECMDEXECOPT_DONTPROMPTUSER = 2,<br />
OLECMDEXECOPT_SHOWHELP = 3<br />
}OLECMDEXECOPT;<br />
enum<br />
{<br />
READYSTATE_UNINITIALIZED = 0,<br />
READYSTATE_LOADING = 1,<br />
READYSTATE_LOADED = 2,<br />
READYSTATE_INTERACTIVE = 3,<br />
READYSTATE_COMPLETE = 4<br />
}tagREADYSTATE;<br />
enum<br />
{<br />
secureLockIconUnsecure = 0,<br />
secureLockIconMixed = 1,<br />
secureLockIconSecureUnknownBits = 2,<br />
secureLockIconSecure40Bit = 3,<br />
secureLockIconSecure56Bit = 4,<br />
secureLockIconSecureFortezza = 5,<br />
secureLockIconSecure128Bit = 6<br />
}SecureLockIconConstants;<br />
enum<br />
{<br />
SWC_EXPLORER = 0,<br />
SWC_BROWSER = 1,<br />
SWC_3RDPARTY = 2,<br />
SWC_CALLBACK = 4<br />
}ShellWindowTypeConstants;<br />
enum<br />
{<br />
SWFO_NEEDDISPATCH = 1,<br />
SWFO_INCLUDEPENDING = 2,<br />
SWFO_COOKIEPASSED = 4<br />
}ShellWindowFindWindowOptions;<br />
<br />
<br />
public:<br />
<br />
<br />
<br />
};<br />
|
|
|
|
|
I have a problem in ED (see sig) where sometimes the status bar panes go blank, even though text has been set in them. This happens quite often, to a very few of my users and may depend on how the PC's are setup and what other software is installed/running.
I have seen it happen, and I've spent a lot of time going over all of the code and cannot see anything wrong. Nor can I find anyway to reproduce the problem. And Spy++ hasn't helped. I get the impression that some other process is getting the MS Status Bar Control to play up, but I have no way of proving that.
Has anyone seen or heard of any problems like this?
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi,
I need to write a control in C++ that is accessible from visual basic, and maybe even internet explorer.
I think that activeX is the way to do it. ( I am not developing .NET)
Would it be best to do it in ATL or MFC, or both?
Thanks,
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|
ATL is the best way to write it. That's what ATL is designed to do, especially if you need to use it in IE and require something lightweight that doesn't rely on a lot of external dlls.
The ATL wizards will generate a lot of the boilerplate code for you. Used in conjuction with WTL you should be able to create a control very quickly.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
Hello,
I need to enumerate all childs in a dialog, and set them to empty (0, unchecked, "", etc.). To do that, I use the EnumChildWindows function, and in the callback, I try to create a temporary CWnd* object, based on the hWnd. And to perform the correct treatment for each control, I use the IsKindOf (RUNTIME_CLASS (...)).
All is ok, but the CDateTimeCtrl don't work, the linker says :
dateTimeCtrl_pbDlg.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CDateTimeCtrl::classCDateTimeCtrl" (?classCDateTimeCtrl@CDateTimeCtrl@@2UCRuntimeClass@@B)
That's strange, because the CDateTimeCtrl contains DECLARE/IMPLEMENT_DYNAMIC so I don't understand the pb ...;
How can I do that ?
Any ideas ?
Thanks in advance
Thierry
|
|
|
|
|
I don't think it is such a good idea using MFC RUNTIME_CLASS for this. I use a combination of GetWindowLong( hWnd, GWL_STYLE ) and GetClassName( .. ) to work out what type a control is. This is straight Windows API stuff and doesn't rely on MFC. It is also more efficent than creating temporary CWnd objects etc.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I agree with you, that was my primary way, but the GetClassName seems more efficient. So I'll use it.
Thank you for your answer.
Thierry
|
|
|
|
|
will like to know if there are other ways to position my newly created dialog boxes (ie to have them open at the bottom right hand corner of window for instance). Is there another way other than using SetWindowPos?
thanks
|
|
|
|
|
One solution is the save the window's position in the registry upon exit. Another solution is MoveWindow().
Kuphryn
|
|
|
|
|
Hi,
If you would like to show your dialog box in center of the window use CenterWindow() in OnInitDialog function of your dialog based class.
|
|
|
|
|
CADORecordset m_rs;
//m_rs is opened
m_rs.AddNew();
How to cancel the AddNew();
|
|
|
|
|
If you are not in batch mode then you can't cancel it (undo your operation). You have to delete it.
m_rs.MoveLast();
m_rs.Delete( adAffectCurrent );
In batch mode you can just use CancelUpdate, or RollbackTransmission(). Now, I am not quite sure about the names of these last two functions, because I haven't used them extensively, but look at the ado recordset functions to figure out their actual names and syntaxes are.
By the way, why do you want to cancel AddNew()? Is it because of an error? Because if you have an error, then you can simply call m_rs.CancelUpdate().
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
CADORecordset m_rs;
//m_rs is opened
m_rs.AddNew();
How to cancel to the AddNew();
|
|
|
|
|
|
Handle the WM_KEYDOWN message in one of your windows.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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~` thanks for the reply
i have something like this
BOOL CimgtestDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_KEYDOWN)
{
if (pMsg->wParam == VK_SPACE) {
lpreview = 1;
}
if(pMsg->wParam==VK_ESCAPE)
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
so this means when i press space key lpreview will be set to 1.
if the user keeps pressing space key the lpreview will always be 1.
However, what i want is that when the user doesn't press anything
lpreview will be set to 0. How do i do that?
Thanks
|
|
|
|
|
Don't do it in PreTranslateMessage()!!
Handle WM_KEYDOWN:
void CimgtestDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(nChar == VK_SPACE)
lpreview = 1;
if(nChar == VK_ESCAPE)
}
To set lpreview to 0 when the the key is not pressed, just handle WM_KEYUP:
void CimgtestDlg::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(nChar == VK_SPACE)
lpreview = 0;
}
You can also check the state of the space key at any time by using GetKeyState(VK_SPACE) . If the return value <0, then the key is pressed, else it is not pressed.
Hope this helps
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
Thanks for the help.. really appreciated..
|
|
|
|
|
Dear all:
the table in wordXP can merge ,split ,align the cells.
How I create a table like this ?
Any sample code or suggestion will be prefered .
Thanks a lot in advance !
apex bird
|
|
|
|
|
In some of the newer versions of Rich Edit DLL, you can actually create tables. They do have limits tho... Read the MSDN on it and see if it will do what you want.
Before we saw that you can do this, we created one that emulates words table.
Wrongway
|
|
|
|
|
i want to add string to a combolistbox of a parent class
who can tell me how to do this .
|
|
|
|
|
One solution is messages. Send a message to the parent window and have it update the control.
Kuphryn
|
|
|
|
|